This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: print_ubacktrace() and ppc 32


Hi,

[..]

On 08/09/2013 05:20 PM, Lukas Berk wrote:
> 
> Ouch, would you mind running a simple hello world style probe? Along the
> lines of 'probe process.function("main") {log("Hello")}' and seeing if
> that runs properly?
> 

sorry there was something wrong in my last setup and I was unable to reproduce
this crash. Therefore I decided to rebuild a setup which is 100% reproducible.
My previous test was made with our internal kernel branch which has some changes
to the mainline kernel.

So I took kernel 3.10.0. Compared to the original kernel I only added the needed
config options to mgcoge_defconfig for uprobe support (relay, kprobes, module
support...).

I recompiled the systemtap host binaries with the latest snapshot:
systemtap-20130810.tar.bz2

I did three changes compared to the original code to get the test for the
powerpc backtrace support compilable:

diff --git a/share/systemtap/runtime/linux/runtime.h
b/share/systemtap/runtime/linux/runtime.h
--- a/share/systemtap/runtime/linux/runtime.h
+++ b/share/systemtap/runtime/linux/runtime.h
@@ -134,7 +134,7 @@ static struct
    Only define STP_USE_DWARF_UNWINDER when STP_NEED_UNWIND_DATA,
    as set through a pragma:unwind in one of the [u]context-unwind.stp
    functions. */
-#if (defined(__arm__) || defined(__i386__) || defined(__x86_64__) ||
defined(__powerpc64__)) || defined (__s390x__)
+#if (defined(__arm__) || defined(__i386__) || defined(__x86_64__) ||
defined(__powerpc64__)) || defined (__s390x__) || (__powerpc__)
 #ifdef STP_NEED_UNWIND_DATA
 #ifndef STP_USE_DWARF_UNWINDER
 #define STP_USE_DWARF_UNWINDER
diff --git a/share/systemtap/runtime/unwind/ppc64.h
b/share/systemtap/runtime/unwind/ppc64.h
--- a/share/systemtap/runtime/unwind/ppc64.h
+++ b/share/systemtap/runtime/unwind/ppc64.h
@@ -54,7 +54,7 @@
        PTREGS_INFO(gpr[29]), \
        PTREGS_INFO(gpr[30]), \
        PTREGS_INFO(gpr[31]), \
-       PTREGS_INFO(softe), \
+       PTREGS_INFO(mq), \
        PTREGS_INFO(ctr), \
        PTREGS_INFO(link), \
        PTREGS_INFO(nip)
diff --git a/share/systemtap/runtime/unwind/unwind.h
b/share/systemtap/runtime/unwind/unwind.h
--- a/share/systemtap/runtime/unwind/unwind.h
+++ b/share/systemtap/runtime/unwind/unwind.h
@@ -25,6 +25,8 @@ struct unwind_frame_info
 #include "i386.h"
 #elif defined (__powerpc64__)
 #include "ppc64.h"
+#elif defined (__powerpc__)
+#include "ppc64.h"
 #elif defined (__s390x__)
 #include "s390x.h"
 #elif defined (__arm__)

A simple hello_world works fine. Then I compiled my stapprobe with ubacktrace:
systemtap-2.4-32473/bin/stap -DDEBUG_UNWIND=99 -g -a powerpc -B
CROSS_COMPILE=powerpc- script.stp

and let it run on the target. The output is:

WARNING: unwind Bad num=67108864 end-ptr=32 2*tableSize=8
_stp_stack_unwind_one_user:460: STARTING user unwind
 0x10000448 : foo+0x1c/0x7c [/usr/local/bin/main]
_stp_stack_unwind_one_user:476: CONTINUING user unwind to depth 1
unwind:1612: pc=10000448, 10000448
unwind:1652: trying debug_frame
set_no_state_rule:398: reg=23, where=1
_stp_search_unwind_hdr:915: binary search for 10000448
unwind_frame:1331: /usr/local/bin/main: fde=0
unwind_frame:1399: cie=0 fde=0 startLoc=0 endLoc=0, pc=10000448
unwind:1656: debug_frame failed: -5, trying eh_frame
set_no_state_rule:398: reg=23, where=1
_stp_search_unwind_hdr:915: binary search for 10000448
adjustStartLoc:866: adjustStartLoc=100002e0, ptrType=DW_EH_PE_datarel_sdata4,
m=/usr/local/bin/main, s=.absolute eh=1
adjustStartLoc:874: eh_frame=ca54fd50, eh_frame_addr=10000668
adjustStartLoc:866: adjustStartLoc=100002e0, ptrType=DW_EH_PE_datarel_sdata4,
m=/usr/local/bin/main, s=.absolute eh=1
adjustStartLoc:874: eh_frame=ca54fd50, eh_frame_addr=10000668
_stp_search_unwind_hdr:980: fde off=1000067c
_stp_search_unwind_hdr:990: returning fde=ca54fd64 startLoc=100002e0
unwind_frame:1331: /usr/local/bin/main: fde=ca54fd64
unwind_frame:1336: /usr/local/bin/main: cie=ca54fd50
parse_fde_cie:291: codeAlign=4, dataAlign=fffffffc
parse_fde_cie:305: map retAddrReg value 65 to reg_info idx 34
parse_fde_cie:369: startLoc: ca54f9c8, locrange: 24
adjustStartLoc:866: adjustStartLoc=ca54f9c8, ptrType=DW_EH_PE_pcrel_sdata4,
m=/usr/local/bin/main, s=.absolute eh=1
adjustStartLoc:874: eh_frame=ca54fd50, eh_frame_addr=10000668
unwind_frame:1351: startLoc: 100002e0, endLoc: 10000304
unwind_frame:1353: pc (10000448) > endLoc(10000304)
unwind:1664: unwinding failed: 1

Best regards
Holger


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]