Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2009-02-19 01:07:50 +0000
committereutarass2009-02-19 01:07:50 +0000
commit45d5ec1a5e21886e3b0f67a508e30ca2e64b1a94 (patch)
tree2e5e22e5297bee88c6e2a18735da9c79971550a2 /tcf_elf.h
parent7a549d866a3443ec7d279b65130093fd8f027c66 (diff)
downloadorg.eclipse.tcf.agent-45d5ec1a5e21886e3b0f67a508e30ca2e64b1a94.tar.gz
org.eclipse.tcf.agent-45d5ec1a5e21886e3b0f67a508e30ca2e64b1a94.tar.xz
org.eclipse.tcf.agent-45d5ec1a5e21886e3b0f67a508e30ca2e64b1a94.zip
TCF Agent, Linux: Fixed translation of link-time addresses to run-time addresses - support of shared libraries debugging
Diffstat (limited to 'tcf_elf.h')
-rw-r--r--tcf_elf.h51
1 files changed, 47 insertions, 4 deletions
diff --git a/tcf_elf.h b/tcf_elf.h
index 6a4a9e05..d7036902 100644
--- a/tcf_elf.h
+++ b/tcf_elf.h
@@ -84,6 +84,19 @@
#define STT_SECTION 3
#define STT_FILE 4
+#define PT_NULL 0
+#define PT_LOAD 1
+#define PT_DYNAMIC 2
+#define PT_INTERP 3
+#define PT_NOTE 4
+#define PT_SHLIB 5
+#define PT_PHDR 6
+#define PT_TLS 7
+
+#define PF_X (1 << 0)
+#define PF_W (1 << 1)
+#define PF_R (1 << 2)
+
typedef unsigned long Elf32_Addr;
typedef unsigned short Elf32_Half;
typedef unsigned long Elf32_Off;
@@ -120,6 +133,17 @@ typedef struct Elf32_Shdr {
Elf32_Word sh_entsize;
} Elf32_Shdr;
+typedef struct Elf32_Phdr {
+ Elf32_Word p_type;
+ Elf32_Off p_offset;
+ Elf32_Addr p_vaddr;
+ Elf32_Addr p_paddr;
+ Elf32_Word p_filesz;
+ Elf32_Word p_memsz;
+ Elf32_Word p_flags;
+ Elf32_Word p_align;
+} Elf32_Phdr;
+
typedef struct Elf32_Sym {
Elf32_Word st_name;
Elf32_Addr st_value;
@@ -177,10 +201,9 @@ typedef signed int I4_T;
typedef uns64 U8_T;
typedef int64 I8_T;
-struct ELF_File;
-struct ELF_Section;
-typedef struct ELF_Section ELF_Section;
typedef struct ELF_File ELF_File;
+typedef struct ELF_Section ELF_Section;
+typedef struct ELF_PHeader ELF_PHeader;
struct ELF_File {
ELF_File * next;
@@ -193,11 +216,16 @@ struct ELF_File {
int fd;
int big_endian; /* 0 - least significant first, 1 - most significat first */
+ int pic; /* > 0 if position independend code, e.g. shared object file */
int elf64;
+
unsigned section_cnt;
- ELF_Section ** sections;
+ ELF_Section * sections;
char * str_pool;
+ unsigned pheader_cnt;
+ ELF_PHeader * pheaders;
+
void * dwarf_io_cache;
void * dwarf_dt_cache;
@@ -223,6 +251,16 @@ struct ELF_Section {
size_t mmap_size;
};
+struct ELF_PHeader {
+ U4_T type;
+ U8_T offset;
+ U8_T address;
+ U8_T file_size;
+ U8_T mem_size;
+ U4_T flags;
+ U4_T align;
+};
+
/*
* Open ELF file for reading.
* Same file can be opened mutiple times, each call to elf_open() increases reference counter.
@@ -268,6 +306,11 @@ extern int elf_load(ELF_Section * section);
typedef void (*ELFCloseListener)(ELF_File *);
extern void elf_add_close_listener(ELFCloseListener listener);
+/*
+ * Map link-time address in an ELF file to run-time address in a context.
+ */
+extern ContextAddress elf_map_to_run_time_address(Context * ctx, ELF_File * file, ContextAddress addr);
+
#endif
#endif

Back to the top