This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/11914] New: Multiple call to inferior function can leed to segfault
- From: "joachim dot protze at zih dot tu-dresden dot de" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 13 Aug 2010 22:34:06 -0000
- Subject: [Bug python/11914] New: Multiple call to inferior function can leed to segfault
- Reply-to: sourceware-bugzilla at sourceware dot org
To reproduce my failure (see bt) just run the code below, set breakpoint to
return of main, load the python-script and "info local" till segfault. Tested
this with 7.1, 7.2 on x86_64 and ia64.
In my application, i get this segfault for the first "info local" in some cases.
----------------- bt -----------------
#0 0x40000000000b8a90 in frame_unwind_arch (next_frame=0x0) at frame.c:2061
#1 0x40000000000b8a20 in get_frame_arch (this_frame=0x600000000010c830) at
frame.c:2055
#2 0x400000000057c1a0 in dwarf_expr_read_reg (baton=0x607ffffffff4dd78,
dwarf_regnum=12) at dwarf2loc.c:140
#3 0x4000000000757e80 in execute_stack_op (ctx=0x6000000000417920,
op_ptr=0x60000000001f2ae9 "", op_end=0x60000000001f2ae9 "") at dwarf2expr.c:572
#4 0x40000000007567c0 in dwarf_expr_eval (ctx=0x6000000000417920,
addr=0x60000000001f2ae6 "\222\f ", len=3) at dwarf2expr.c:251
#5 0x4000000000580f20 in dwarf2_evaluate_loc_desc (type=0x6000000000217640,
frame=0x600000000010c830, data=0x60000000001f2ae6 "\222\f ", size=3,
per_cu=0x60000000001f2c90) at dwarf2loc.c:920
#6 0x40000000005865e0 in locexpr_read_variable (symbol=0x60000000002175d0,
frame=0x600000000010c830) at dwarf2loc.c:1882
#7 0x40000000002ed500 in read_var_value (var=0x60000000002175d0,
frame=0x600000000010c830) at findvar.c:542
#8 0x400000000036f0b0 in print_variable_and_value (name=0x60000000001f2adf "k",
var=0x60000000002175d0, frame=0x600000000010c830, stream=0x600000000019f9a0,
indent=0)
at ./printcmd.c:1956
#9 0x4000000000414a30 in do_print_variable_and_value
(print_name=0x60000000001f2adf "k", sym=0x60000000002175d0,
cb_data=0x607ffffffff4e008) at stack.c:1587
#10 0x4000000000414790 in iterate_over_block_locals (b=0x60000000002177e0,
cb=@0x4000000000c95470: 0x4000000000414950 <do_print_variable_and_value>,
cb_data=0x607ffffffff4e008) at stack.c:1487
#11 0x40000000004148a0 in iterate_over_block_local_vars
(block=0x60000000002177e0, cb=@0x4000000000c95470: 0x4000000000414950
<do_print_variable_and_value>,
cb_data=0x607ffffffff4e008) at stack.c:1557
#12 0x4000000000414bd0 in print_frame_local_vars (frame=0x600000000010c830,
num_tabs=0, stream=0x600000000019f9a0) at stack.c:1611
#13 0x4000000000414dc0 in locals_info (args=0x0, from_tty=1) at stack.c:1698
#14 0x40000000001c5a10 in do_cfunc (c=0x60000000000fa760, args=0x0, from_tty=1)
at ./cli/cli-decode.c:67
#15 0x40000000001cf470 in cmd_func (cmd=0x60000000000fa760, args=0x0,
from_tty=1) at ./cli/cli-decode.c:1771
#16 0x400000000008fc00 in execute_command (p=0x60000000000adb1c "", from_tty=1)
at top.c:422
#17 0x400000000043df10 in command_handler (command=0x60000000000adb10 "info
locals ") at event-top.c:498
#18 0x400000000043ee30 in command_line_handler (rl=0x6000000000418c20 "\001") at
event-top.c:662
#19 0x40000000007ad910 in rl_callback_read_char () at callback.c:205
#20 0x400000000043beb0 in rl_callback_read_char_wrapper (client_data=0x0) at
event-top.c:178
#21 0x400000000043db20 in stdin_event_handler (error=0, client_data=0x0) at
event-top.c:433
#22 0x4000000000438c90 in handle_file_event (data={ptr = 0x6000000000000000,
integer = 0}) at event-loop.c:817
#23 0x40000000004367b0 in process_event () at event-loop.c:399
#24 0x4000000000436a70 in gdb_do_one_event (data=0x0) at event-loop.c:452
#25 0x4000000000423080 in catch_errors (func=0x200000000056d1f0, func_args=0x0,
errstring=0x4000000000bc2218 "", mask=6) at exceptions.c:518
#26 0x4000000000215f00 in tui_command_loop (data=0x0) at ./tui/tui-interp.c:171
#27 0x4000000000424bf0 in current_interp_command_loop () at interps.c:291
#28 0x400000000006cfd0 in captured_command_loop (data=0x0) at ./main.c:227
#29 0x4000000000423080 in catch_errors (func=@0x4000000000c95070:
0x400000000006cfa0 <captured_command_loop>, func_args=0x0,
errstring=0x4000000000ba15f0 "", mask=6)
at exceptions.c:518
#30 0x40000000000700f0 in captured_main (data=0x607ffffffff4e460) at ./main.c:910
#31 0x4000000000423080 in catch_errors (func=@0x4000000000c9bd50:
0x400000000006d080 <captured_main>, func_args=0x607ffffffff4e460,
errstring=0x4000000000ba15f0 "",
mask=6) at exceptions.c:518
#32 0x4000000000070170 in gdb_main (args=0x607ffffffff4e460) at ./main.c:919
#33 0x400000000006c700 in main (argc=2, argv=0x607ffffffff4e728) at gdb.c:34
----------------- pptest.c -----------------
enum test_enum{
zero,
one,
two,
three,
four,
five,
};
typedef int testint;
enum test_enum get_test_enum(int i){
return (enum test_enum)i;
}
int main(int argc, char* argv[]){
testint a, b, c, d, e, f;
testint arr[]={0,1,2,3,4,5};
a=0;
b=1;
c=2;
d=3;
e=4;
f=5;
return 0;
}
----------------- pptest.py -----------------
import gdb
import re
class pp_test:
"""testprinter with code interaction"""
def __init__(self, id):
self.id = id
def to_string(self):
return str(gdb.parse_and_eval("get_test_enum(%i)" % self.id))
def lookup_function (val):
'''Look-up and return a pretty-printer that can print val.'''
type = val.type;
# If it points to a reference, get the reference.
if type.code == gdb.TYPE_CODE_REF:
type = type.target ()
typename = str(type)
for function in pp_dict:
if function.search (typename):
result = pp_dict[function] (val)
return result
return None
pp_dict = {}
pp_dict[re.compile('^testint$')] = lambda val: pp_test(val)
gdb.pretty_printers = []
gdb.pretty_printers.append (lookup_function)
--
Summary: Multiple call to inferior function can leed to segfault
Product: gdb
Version: 7.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: python
AssignedTo: unassigned at sourceware dot org
ReportedBy: joachim dot protze at zih dot tu-dresden dot de
CC: gdb-prs at sourceware dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=11914
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.