[Bug python/11914] Multiple call to inferior function can leed to segfault

jan.kratochvil at redhat dot com sourceware-bugzilla@sourceware.org
Tue Jul 19 18:39:00 GMT 2011


http://sourceware.org/bugzilla/show_bug.cgi?id=11914

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|ia64                        |
               Host|ia64                        |
            Version|7.2                         |HEAD
   Target Milestone|7.1                         |---

--- Comment #5 from Jan Kratochvil <jan.kratochvil at redhat dot com> 2011-07-19 18:38:04 UTC ---
Reproducible for me on Fedora 15 x86_64, it crashes, used:
./gdb -nx ./pptest -ex 'source pptest.py' -ex 'b 26' -ex r -ex 'source
loop.cmd'
loop.cmd:
while 1
  info locals
end

The problem is during the pretty printer an inferior call is made.  Any
inferior call invalidates frame cache, any frame_info * gets invalid.  frame_id
would remain valid.  The variables printing functions do not expect frame_info
* gets invalid.

Suggesting either modifying the GDB functions involved to use frame_id instead
of frame_info * or somehow pre-pretty-print the variables in advance.

@@ -1,51 +1,42 @@
+Invalid read of size 8
+   at get_frame_pc (frame.c:1956)
+   by get_frame_address_in_block (frame.c:1988)
+   by get_frame_address_in_block_if_available (frame.c:2050)
+   by get_frame_block (blockframe.c:65)
+   by dwarf_expr_frame_base (dwarf2loc.c:180)
+   by execute_stack_op (dwarf2expr.c:791)
+   by dwarf_expr_eval (dwarf2expr.c:365)
+   by dwarf2_evaluate_loc_desc_full (dwarf2loc.c:1128)
+   by dwarf2_evaluate_loc_desc (dwarf2loc.c:1280)
+   by locexpr_read_variable (dwarf2loc.c:2171)
+   by read_var_value (findvar.c:555)
+   by print_variable_and_value (printcmd.c:1960)

- Address 0xe3ecdb0 is 352 bytes inside a block of size 4,064 free'd
-   at free (vg_replace_malloc.c:366)
-   by xfree (utils.c:1303)
-   by obstack_free (obstack.c:367)
-   by reinit_frame_cache (frame.c:1519)
-   by regcache_write_pc (regcache.c:1020)
-   by proceed (infrun.c:2107)
-   by run_inferior_call (infcall.c:404)
-   by call_function_by_hand (infcall.c:835)
-   by evaluate_subexp_standard (eval.c:1847)
-   by evaluate_subexp_c (c-lang.c:720)
-   by evaluate_subexp (eval.c:76)
-   by evaluate_expression (eval.c:151)
-   by parse_and_eval (eval.c:119)
-   by gdbpy_parse_and_eval (python.c:546)
-   by PyEval_EvalFrameEx (ceval.c:4072)
-   by PyEval_EvalCodeEx (ceval.c:3312)
-   by function_call (funcobject.c:526)
-   by PyObject_Call (abstract.c:2529)
-   by instancemethod_call (classobject.c:2578)
-   by PyObject_Call (abstract.c:2529)
-   by PyObject_CallMethodObjArgs (abstract.c:2738)
-   by pretty_print_one_value (py-prettyprint.c:223)
-   by print_string_repr (py-prettyprint.c:315)
-   by apply_val_pretty_printer (py-prettyprint.c:730)
-   by val_print (valprint.c:374)
-   by common_val_print (valprint.c:454)
-   by print_variable_and_value (printcmd.c:1962)

    by do_print_variable_and_value (stack.c:1620)
    by iterate_over_block_locals (stack.c:1520)
    by iterate_over_block_local_vars (stack.c:1590)
    by print_frame_local_vars (stack.c:1652)
    by locals_info (stack.c:1739)
    by do_cfunc (cli-decode.c:67)
    by cmd_func (cli-decode.c:1777)
    by execute_command (top.c:438)
    by execute_control_command (cli-script.c:420)
    by execute_control_command (cli-script.c:480)
    by execute_control_command_untraced (cli-script.c:590)
    by while_command (cli-script.c:608)
    by do_cfunc (cli-decode.c:67)
    by cmd_func (cli-decode.c:1777)
    by execute_command (top.c:438)
    by command_loop (top.c:555)
    by read_command_file (top.c:327)
    by script_from_file (cli-script.c:1619)
    by source_script_from_stream (cli-cmds.c:559)
    by source_script_with_search (cli-cmds.c:590)
    by source_command (cli-cmds.c:665)
    by do_cfunc (cli-decode.c:67)
    by cmd_func (cli-decode.c:1777)

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Gdb-prs mailing list