PageRenderTime 55ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/0.3/import_symb.c

https://github.com/ice799/rr0d
C | 95 lines | 58 code | 26 blank | 11 comment | 9 complexity | a9eaf16a2b34db49116532e4d0866066 MD5 | raw file
  1. /*
  2. * This file is part of the Rasta Ring 0 debug
  3. *
  4. * Copyright (C) 2004 Droids Corporation.
  5. * based on Deblin debuger
  6. *
  7. * $Id
  8. *
  9. */
  10. #include "import_symb.h"
  11. #include "utils.h"
  12. #include "buffering.h"
  13. Symbol tab_import_symb[MAX_SYMBOL];
  14. void init_symb(void)
  15. {
  16. int i;
  17. for (i=0;i<MAX_SYMBOL;i++)
  18. {
  19. tab_import_symb[i].address=0;
  20. tab_import_symb[i].name[0]=0;
  21. }
  22. /*TEST TEST */
  23. rr0d_strcpy(tab_import_symb[0].name, "pouet1 (_.-._)" );
  24. tab_import_symb[0].address = 0x8048373;
  25. rr0d_strcpy(tab_import_symb[1].name, "boubou2");
  26. tab_import_symb[1].address = 0x8048365;
  27. /*FIN TEST*/
  28. }
  29. char * is_symbol_address(unsigned int address)
  30. {
  31. int i;
  32. for (i=0;i<MAX_SYMBOL;i++)
  33. {
  34. if (address == tab_import_symb[i].address)
  35. {
  36. return tab_import_symb[i].name;
  37. }
  38. }
  39. return (char*)0;
  40. }
  41. int load_symbol(Symbol* address_symbol, unsigned int num_symb)
  42. {
  43. unsigned int i=0;
  44. unsigned int ii;
  45. #if 0
  46. char debug__[80];
  47. #endif
  48. while((address_symbol[i].address != 0) && (i<num_symb) && (i<MAX_SYMBOL))
  49. {
  50. tab_import_symb[i].address = address_symbol[i].address;
  51. for (ii=0;ii<SYMBOL_NAME_LEN;ii++)
  52. tab_import_symb[i].name[ii] = address_symbol[i].name[ii];
  53. i++;
  54. }
  55. tab_import_symb[i].address = 0;
  56. return i;
  57. }
  58. void list_symbol()
  59. {
  60. unsigned int i=0;
  61. char debug__[80];
  62. i = 0;
  63. while(tab_import_symb[i].address && (i<MAX_SYMBOL))
  64. {
  65. Sprintf(debug__, "%s %.8X", tab_import_symb[i].name, tab_import_symb[i].address);
  66. insertinbuffer(debug__);
  67. i++;
  68. }
  69. }