[memprof: 36/76] use elf_demangle() in more places



commit d8005f48542d8280e84063fa99f15f9e1a1c099a
Author: William Pitcock <nenolod atheme org>
Date:   Sun Apr 6 13:01:35 2008 -0500

    use elf_demangle() in more places

 src/elfparser.c |   23 +++++++++++++++++++----
 src/main.c      |   14 +++++++++-----
 2 files changed, 28 insertions(+), 9 deletions(-)
---
diff --git a/src/elfparser.c b/src/elfparser.c
index 86a3f34..c8415b4 100644
--- a/src/elfparser.c
+++ b/src/elfparser.c
@@ -360,10 +360,25 @@ extern char *sysprof_cplus_demangle (const char *name, int options);
 char *
 elf_demangle (const char *name)
 {
-#define DMGL_PARAMS     (1 << 0)        /* Include function args */
-#define DMGL_ANSI       (1 << 1)        /* Include const, volatile, etc */
-    
-    char *demangled = sysprof_cplus_demangle (name, DMGL_PARAMS | DMGL_ANSI);
+#define DMGL_NO_OPTS     0              /* For readability... */
+#define DMGL_PARAMS      (1 << 0)       /* Include function args */
+#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
+#define DMGL_JAVA        (1 << 2)       /* Demangle as Java rather than C++. */
+#define DMGL_VERBOSE     (1 << 3)       /* Include implementation details.  */
+#define DMGL_TYPES       (1 << 4)       /* Also try to demangle type encodings.  */
+
+#define DMGL_AUTO        (1 << 8)
+#define DMGL_GNU         (1 << 9)
+#define DMGL_LUCID       (1 << 10)
+#define DMGL_ARM         (1 << 11)
+#define DMGL_HP          (1 << 12)       /* For the HP aCC compiler;
+                                            same as ARM except for
+                                            template arguments, etc. */
+#define DMGL_EDG         (1 << 13)
+#define DMGL_GNU_V3      (1 << 14)
+#define DMGL_GNAT        (1 << 15)
+
+    char *demangled = sysprof_cplus_demangle (name, DMGL_PARAMS | DMGL_ANSI | DMGL_VERBOSE | DMGL_TYPES | DMGL_GNU);
     
     if (demangled)
 	return demangled;
diff --git a/src/main.c b/src/main.c
index 44b86fe..230bb13 100644
--- a/src/main.c
+++ b/src/main.c
@@ -494,12 +494,12 @@ profile_selection_changed (GtkTreeSelection *selection, ProcessWindow *pwin)
 
 		if (caller->node) {
 			if (caller->node->symbol)
-				name = caller->node->symbol;
+				name = elf_demangle(caller->node->symbol);
 			else
-				name = "???";
+				name = g_strdup("???");
 		}
 		else
-			name = "<spontaneous>";
+			name = g_strdup("<spontaneous>");
 			
 		gtk_list_store_append (list_store, &iter);
 			
@@ -510,6 +510,8 @@ profile_selection_changed (GtkTreeSelection *selection, ProcessWindow *pwin)
 
 		set_sample (list_model, &iter, PROFILE_CALLER_SELF, caller->self, n_samples);
 		set_sample (list_model, &iter, PROFILE_CALLER_TOTAL, caller->total, n_samples);
+
+		g_free(name);
 	}
 	profile_caller_list_free (caller_list);
 
@@ -571,9 +573,9 @@ profile_fill (ProcessWindow *pwin)
 		g_assert (func);
 
 		if (func->node->symbol)
-			name = func->node->symbol;
+			name = elf_demangle(func->node->symbol);
 		else
-			name = "???";
+			name = g_strdup("???");
 		
 		gtk_list_store_set (store, &iter,
 				    PROFILE_FUNC_NAME, name,
@@ -582,6 +584,8 @@ profile_fill (ProcessWindow *pwin)
 		
 		set_sample (model, &iter, PROFILE_FUNC_SELF, func->self, n_samples);
 		set_sample (model, &iter, PROFILE_FUNC_TOTAL, func->total, n_samples);
+
+		g_free(name);
 	}
 	
 	tree_view_set_sort_ids (GTK_TREE_VIEW (pwin->profile_func_tree_view));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]