Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Interrupting target execution on Linux using GDB/MI
@ 2009-04-01 16:37 James Milne
  2009-04-01 16:42 ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: James Milne @ 2009-04-01 16:37 UTC (permalink / raw)
  To: gdb

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-01 17:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-01 16:37 Interrupting target execution on Linux using GDB/MI James Milne
2009-04-01 16:42 ` Joel Brobecker
2009-04-01 16:45   ` James Milne
2009-04-01 17:14     ` Marc Khouzam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox