[RFC] Support command "catch syscall" properly on different targets

Pedro Alves palves@redhat.com
Tue Mar 3 12:14:00 GMT 2015


On 03/03/2015 11:55 AM, Yao Qi wrote:
> Doug Evans <dje@google.com> writes:
> 
>> 1) Do we have a story yet for how to handle differences across
>> multiple targets/inferiors?
> 
> I don't have such story in my mind.  Taking a look at
> https://sourceware.org/gdb/wiki/MultiTarget and I don't see anything on
> handling differences across multiple targets.

Pasting from:

https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A related question is how to handle syscalls by name ("catch syscall open"):

#1 - when the user kills the program, and then starts another one, of a different architecture, in the same inferior.  E.g.,

  - file prog64
  - start
  - catch syscall open
  - kill
  - file prog32
  - run

#2 - similarly, when a 64-bit inferior execs a 32-bit inferior.

  - file prog64
  - start
  - catch syscall open (2 on 64-bit)
  - continue
  - inferior execs prog32
  - inferior now calls syscall 2, which is something else on i386.

These two cases may end up handled by the breakpoint_re_set machinery.

#3 - in the presence of multiple inferiors, each with its own arch.

  - file prog64
  - start
  - add-inferior -exec prog32
  - inferior 2
  - start
  - catch syscall open
  - set schedule-multiple on
  - c
  - both inferiors call "open"

Here, I don't think we'll catch inferior 1's.

syscall catchpoints is presently inferior-specific; while I think it
should end up with a location per inferior instead, and "open" should be
parsed in each inferior's/location's arch.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> 
>> E.g., while not completely supported today, what if I'm
>> debugging two targets and one supports "catch syscall"
>> and one doesn't? "break" applies across all inferiors
>> (though I really don't like this as a default behaviour),
>> and it would be odd if "catch" didn't work similarly
>> by default.
> 
> When GDB goes to multi-target, syscall catchpoint should be skipped for
> targets don't support it, IMO.

Agreed.

>> "catch syscall" is target(arch)-specific.
>> Multi-arch doesn't work today (except for special cases),
>> but we should understand how we want it to work tomorrow.
>> And similarly for all such target-specific commands.
> 
> Oh, multi-arch is supported, isn't?  done by these two patch sets in
> both GDB and GDBserver side respectively,
> 
>   https://sourceware.org/ml/gdb-patches/2012-11/msg00228.html
>   https://sourceware.org/ml/gdb-patches/2013-05/msg01057.html

Yeah.

> In the future, IMHO, each command has a scope, a term from itset
> patches, and the command is applied to the given scope.  The scope
> is a set of targets, inferiors and threads.  If "catch syscall" command
> is applied to a scope in which one target doesn't support it, GDB can
> report an error like "Target foo in scope bar doesn't support
> 'catch syscall'".
> 

*nod*

FYI, I'm getting very close to posting the all-stop-on-top-of-non-stop
patch.  The remaining dependency (that I had identified) was the
moribund locations rework posted recently.  Itsets will follow.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list