[memprof: 28/76] profile.c: Implement a workaround were process_locate_symbol fails



commit 206bb06485625cf71118b8b4540beeac8244ec17
Author: Holger Hans Peter Freyther <zecke selfish org>
Date:   Thu Jun 4 14:20:32 2009 +0200

    profile.c: Implement a workaround were process_locate_symbol fails
    
    When process_locate_symbol fails we get a NULL and will
    crash when trying to hash that value. Add a workaround to
    not crash on null symbols here.
    
    The theory is that the area/address got unmapped (e.g. due
    a dlopen).

 src/profile.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/profile.c b/src/profile.c
index 73d713b..8b5b80c 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -58,7 +58,19 @@ profile_add_stack_trace (Profile *profile, GList *stack, guint size)
 	const char *symbol =
 	    process_locate_symbol (profile->process, GPOINTER_TO_SIZE(element->address));
 	int i;
-	
+
+        /*
+         * Workaround for the case that an allocation was made and the
+         * mapped library is gone now. This is happening with Gtk+/Epiphany/WebKit.
+         * One way would be to override dlclose and resolve all symbols within
+         * this address space. FIXME.
+         */
+	if (!symbol) {
+		g_warning ("Symbol at address: %p is null\n", element->address);
+		parent = NULL;
+		continue;
+	}
+
 	for (i = 0; i < roots->len; ++i)
 	{
 	    ProfileNode *node = roots->pdata[i];



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