summaryrefslogtreecommitdiff
path: root/dwarf_info.c
diff options
context:
space:
mode:
authorAravinda Prasad <aravinda@linux.vnet.ibm.com>2013-02-05 13:24:35 +0900
committerAtsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>2013-02-05 13:34:00 +0900
commit63676e86858302b1bda5e614a267e677e28ded5a (patch)
tree59d5e311305ef6320740ec09a3ae1ab6f5e72e14 /dwarf_info.c
parent9c19ab000dde94e185569d00c619cdfc48f64225 (diff)
[PATCH v4 7/9] Support fully typed symbol access mode.
Eppic enables access to symbols in two ways. The first, is a more natural mode in that it makes symbols available as fully typed entities. The second, is generic and treats all symbols as an address to data which then needs to be cast to the proper type explicitly. The former obviously enables an easier cut & pasting of target code into eppic code. Currently generic symbol access mode is supported. This patch extends the functionality to include support for fully typed symbol access mode (which will be the default mode) in eppic macros. User can switch to generic symbol access mode by setting the following environmental variable - EPPIC_LEGACY_MODE. libeppic.a will take care of handling EPPIC_LEGACY_MODE. libeppic.a will pass NULL to VALUE_S* argument of apigetval() call back function if EPPIC_LEGACY_MODE is set. Refer to http://code.google.com/p/eppic/ for more information. Signed-off-by: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
Diffstat (limited to 'dwarf_info.c')
-rw-r--r--dwarf_info.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/dwarf_info.c b/dwarf_info.c
index f149da1..a11b6ad 100644
--- a/dwarf_info.c
+++ b/dwarf_info.c
@@ -119,6 +119,15 @@ is_search_domain(int cmd)
}
static int
+is_search_die(int cmd)
+{
+ if (cmd == DWARF_INFO_GET_DIE)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static int
process_module (Dwfl_Module *dwflmod,
void **userdata __attribute__ ((unused)),
const char *name __attribute__ ((unused)),
@@ -858,6 +867,25 @@ search_domain(Dwarf_Die *die, int *found)
}
static void
+search_die(Dwarf_Die *die, int *found)
+{
+ const char *name;
+
+ do {
+ name = dwarf_diename(die);
+
+ if ((!name) || strcmp(name, dwarf_info.symbol_name))
+ continue;
+
+ if (found)
+ *found = TRUE;
+
+ dwarf_info.die_offset = dwarf_dieoffset(die);
+ return;
+ } while (!dwarf_siblingof(die, die));
+}
+
+static void
search_die_tree(Dwarf_Die *die, int *found)
{
Dwarf_Die child;
@@ -885,6 +913,9 @@ search_die_tree(Dwarf_Die *die, int *found)
else if (is_search_domain(dwarf_info.cmd))
search_domain(die, found);
+
+ else if (is_search_die(dwarf_info.cmd))
+ search_die(die, found);
}
static int
@@ -1452,6 +1483,27 @@ get_die_name(unsigned long long die_off)
}
/*
+ * Get the die offset given the die name
+ */
+unsigned long long
+get_die_offset(char *sysname)
+{
+ dwarf_info.cmd = DWARF_INFO_GET_DIE;
+ dwarf_info.symbol_name = sysname;
+ dwarf_info.type_name = NULL;
+ dwarf_info.struct_size = NOT_FOUND_STRUCTURE;
+ dwarf_info.die_offset = 0;
+
+ if (!sysname)
+ return 0;
+
+ if (!get_debug_info())
+ return 0;
+
+ return (unsigned long long)dwarf_info.die_offset;
+}
+
+/*
* Get length attribute given the die offset
*/
int