From 11a2999d10a017770c173e899fe16b50a079d8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 30 May 2005 12:22:34 +0000 Subject: [PATCH] Now also prints the area offsets next to the instruction pointer so you don't have to enable debug output in the runtime linker and still have to compute the offsets manually. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12900 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/debug/DebugServer.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/servers/debug/DebugServer.cpp b/src/servers/debug/DebugServer.cpp index 3fc4904f9e..231dc96965 100644 --- a/src/servers/debug/DebugServer.cpp +++ b/src/servers/debug/DebugServer.cpp @@ -238,8 +238,27 @@ ThreadDebugHandler::HandleMessage(DebugMessage *message) if (error < B_OK || stackFrameInfo.parent_frame == NULL) break; - printf(" (%p) %p\n", stackFrameInfo.frame, + // find area containing the IP + team_id team = fTeamHandler->Team(); + bool useAreaInfo = false; + area_info info; + int32 cookie = 0; + while (get_next_area_info(team, &cookie, &info) == B_OK) { + if ((addr_t)info.address <= (addr_t)stackFrameInfo.return_address + && (addr_t)info.address + info.size > (addr_t)stackFrameInfo.return_address) { + useAreaInfo = true; + break; + } + } + + printf(" (%p) %p", stackFrameInfo.frame, stackFrameInfo.return_address); + if (useAreaInfo) { + printf(" (%s + %#lx)\n", info.name, + (addr_t)stackFrameInfo.return_address - (addr_t)info.address); + } else + putchar('\n'); + stackFrameAddress = stackFrameInfo.parent_frame; } }