stepping problem with sh4, gdbserver

"peter garrone" <[email protected]>
Newsgroups gmane.comp.gdb.general
Message-ID <[email protected]>
Hi,
 While debugging remotely with gdbserver and stepping the gdb (6.3) test program "break.c" at line 96, the "next" command causes a segfault at frame.c line 1244 (frame->next != NULL) because frame is null. The relevant backtrace is:

get_frame_pc(frame = 0)  frame.c:1244
insert_step_resume_breakpoint_at_frame(return_frame=0) infrun.c:2670
handle_inferior_event infrun.c:2449
wait_for_inferior infrun.c:991

Tracing the execution of gdb itself, handle_inferior_event is invoked one instruction before and then at the point of calling the function marker1, according to the value of stop_pc at infrun.c:1547. This second invocation of handle_inferior_event inserts a breakpoint at the return point (stop_pc + 4) and returns. Then handle_inferior_event is invoked again, this time stop_pc is set to the address of the very first instruction of the marker1 function. The test at infrun.c:2285 if(frame_id_eq(.....)) returns true and the block following  is taken.
Execution proceeds to line 2449 "insert_step_resume_breakpoint_at_frame(get_prev_frame(get_current_frame())" where the error occurs.

I dont understand why gdb would set a breakpoint in marker1 when it is stepping over the function. At the first instruction of marker1, the stack would still be unchanged from its value in the top function, since the sh4 does not change the stack when it calls a subroutine, so perhaps this has something to do with it.

I am using gdb 6.3, but have seen a similar error on previous versions. Configuration is for sh4-xxx-linux-gnu, gdb_target=linux, --enable-shared, --enable-threads
The only relevant source change is an include in gdbserver/linux-sh-low.c where #include <sys/reg.h> is commented out.

Any help appreciated.
Peter Garrone
-- 
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org 
This allows you to send and receive SMS through your mailbox.


Powered by Outblaze
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.