qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] gdbstub: Do not kill target in system emulation


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH] gdbstub: Do not kill target in system emulation mode
Date: Wed, 23 Jan 2013 19:44:57 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2013-01-23 19:04, Fabien Chouteau wrote:
> On 01/22/2013 03:59 PM, Jan Kiszka wrote:
>> On 2013-01-22 15:04, Fabien Chouteau wrote:
>>> Hello Qemu folks,
>>>
>>> I'm sorry to be (very) late, but I do not agree with this patch.
>>>
>>> Your modification just makes the "kill" command behave like "detach", so
>>> why not use "detach" instead?
>>
>> gdb automatically issues kill when you quite. This is where most
>> casualties came from.
> 
> Hello Jan,
> 
> I asked Joel Brobecker(CC'd), a Gdb maintainer, about this issue. Here
> is the answer:
> 
> On 01/23/2013 12:49 PM, Joel Brobecker wrote:
>>> There's a patch in Qemu's Gdb remote server that makes the "kill"
>>> command act like "detach".
>>
>> It seems incorrect to me. The behavior should be as follow:
>>   - If the debugger was attached to an existing process, the "quit"
>>     command should result in a "detach".
>>   - If the debugger created the process, then "quit" should result
>>     in a "kill".
>>
>> With that in mind, if GDB sends a "kill", it means that Qemu told
>> GDB that it created the process. What it should be doing, if a "kill"
>> is not the desired behavior, is to tell GDB that the process was
>> attached to. For this, there is qAttached packet. See the GDB
>> Users Manual, and in particular:
>>
>>     | `qAttached:pid'
>>     | Return an indication of whether the remote server attached to an
>>     | existing process or created a new process. When the multiprocess
>>     | protocol extensions are supported (see multiprocess extensions), pid is
>>     | an integer in hexadecimal format identifying the target process.
>>     | Otherwise, gdb will omit the pid field and the query packet will be
>>     | simplified as `qAttached'.  This query is used, for example, to know
>>     | whether the remote process should be detached or killed when a gdb
>>     | session is ended with the quit command.
>>     |
>>     | Reply:
>>     |
>>     | `1'
>>     | The remote server attached to an existing process. 
>>     | `0'
>>     | The remote server created a new process. 
>>     | `E NN'
>>     | A badly formed request or an error was encountered.
> 
> qAttached is not supported in Qemu yet, this explains why Gdb sends
> "kill" at the end of debug session. I will implement it and revert your
> patch. Gdb will automatically detach instead of kill at the end of
> debugging session.
> 
> Is that OK?

Sounds reasonable.

Thanks,
Jan

PS: If you are looking for kill in the meantime: "monitor quit"

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]