This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Mixing syscalls and breakpoints at the command line


Hi,

The following thread on gdb-patches is interesting:
http://thread.gmane.org/gmane.comp.gdb.patches/34421
It shows a way for mixing syscalls and breakpoints as if they were the
same kind of thing on the command line. Maybe something we should also
support in the fhpd.

And I think we can do better with the argument printing than in the
example below and of course with a way to select a specific syscall,
preferably by name since we already have that info [1]. I don't know
whether or not the hpd spec has anything to say about intercepting
syscalls. I couldn't find anything in a quick scan.

Cheers,

Mark

[1] From the first email in that thread:

        gdb) catch syscall
        Catchpoint 1 (syscall)
        (gdb) r
        (no debugging symbols found)
        
        # we've stopped at entry to the first syscall.
        Catchpoint 1 (syscall), 0x1000008c in _start ()
        # on linuxppc where I'm testing, register r0 holds the syscall number
        (gdb) p $r0
        # 4 is __NR_write
        $1 = 4
        # The arguments to the syscall are in registers r3, r4, r5, etc.
        (gdb) p $r3
        # writing to fd 1, stdout
        $2 = 1
        (gdb) x/s $r4
        0x10000098:      "hello world\n"
        (gdb) p $r5
        # strlen("hello world\n") is 12
        $3 = 12
        # Continuing from here allows the syscall to complete, then stops again
        (gdb) c
        hello world
        
        # Notice the PC didn't change, we're still at 0x1000008c
        Catchpoint 1 (syscall), 0x1000008c in _start ()
        # Now continue again, until the next syscall
        (gdb) c
        
        Catchpoint 1 (syscall), 0x10000098 in ?? ()
        (gdb) p $r0
        # 1 is __NR_exit
        $4 = 1
        (gdb) p $r3
        $5 = 0
        (gdb) c
        

Attachment: signature.asc
Description: This is a digitally signed message part


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]