summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Kogan <dima@secretsauce.net>2014-04-23 00:06:45 -0700
committerChanho Park <chanho61.park@samsung.com>2014-08-22 20:38:25 +0900
commit5d34088f4bd07ff1e91826ca981c10f54748e76f (patch)
treec969aefa77d341fd8fec0cf13a406531c0d525ad
parent600771876d503cc648fbcf9078d3c439779fd9eb (diff)
downloadltrace-5d34088f4bd07ff1e91826ca981c10f54748e76f.tar.gz
ltrace-5d34088f4bd07ff1e91826ca981c10f54748e76f.tar.bz2
ltrace-5d34088f4bd07ff1e91826ca981c10f54748e76f.zip
I now import functions using their linkage name
This is required for C++ methods
-rw-r--r--dwarf_prototypes.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/dwarf_prototypes.c b/dwarf_prototypes.c
index 0ab05b8..9f03384 100644
--- a/dwarf_prototypes.c
+++ b/dwarf_prototypes.c
@@ -700,7 +700,20 @@ static bool process_die_compileunit(struct protolib* plib, struct library* lib,
while (1) {
if (dwarf_tag(&die) == DW_TAG_subprogram) {
- const char* function_name = dwarf_diename(&die);
+
+ // I use the linkage function name if there is one, otherwise the
+ // plain name
+ const char* function_name = NULL;
+ Dwarf_Attribute attr;
+ if (dwarf_attr(&die, DW_AT_linkage_name, &attr) != NULL)
+ function_name = dwarf_formstring(&attr);
+ if (function_name == NULL)
+ function_name = dwarf_diename(&die);
+ if (function_name == NULL) {
+ complain(&die, "Function has no name. Not importing" );
+ goto next_prototype;
+ }
+
complain(&die, "subroutine_type: 0x%02x; function '%s'",
dwarf_tag(&die), function_name);