summaryrefslogtreecommitdiffstats
path: root/debuggerd
diff options
context:
space:
mode:
authorPavel Chupin <pavel.v.chupin@intel.com>2013-03-08 13:17:35 +0400
committerPavel Chupin <pavel.v.chupin@intel.com>2013-03-14 19:11:44 +0400
commitaf2cb3667ba24d1ef3037aa5a7b3bc0a238cf040 (patch)
tree6c349c35055ef642657cb39f6e3938fc6b4631ab /debuggerd
parent3960ec226d07c7327ac6967a2977c521fd4884b6 (diff)
downloadsystem_core-af2cb3667ba24d1ef3037aa5a7b3bc0a238cf040.zip
system_core-af2cb3667ba24d1ef3037aa5a7b3bc0a238cf040.tar.gz
system_core-af2cb3667ba24d1ef3037aa5a7b3bc0a238cf040.tar.bz2
Unwinding implementation via eh_frame sections for x86
Backtracing through eh_frame section is more effective allowing to reuse ebp register for other purposes within routine. GCC with turned on optimizations (-O1 and above) implicitly defines -fomit-frame-pointer anyway. eh_frame sections are generated by default with GCC on any optimization level. This change implements remote unwinding (separate process unwinding). Local unwinding is already implemented through _Unwind_Backtrace call which is implemented in libgcc. Change-Id: I1aea1ecd19c21710f9cf5f05dc272fc51b67b7aa Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Diffstat (limited to 'debuggerd')
-rw-r--r--debuggerd/crasher.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/debuggerd/crasher.c b/debuggerd/crasher.c
index 134fe80..630d980 100644
--- a/debuggerd/crasher.c
+++ b/debuggerd/crasher.c
@@ -101,6 +101,21 @@ int do_action_on_thread(const char* arg)
return (int) result;
}
+__attribute__((noinline)) int crash3(int a) {
+ *((int*) 0xdead) = a;
+ return a*4;
+}
+
+__attribute__((noinline)) int crash2(int a) {
+ a = crash3(a) + 2;
+ return a*3;
+}
+
+__attribute__((noinline)) int crash(int a) {
+ a = crash2(a) + 1;
+ return a*2;
+}
+
int do_action(const char* arg)
{
if(!strncmp(arg, "thread-", strlen("thread-"))) {
@@ -111,6 +126,7 @@ int do_action(const char* arg)
if(!strcmp(arg,"nostack")) crashnostack();
if(!strcmp(arg,"ctest")) return ctest();
if(!strcmp(arg,"exit")) exit(1);
+ if(!strcmp(arg,"crash")) return crash(42);
if(!strcmp(arg,"abort")) maybeabort();
pthread_t thr;