This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/3] gdb/python: raise TypeError instead of abort on calling value method for label symbol object
- From: Maxim Bublis <satori at yandex-team dot ru>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 16 Apr 2014 21:20:46 +0400
- Subject: Re: [PATCH v2 2/3] gdb/python: raise TypeError instead of abort on calling value method for label symbol object
- Authentication-results: sourceware.org; auth=none
- Authentication-results: smtpcorp4.mail.yandex.net; dkim=pass header dot i= at yandex-team dot ru
- References: <1394026864-4691-1-git-send-email-satori at yandex-team dot ru> <1394026864-4691-2-git-send-email-satori at yandex-team dot ru> <534B9118 dot 9010307 at redhat dot com>
Hi, Phil.
> I am really curious about the sigabort you were seeing. Without it I
> cannot tell if there is a deeper problem in GDB, which this patch
> would be papering over. Can you provide the backtrace?
For example, we have the following code:
#include <stdlib.h>
int main() {
abort();
some_label:
return 0;
}
I’m inspecting coredump, generated by executable compiled from code above, using Python API in *batch* mode:
$ gdb/bin/gdb a.out a.out.19605.6 --batch --eval-command="python print list(gdb.selected_frame().older().older().block())[0].value(gdb.selected_frame().older().older())"
[New LWP 19605]
Core was generated by `./a.out'.
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f4a28ee7425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
findvar.c:248: internal-error: store_typed_address: type is not a pointer or reference
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) [answered Y; input not from terminal]
findvar.c:248: internal-error: store_typed_address: type is not a pointer or reference
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) [answered Y; input not from terminal]
Aborted (core dumped)
So, it doesn’t look like some deeper problem in GDB for me, just incompleteness of Python API.
There is very similar “if” condition for LOC_TYPEDEF in patched code.
Sure, here is backtrace from GDB coredump:
(gdb) bt
#0 0x00007fba00d56425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fba00d59b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x000000000066f476 in dump_core () at utils.c:612
#3 0x00000000006717e9 in internal_vproblem (problem=0xbb2890 <internal_error_problem>, file=<optimized out>, line=248, fmt=<optimized out>, ap=0x7fff15a33d18) at utils.c:781
#4 0x00000000006719e9 in internal_verror (file=<optimized out>, line=<optimized out>, fmt=<optimized out>, ap=<optimized out>) at utils.c:797
#5 0x0000000000671a92 in internal_error (file=<optimized out>, line=<optimized out>, string=<optimized out>) at utils.c:807
#6 0x000000000054521b in store_typed_address (buf=<optimized out>, type=<optimized out>, addr=<optimized out>) at findvar.c:248
#7 store_typed_address (buf=0x1b15ad0 "", type=0x1abf680, addr=0) at findvar.c:244
#8 0x0000000000546090 in default_read_var_value (var=<optimized out>, frame=<optimized out>) at findvar.c:466
#9 0x00000000004ff939 in sympy_value (self=0x1b52fb0, args=<optimized out>) at ./python/py-symbol.c:277
#10 0x00007fba013a65d5 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#11 0x00007fba013666b5 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#12 0x00007fba013669e2 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.1.0
#13 0x00007fba01366a7c in PyRun_StringFlags () from /usr/lib/libpython2.7.so.1.0
#14 0x00007fba013676cb in PyRun_SimpleStringFlags () from /usr/lib/libpython2.7.so.1.0
#15 0x00000000004efefa in python_command (arg=<optimized out>, from_tty=<optimized out>) at ./python/python.c:477
#16 0x000000000066d58c in execute_command (p=<optimized out>, from_tty=0) at top.c:460
#17 0x00000000005a640f in catch_command_errors (command=0x66d330 <execute_command>,
arg=0x7fff15a3480a "python print list(gdb.selected_frame().older().older().block())[0].value(gdb.selected_frame().older().older())", from_tty=0, mask=<optimized out>) at exceptions.c:551
#18 0x00000000005a9292 in captured_main (data=<optimized out>) at main.c:1030
#19 0x00000000005a634b in catch_errors (func=0x5a8c80 <captured_main>, func_args=0x7fff15a34390, errstring=0x77f7f6 "", mask=RETURN_MASK_ALL) at exceptions.c:524
#20 0x00000000005a9bbb in gdb_main (args=<optimized out>) at main.c:1062
#21 0x000000000045cc25 in main (argc=<optimized out>, argv=<optimized out>) at gdb.c:33