#include <assert.h>#include <byteswap.h>#include <endian.h>#include <errno.h>#include <error.h>#include <limits.h>#include <string.h>#include <stdlib.h>#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <popt.h>#include <gelf.h>#include <dwarf.h>#include "hashtab.h"Go to the source code of this file.
Data Structures | |
| struct | DSO |
| struct | REL |
| struct | abbrev_attr |
| struct | abbrev_tag |
Defines | |
| #define | _FILE_OFFSET_BITS 64 |
| #define | DW_TAG_partial_unit 0x3c |
| #define | read_uleb128(ptr) |
| #define | read_1(ptr) *ptr++ |
| #define | read_16(ptr) |
| #define | read_32(ptr) |
| #define | do_read_32_relocated(ptr) |
| #define | read_32_relocated(ptr) |
| #define | DEBUG_INFO 0 |
| #define | DEBUG_ABBREV 1 |
| #define | DEBUG_LINE 2 |
| #define | DEBUG_ARANGES 3 |
| #define | DEBUG_PUBNAMES 4 |
| #define | DEBUG_MACINFO 5 |
| #define | DEBUG_LOC 6 |
| #define | DEBUG_STR 7 |
| #define | DEBUG_FRAME 8 |
| #define | DEBUG_RANGES 9 |
| #define | IS_DIR_SEPARATOR(c) ((c)=='/') |
Typedefs | |
| typedef unsigned int | uint_32 |
| typedef unsigned short | uint_16 |
Functions | |
| static uint_16 | buf_read_ule16 (unsigned char *data) |
| static uint_16 | buf_read_ube16 (unsigned char *data) |
| static uint_32 | buf_read_ule32 (unsigned char *data) |
| static uint_32 | buf_read_ube32 (unsigned char *data) |
| static const char * | strptr (DSO *dso, int sec, off_t offset) |
| static void | dwarf2_write_le32 (unsigned char *p, GElf_Addr val) |
| static void | dwarf2_write_be32 (unsigned char *p, GElf_Addr val) |
| static hashval_t | abbrev_hash (const void *p) |
| static int | abbrev_eq (const void *p, const void *q) |
| static void | abbrev_del (void *p) |
| static htab_t | read_abbrev (DSO *dso, unsigned char *ptr) |
| static char * | canonicalize_path (char *s, char *d) |
| static int | has_prefix (const char *str, const char *prefix) |
| static int | edit_dwarf2_line (DSO *dso, uint_32 off, char *comp_dir, int phase) |
| static unsigned char * | edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) |
| static int | rel_cmp (const void *a, const void *b) |
| static int | edit_dwarf2 (DSO *dso) |
| static DSO * | fdopen_dso (int fd, const char *name) |
| int | main (int argc, char *argv[]) |
Variables | |
| char * | base_dir = NULL |
| char * | dest_dir = NULL |
| char * | list_file = NULL |
| int | list_file_fd = -1 |
| static uint_16(* | do_read_16 )(unsigned char *ptr) |
| static uint_32(* | do_read_32 )(unsigned char *ptr) |
| static void(* | write_32 )(unsigned char *ptr, GElf_Addr val) |
| static int | ptr_size |
| REL * | relptr |
| REL * | relend |
| int | reltype |
| struct { | |
| lu_byte left | |
| lu_byte right | |
| rpmop_s ops [FDSTAT_MAX] | |
| const char * name | |
| unsigned char * data | |
| Elf_Data * elf_data | |
| size_t size | |
| int sec | |
| int relsec | |
| } | debug_sections [] |
| static struct poptOption | optionsTable [] |
|
|
Definition at line 20 of file debugedit.c. |
|
|
Referenced by edit_dwarf2(). |
|
|
|
|
|
|
|
|
Referenced by edit_dwarf2(). |
|
|
Referenced by edit_dwarf2(), and edit_dwarf2_line(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Referenced by edit_attributes(), edit_dwarf2(), and edit_dwarf2_line(). |
|
|
Value: ({ \
uint_32 dret = do_read_32 (ptr); \
if (relptr) \
{ \
while (relptr < relend && relptr->ptr < ptr) \
++relptr; \
if (relptr < relend && relptr->ptr == ptr) \
{ \
if (reltype == SHT_REL) \
dret += relptr->addend; \
else \
dret = relptr->addend; \
} \
} \
dret; \
})
Definition at line 153 of file debugedit.c. Referenced by edit_attributes(). |
|
|
Definition at line 41 of file debugedit.c. Referenced by edit_attributes(). |
|
|
Definition at line 343 of file debugedit.c. Referenced by canonicalize_path(). |
|
|
Definition at line 136 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Value: ({ \
uint_16 ret = do_read_16 (ptr); \
ptr += 2; \
ret; \
})
Definition at line 138 of file debugedit.c. Referenced by edit_attributes(), edit_dwarf2(), and edit_dwarf2_line(). |
|
|
Value: ({ \
uint_32 ret = do_read_32 (ptr); \
ptr += 4; \
ret; \
})
Definition at line 144 of file debugedit.c. Referenced by edit_attributes(), edit_dwarf2(), and edit_dwarf2_line(). |
|
|
Value: ({ \
uint_32 ret = do_read_32_relocated (ptr); \
ptr += 4; \
ret; \
})
Definition at line 170 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Value: ({ \
unsigned int ret = 0; \
unsigned int c; \
int shift = 0; \
do \
{ \
c = *ptr++; \
ret |= (c & 0x7f) << shift; \
shift += 7; \
} while (c & 0x80); \
\
if (shift >= 35) \
ret = UINT_MAX; \
ret; \
})
Definition at line 67 of file debugedit.c. Referenced by edit_attributes(), edit_dwarf2(), edit_dwarf2_line(), and read_abbrev(). |
|
|
Definition at line 49 of file debugedit.c. |
|
|
Definition at line 48 of file debugedit.c. |
|
|
Definition at line 263 of file debugedit.c. Referenced by read_abbrev(). |
|
||||||||||||
|
Definition at line 254 of file debugedit.c. References abbrev_tag::entry. Referenced by read_abbrev(). |
|
|
Definition at line 246 of file debugedit.c. References abbrev_tag::entry. Referenced by read_abbrev(). |
|
|
Definition at line 96 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 108 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 90 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 102 of file debugedit.c. Referenced by edit_dwarf2(). |
|
||||||||||||
|
Definition at line 346 of file debugedit.c. References IS_DIR_SEPARATOR. Referenced by edit_dwarf2_line(). |
|
||||||||||||
|
Definition at line 189 of file debugedit.c. Referenced by edit_dwarf2(). |
|
||||||||||||
|
Definition at line 177 of file debugedit.c. Referenced by edit_dwarf2(). |
|
||||||||||||||||||||
|
Definition at line 687 of file debugedit.c. References abbrev_attr::attr, abbrev_tag::attr, base_dir, data, debug_sections, DEBUG_STR, dest_dir, do_read_32_relocated, DW_TAG_partial_unit, edit_dwarf2_line(), elf_data, DSO::filename, abbrev_attr::form, has_prefix(), name, abbrev_tag::nattr, ptr_size, read_16, read_32, read_uleb128, and abbrev_tag::tag. Referenced by edit_dwarf2(). |
|
|
Definition at line 874 of file debugedit.c. References REL::addend, buf_read_ube16(), buf_read_ube32(), buf_read_ule16(), buf_read_ule32(), data, DEBUG_ABBREV, DEBUG_INFO, DEBUG_LINE, debug_sections, DEBUG_STR, do_read_16, do_read_32, dwarf2_write_be32(), dwarf2_write_le32(), edit_attributes(), DSO::ehdr, abbrev_tag::entry, errno, DSO::filename, htab_delete(), htab_find_with_hash(), name, REL::ptr, ptr_size, read_1, read_16, read_32, read_32_relocated, read_abbrev(), read_uleb128, rel_cmp(), relsec, reltype, DSO::scn, DSO::shdr, size, strptr(), and write_32. Referenced by main(). |
|
||||||||||||||||||||
|
Definition at line 451 of file debugedit.c. References alloca(), base_dir, canonicalize_path(), DEBUG_LINE, debug_sections, DEBUG_STR, dest_dir, elf_data, EXIT_FAILURE, file, DSO::filename, has_prefix(), list_file_fd, read_16, read_32, read_uleb128, and size. Referenced by edit_attributes(). |
|
||||||||||||
|
Definition at line 1190 of file debugedit.c. References DSO::ehdr, DSO::elf, DSO::filename, DSO::scn, and DSO::shdr. Referenced by main(). |
|
||||||||||||
|
Definition at line 435 of file debugedit.c. Referenced by edit_attributes(), and edit_dwarf2_line(). |
|
||||||||||||
|
Definition at line 1265 of file debugedit.c. References base_dir, dest_dir, edit_dwarf2(), DSO::ehdr, DSO::elf, errno, fdopen_dso(), file, list_file, list_file_fd, name, optionsTable, DSO::shdr, strerror, and strptr(). |
|
||||||||||||
|
Definition at line 269 of file debugedit.c. References abbrev_del(), abbrev_eq(), abbrev_hash(), DSO::filename, htab_delete(), htab_find_slot(), htab_try_create, INSERT, read_uleb128, and size. Referenced by edit_dwarf2(). |
|
||||||||||||
|
Definition at line 860 of file debugedit.c. References REL::ptr. Referenced by edit_dwarf2(). |
|
||||||||||||||||
|
Definition at line 114 of file debugedit.c. References data, and DSO::scn. Referenced by edit_dwarf2(), and main(). |
|
|
Definition at line 43 of file debugedit.c. Referenced by edit_attributes(), edit_dwarf2_line(), and main(). |
|
|
Definition at line 202 of file debugedit.c. Referenced by cacheContainsDirectory(), db_join(), db_put(), edit_attributes(), edit_dwarf2(), hdr_subscript(), miFreeHeader(), open_dso(), rpmdbAdd(), rpmdbCountPackages(), rpmdbFindFpList(), rpmdbGrowIterator(), rpmdbInitIterator(), rpmdbNextIterator(), rpmdbRemove(), rpmfcELF(), rpmts_GetKeys(), strptr(), and unsatisfiedDepend(). |
|
|
Referenced by edit_attributes(), edit_dwarf2(), and edit_dwarf2_line(). |
|
|
Definition at line 44 of file debugedit.c. Referenced by edit_attributes(), edit_dwarf2_line(), and main(). |
|
|
Definition at line 83 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 84 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 203 of file debugedit.c. Referenced by edit_attributes(), and edit_dwarf2_line(). |
|
|
Definition at line 45 of file debugedit.c. Referenced by main(). |
|
|
Definition at line 46 of file debugedit.c. Referenced by edit_dwarf2_line(), and main(). |
|
|
Definition at line 201 of file debugedit.c. |
|
|
Initial value: {
{ "base-dir", 'b', POPT_ARG_STRING, &base_dir, 0,
"base build directory of objects", NULL },
{ "dest-dir", 'd', POPT_ARG_STRING, &dest_dir, 0,
"directory to rewrite base-dir into", NULL },
{ "list-file", 'l', POPT_ARG_STRING, &list_file, 0,
"file where to put list of source and header file names", NULL },
POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0, NULL, NULL }
}
Definition at line 1178 of file debugedit.c. |
|
|
Definition at line 87 of file debugedit.c. Referenced by edit_attributes(), and edit_dwarf2(). |
|
|
Definition at line 150 of file debugedit.c. |
|
|
Definition at line 150 of file debugedit.c. |
|
|
Definition at line 205 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 151 of file debugedit.c. Referenced by edit_dwarf2(). |
|
|
Definition at line 205 of file debugedit.c. |
|
|
|
Definition at line 85 of file debugedit.c. Referenced by edit_dwarf2(). |
1.4.4