This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: WG: Extending RSP with vCont;n and vCont;f
- From: Yao Qi <yao at codesourcery dot com>
- To: ILG.Robert <R dot ILG at bachmann dot info>
- Cc: "palves at redhat dot com" <palves at redhat dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 23 Oct 2013 16:14:17 +0800
- Subject: Re: WG: Extending RSP with vCont;n and vCont;f
- Authentication-results: sourceware.org; auth=none
- References: <7E3A266F5548C442BC08FA3038B5197C684495C0 at ATFKEX06 dot bachmann dot at> <525117AF dot 60703 at codesourcery dot com> <7E3A266F5548C442BC08FA3038B5197C68449C77 at ATFKEX06 dot bachmann dot at>
Sorry for the delayed reply.
On 10/09/2013 07:37 PM, ILG.Robert wrote:
I havenât been able to trace back the exact problem. If the target denies to insert a breakpoint for "finish", GDB will crash later while debugging because it suddenly uses rotten addresses. If GDB is not informed about the problem of setting such a breakpoints, you can continue debugging without any problem. It looks like as GDB contains an incomplete error handling.
I hacked GDB a little to force GDB setting momentary breakpoint on
address 0x0 when command 'finish' is typed. Then, I get:
(gdb) finish
Run till exit from #0 break_me () at
../../../../git/gdb/testsuite/gdb.base/frame-args.c:35
Warning:
Cannot insert breakpoint 0.
Cannot access memory at address 0x0
0x080483c8 in break_me () at
../../../../git/gdb/testsuite/gdb.base/frame-args.c:35
35 }
Looks GDB handles this error well. Can you see this warning in your target?
>>Looks your motivation is for functional purpose, range stepping is not suitable to you. Your generalization doesn't look
>>reasonable to me.
>>We can have a look at supported actions of vCont, 'c,C,s,S,t,r'. They are quite low-level and primitive. However, in
>>your proposal, vCont;n and vCont;f are about "step to a new line" and "step out of this function", why are quite high-
>>level to me.
Indeed "Next" can be replaced by "range-stepping". It seems that this might work for us.
All the same "finish" is needed in order to handle the GDB "finish" correctly. Remember that our target cannot insert breakpoints to system code, like other targets cannot alter read-only memory. So if you trigger the system to call a call-back function of your code, you cannot step back. The Stack would look like this: MyCode1-->SystemCode2-->...-->Systemcode4-->MyCode5. As you cannot insert a breakpoint to SystemCode4 there is no way to "finish" until MyCode1. In such a case GDB or the target need to realize that the code in between cannot be controlled with breakpoints and therefore the breakpoint needs to be set to the return address of MyCode1 - skipping all code in between. GDB does not skip unknown code at the moment, so the question is whether skipping unknown Code has to be done by GDB or by the target (remote by using "finish").
In your example, if breakpoint can't be set on SystemCode4, I'd like to
emit an error instead of setting breakpoint on the return address to
MyCode1. Otherwise, the meaning of "finish" command is changed.
By the way these RSP commands are not as high level as you think they are. "Next" does not skip a whole line. It only skips a possible function call. Such no DWARF2 information is needed - only the stack and the a few assembler instructions need to be evaluated.
So the real questions are:
Here are my answers, and other people may have their answers too.
Is it intended to skip unknown/read-only code in GDB?
IMO, it is not right to skip unknown/read-only code for command "finish".
If yes, has it to be solved within GDB or within the target?
Generally, hardware breakpoints can be used for read-only regions. If
your hardware has hw breakpoints, GDB or your stub can switch breakpoint
to hw breakpoint if the region is read-only or the address is within
your system code. Looks it is easier to do it inside your stub. People
who familiar with breakpoint can give comments too.
--
Yao (éå)