Re: [patch/rfc] Add a sentinel frame

Michal Ludvig
2003-02-18T11:21:36Z

[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]

Andrew Cagney wrote:
> Michal Ludvig wrote:
>>
>> Hi Andrew,
>> I'm getting lots of internal errors due to the fact that this function
>> is called while running x86-64 testsuite on mainline.
>>
>> +static void
>> +sentinel_frame_pop (struct frame_info *frame,
>> + void **cache,
>> + struct regcache *regcache)
>> +{
>> + internal_error (__FILE__, __LINE__, "Function sentinal_frame_pop
>> called");
>> +}
>>
>> How can I avoid these errors?
>
> Can you please post a stack backtrace and a transcript illustrating the
> problem? The above assertion is correct - for some reason GDB is trying
> to pop the wrong frame :-(

Hi again,
I got back to the mainline/"sentinel" problem and have found that it
happens when a program's function is called from a gdb prompt.

To reproduce create a very simple program:
int func(int arg) { return 2*arg; }
int main(int argc) { return func(argc); }

Then run mainline GDB on x86-64:
(gdb) break main
(gdb) run
(gdb) print func(1)
../../gdb-head/gdb/sentinel-frame.c:102: internal-error: Function
sentinal_frame_pop called
A problem internal to GDB has been detected. Further
debugging may prove unreliable.
Quit this debugging session? (y or n)

Attached is a backtrace of this failing GDB.
Any ideas?

Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz

[-- Attachment #2: gdb-head-failure.txt --]
[-- Type: text/plain, Size: 5668 bytes --]

GNU gdb 5.3.0.90_2003-02-03-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
Core was generated by `./gdb b'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib64/libncurses.so.5...done.
Loaded symbols for /lib64/libncurses.so.5
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libthread_db.so.1...done.
Loaded symbols for /lib64/libthread_db.so.1
#0 0x0000002a95a84b39 in kill () from /lib64/libc.so.6
Setting up the environment for debugging gdb.
Breakpoint 1 at 0x4e28de: file ../../gdb-head/gdb/utils.c, line 800.
Breakpoint 2 at 0x43e907: file ../../gdb-head/gdb/cli/cli-cmds.c, line 202.
(top-gdb) bt
#0 0x0000002a95a84b39 in kill () from /lib64/libc.so.6
#1 0x0000002a95a84861 in raise () from /lib64/libc.so.6
#2 0x0000002a95a85e90 in abort () from /lib64/libc.so.6
#3 0x00000000004e27ea in internal_vproblem (problem=0x7a8d40,
file=0x66e740 "../../gdb-head/gdb/sentinel-frame.c", line=102,
fmt=0x66e780 "Function sentinal_frame_pop called", ap=0x7fbfffe430)
at ../../gdb-head/gdb/utils.c:769
#4 0x00000000004e2847 in internal_verror (
file=0x66e740 "../../gdb-head/gdb/sentinel-frame.c", line=102,
fmt=0x66e780 "Function sentinal_frame_pop called", ap=0x7fbfffe430)
at ../../gdb-head/gdb/utils.c:792
#5 0x00000000004e292b in internal_error (
file=0x66e740 "../../gdb-head/gdb/sentinel-frame.c", line=102,
string=0x66e780 "Function sentinal_frame_pop called")
at ../../gdb-head/gdb/utils.c:801
#6 0x00000000005446d1 in sentinel_frame_pop (frame=0x82c100, cache=0x82c130,
regcache=0x850610) at ../../gdb-head/gdb/sentinel-frame.c:102
#7 0x00000000004e6692 in frame_pop (frame=0x82c100)
at ../../gdb-head/gdb/frame.c:164
#8 0x000000000048a3c4 in normal_stop () at ../../gdb-head/gdb/infrun.c:3113
#9 0x000000000048727c in proceed (addr=4195336, siggnal=TARGET_SIGNAL_0, step=0)
at ../../gdb-head/gdb/infrun.c:805
#10 0x0000000000484d62 in run_stack_dummy (addr=4195336, buffer=0x9b9ae0)
at ../../gdb-head/gdb/infcmd.c:1041
#11 0x0000000000465c78 in hand_function_call (function=0x9b99e0, nargs=1,
args=0x7fbfffe8e8) at ../../gdb-head/gdb/valops.c:1684
#12 0x0000000000465dcd in call_function_by_hand (function=0x9b99e0, nargs=1,
args=0x7fbfffe8e8) at ../../gdb-head/gdb/valops.c:1808
#13 0x0000000000460566 in evaluate_subexp_standard (expect_type=0x0, exp=0x9b9900,
pos=0x7fbfffec04, noside=EVAL_NORMAL) at ../../gdb-head/gdb/eval.c:940
#14 0x000000000045e1df in evaluate_subexp (expect_type=0x0, exp=0x6, pos=0xd,
noside=EVAL_NORMAL) at ../../gdb-head/gdb/eval.c:70
#15 0x000000000045e3ba in evaluate_expression (exp=0x9b9900)
at ../../gdb-head/gdb/eval.c:159
#16 0x0000000000470051 in print_command_1 (exp=0x800cd2 "func(1)", inspect=0,
voidprint=1) at ../../gdb-head/gdb/printcmd.c:907
#17 0x0000000000470198 in print_command (exp=0x800cd2 "func(1)", from_tty=1)
at ../../gdb-head/gdb/printcmd.c:951
#18 0x000000000043a2e4 in do_cfunc (c=0x811960, args=0x800cd2 "func(1)",
from_tty=1) at ../../gdb-head/gdb/cli/cli-decode.c:53
#19 0x000000000043c921 in cmd_func (cmd=0x811960, args=0x800cd2 "func(1)",
from_tty=1) at ../../gdb-head/gdb/cli/cli-decode.c:1523
#20 0x00000000004dfb5c in execute_command (p=0x800cd8 ")", from_tty=1)
at ../../gdb-head/gdb/top.c:711
#21 0x00000000004dfd34 in command_loop () at ../../gdb-head/gdb/top.c:792
#22 0x0000000000492824 in current_interp_command_loop ()
at ../../gdb-head/gdb/interps.c:279
#23 0x0000000000437dcd in captured_command_loop (data=0x0)
at ../../gdb-head/gdb/main.c:100
#24 0x00000000004df74f in do_catch_errors (uiout=0x82efb0, data=0x7fbfffefd0)
at ../../gdb-head/gdb/top.c:492
#25 0x00000000004df5ae in catcher (func=0x4df726 <do_catch_errors>,
func_uiout=0x82efb0, func_args=0x7fbfffefd0, func_val=0x7fbfffeff0,
func_caught=0x7fbfffefec, errstring=0x60e62d "", mask=6)
at ../../gdb-head/gdb/top.c:424
#26 0x00000000004df7a0 in catch_errors (func=0x437dbc <captured_command_loop>,
func_args=0x0, errstring=0x60e62d "", mask=6) at ../../gdb-head/gdb/top.c:504
#27 0x0000000000438b20 in captured_main (data=0x7fbffff490)
at ../../gdb-head/gdb/main.c:797
#28 0x00000000004df74f in do_catch_errors (uiout=0x7a3860, data=0x7fbffff420)
at ../../gdb-head/gdb/top.c:492
#29 0x00000000004df5ae in catcher (func=0x4df726 <do_catch_errors>,
func_uiout=0x7a3860, func_args=0x7fbffff420, func_val=0x7fbffff440,
func_caught=0x7fbffff43c, errstring=0x60e62d "", mask=6)
at ../../gdb-head/gdb/top.c:424
#30 0x00000000004df7a0 in catch_errors (func=0x437dfc <captured_main>,
func_args=0x7fbffff490, errstring=0x60e62d "", mask=6)
at ../../gdb-head/gdb/top.c:504
#31 0x0000000000438b53 in gdb_main (args=0x7fbffff490)
at ../../gdb-head/gdb/main.c:806
#32 0x0000000000437db8 in main (argc=2, argv=0x7fbffff528)
at ../../gdb-head/gdb/gdb.c:33
#33 0x0000002a95a74035 in __libc_start_main () from /lib64/libc.so.6
#34 0x0000000000437cda in _start ()
(top-gdb)