GDB doesn't interrupt target

Tudor Popescu popescu.m.tudor@gmail.com
Thu Dec 19 13:10:00 GMT 2019


Indeed the "interrupt" works on Debugger Console, as for the Suspend, the
console prints a "^CQuit" just as when killing.
After some investigations I have found that in gdb,
target_terminal::inferior() is called to set "ownership" of terminal, but
it's called from
a mi_exec_cmd - an "attach 1", after a "continue", after a "resume", so the
current_ui != main_ui (ui = current_ui; if(ui != main_ui)...), because
mix_exec_cmd is run from the new-ui context, so target_terminal::inferior()
does nothing.

On Wed, Dec 18, 2019 at 5:49 PM Jonah Graham <jonah@kichwacoders.com> wrote:

>
>
> On Wed, 18 Dec 2019 at 09:59, Pedro Alves <palves@redhat.com> wrote:
>
>> On 12/18/19 2:20 PM, Tudor Popescu wrote:
>> > What I need, is a way to interrupt the target while target is running.
>>
>
> The way to do this is press the "Suspend" button in the toolbar in
> Eclipse, or typing the "interrupt" command in the Debugger Console. If
> these don't both work for you, there may be a bug in CDT. Please raise a
> bug against CDT on https://bugs.eclipse.org/bugs/enter_bug.cgi?product=CDT and
> I will look at it. Please be sure to include where you got your Eclipse
> from - if it is from a vendor they may be the one with the issue and you
> should probably be in touch with them first.
>
>
>> > Also, I would like to understand what is causing the above mentioned
>> > behavior. I know that GDB 7.12+ introduced some changes to support a
>> > prettier Debugger Console in eclipse and this seems to impact somehow
>> the
>> > interrupt functionality in my case.
>>
>
> Yes, this is the case. The GDB folk did some great work so that a fully
> fledged GDB console can be integrated in an IDE and that is what CDT does
> with GDB >= 7.12 on Linux hosts.
>
>
>> >
>> > So the main question is how do I make GDB 8.2.1 behave like GDB 7.11.1
>> when
>> > it comes to target interrupting (e.g. Ctrl+C)? Are there any special
>> > arguments that need to be passed to GDB?
>>
>
> You would have to change how GDB is integrated into CDT rather than
> changing GDB. However I hope the above answers mean you don't need that.
>
>
>>
>> So what _do_ you see when you "kill -2" gdb?  Do you see a "Quit" being
>> printed?
>> I.e., the GDB console is accepting commands while the target is running?
>>
>> I assume Eclipse sends "set mi-async on" or "set target-async on"
>> nowadays.
>>
>>
> CDT uses -gdb-set target-async on
>
>
>
>> The right way to interrupt the target is to send -exec-interrupt via the
>> MI channel.
>>
>>
> That is what CDT does .
>
> I hope that helps,
> Jonah
>
>
> ~~~
> Jonah Graham
> Kichwa Coders
> www.kichwacoders.com
>



More information about the Gdb mailing list