From: James Milne <jamesm@filmlight.ltd.uk>
To: gdb@sourceware.org
Subject: Interrupting target execution on Linux using GDB/MI
Date: Wed, 01 Apr 2009 16:37:00 -0000 [thread overview]
Message-ID: <0438EB51-6BDE-4174-8C8A-68A24D743C02@filmlight.ltd.uk> (raw)
Hi,
I'm writing a debugger for an interpreted language, and I'm using GDB
as the underlying mechanism for instrumenting the interpreter process.
I have my debugger application process which fork()/execs() gdb and
uses the GDB/MI interface to communicate with it.
I then instruct GDB to load my target executable, set a breakpoint on
main(), specify the arguments I want to pass to the executable using "-
exec-arguments", and then start the executable using "-exec-run". The
executable is the interpreter for the language I'm working with.
Once my breakpoint is hit, I can set further breakpoints within the
interpreter which I use to trace its execution. I can then resume
execution of the target by sending "-exec-continue".
This is all fine, and works correctly. The problem occurs when I want
to interrupt the execution of the target process.
I trap the PID of the inferior process by analysing the stream records
returned from GDB, specifically looking for the first "[New Thread
<blah> (LWP <pid>)]" style response.
On OS X 10.5.6 using Apple's gdb (GNU gdb 6.3.50-20050815 (Apple
version gdb-962)), I have to interrupt the target process by sending a
SIGINT signal directly to the inferior process. This works correctly
and causes GDB to interrupt the execution of the inferior.
However, if I send SIGINT to the inferior using GDB 6.3 or 6.8 on
Linux (CentOS 4.3), GDB returns the following:
&"Quit\n"
^error,msg="Quit"
If I send SIGINT to the gdb process itself, it ignores it.
What is the correct procedure when using GDB/MI to interrupt the
execution of the inferior process?
Regards
James Milne
FilmLight Ltd.
next reply other threads:[~2009-04-01 16:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-01 16:37 James Milne [this message]
2009-04-01 16:42 ` Joel Brobecker
2009-04-01 16:45 ` James Milne
2009-04-01 17:14 ` Marc Khouzam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0438EB51-6BDE-4174-8C8A-68A24D743C02@filmlight.ltd.uk \
--to=jamesm@filmlight.ltd.uk \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox