* Mixing syscalls and breakpoints at the command line
@ 2007-07-07 13:30 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2007-07-07 13:30 UTC (permalink / raw)
To: frysk
[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]
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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-07 13:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-07 13:30 Mixing syscalls and breakpoints at the command line Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).