debugedit-5.3.5-DWARF-4.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. add DWARF 4 support
  2. https://bugs.gentoo.org/400663
  3. https://bugzilla.redhat.com/show_bug.cgi?id=707677
  4. --- debugedit-5.3.5/debugedit.c 2011-10-11 05:37:49.000000000 +0200
  5. +++ debugedit-5.3.5/debugedit.c 2012-01-25 01:27:23.487999039 +0100
  6. @@ -70,6 +70,10 @@
  7. #include <rpmtag.h>
  8. #define DW_TAG_partial_unit 0x3c
  9. +#define DW_FORM_sec_offset 0x17
  10. +#define DW_FORM_exprloc 0x18
  11. +#define DW_FORM_flag_present 0x19
  12. +#define DW_FORM_ref_sig8 0x20
  13. char *base_dir = NULL;
  14. char *dest_dir = NULL;
  15. @@ -246,6 +250,7 @@
  16. #define DEBUG_STR 8
  17. #define DEBUG_FRAME 9
  18. #define DEBUG_RANGES 10
  19. +#define DEBUG_TYPES 11
  20. { ".debug_info", NULL, NULL, 0, 0, 0 },
  21. { ".debug_abbrev", NULL, NULL, 0, 0, 0 },
  22. { ".debug_line", NULL, NULL, 0, 0, 0 },
  23. @@ -257,6 +262,7 @@
  24. { ".debug_str", NULL, NULL, 0, 0, 0 },
  25. { ".debug_frame", NULL, NULL, 0, 0, 0 },
  26. { ".debug_ranges", NULL, NULL, 0, 0, 0 },
  27. + { ".debug_types", NULL, NULL, 0, 0, 0 },
  28. { NULL, NULL, NULL, 0, 0, 0 }
  29. };
  30. @@ -349,7 +355,8 @@
  31. goto no_memory;
  32. }
  33. form = read_uleb128 (ptr);
  34. - if (form == 2 || form > DW_FORM_indirect)
  35. + if (form == 2
  36. + || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8))
  37. {
  38. error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form);
  39. htab_delete (h);
  40. @@ -378,7 +385,6 @@
  41. canonicalize_path (const char *s, char *d)
  42. {
  43. char *rv = d;
  44. - const char *sroot;
  45. char *droot;
  46. if (IS_DIR_SEPARATOR (*s))
  47. @@ -394,7 +400,6 @@
  48. s++;
  49. }
  50. droot = d;
  51. - sroot = s;
  52. while (*s)
  53. {
  54. @@ -513,7 +518,7 @@
  55. }
  56. value = read_16 (ptr);
  57. - if (value != 2 && value != 3)
  58. + if (value != 2 && value != 3 && value != 4)
  59. {
  60. error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
  61. value);
  62. @@ -529,8 +534,8 @@
  63. return 1;
  64. }
  65. - opcode_base = ptr[4];
  66. - ptr = dir = ptr + 4 + opcode_base;
  67. + opcode_base = ptr[4 + (value >= 4)];
  68. + ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
  69. /* dir table: */
  70. value = 1;
  71. @@ -758,7 +763,8 @@
  72. {
  73. if (t->attr[i].attr == DW_AT_stmt_list)
  74. {
  75. - if (form == DW_FORM_data4)
  76. + if (form == DW_FORM_data4
  77. + || form == DW_FORM_sec_offset)
  78. {
  79. list_offs = do_read_32_relocated (ptr);
  80. found_list_offs = 1;
  81. @@ -864,6 +870,8 @@
  82. else
  83. ptr += 4;
  84. break;
  85. + case DW_FORM_flag_present:
  86. + break;
  87. case DW_FORM_addr:
  88. ptr += ptr_size;
  89. break;
  90. @@ -878,10 +886,12 @@
  91. break;
  92. case DW_FORM_ref4:
  93. case DW_FORM_data4:
  94. + case DW_FORM_sec_offset:
  95. ptr += 4;
  96. break;
  97. case DW_FORM_ref8:
  98. case DW_FORM_data8:
  99. + case DW_FORM_ref_sig8:
  100. ptr += 8;
  101. break;
  102. case DW_FORM_sdata:
  103. @@ -910,6 +920,7 @@
  104. form = DW_FORM_block1;
  105. break;
  106. case DW_FORM_block:
  107. + case DW_FORM_exprloc:
  108. len = read_uleb128 (ptr);
  109. form = DW_FORM_block1;
  110. assert (len < UINT_MAX);
  111. @@ -1213,7 +1224,7 @@
  112. }
  113. cu_version = read_16 (ptr);
  114. - if (cu_version != 2 && cu_version != 3)
  115. + if (cu_version != 2 && cu_version != 3 && cu_version != 4)
  116. {
  117. error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
  118. cu_version);