From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24316 invoked by alias); 1 Apr 2009 16:37:40 -0000 Received: (qmail 24306 invoked by uid 22791); 1 Apr 2009 16:37:39 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from alto.filmlight.ltd.uk (HELO a.mx.filmlight.ltd.uk) (217.40.27.25) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Wed, 01 Apr 2009 16:37:32 +0000 Received: (qmail 10297 invoked from network); 1 Apr 2009 16:37:29 -0000 Received: from dhcp-168.filmlight.ltd.uk (jamesm@10.44.0.168) by a.mx.filmlight.ltd.uk with SMTP; 1 Apr 2009 16:37:29 -0000 Message-Id: <0438EB51-6BDE-4174-8C8A-68A24D743C02@filmlight.ltd.uk> From: James Milne To: gdb@sourceware.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Interrupting target execution on Linux using GDB/MI Date: Wed, 01 Apr 2009 16:37:00 -0000 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00002.txt.bz2 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 (LWP )]" 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.