GDB 7.11 vs. 7.12+ -- expected behaviour after posting a "continue" event?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GDB 7.11 vs. 7.12+ -- expected behaviour after posting a "continue" event?

Alexandru-Adrian Oltean
Hi,

I have a set of python scripts that execute "continue" via gdb.post_event() at some point. What I noticed is a weird behaviour after switching to GDB 7.12+. Initially, I've been using GDB 7.11. 

Long story short is that once I execute a gdb.post_event() with a "continue" command, GDB 7.12+ no longer accepts CTRL+C as a way to interrupt the target app. Once I execute CTRL+C, I see "^CQuit" being printed in the console but target app is not being interrupted - "info program" says it's still running. However, if I type "interrupt", I see the program gets stopped. When using GDB 7.11, CTRL+C works as expected (from my point of view) after executing the gdb.post_event() with the "continue" command.

Steps to reproduce the described behaviours:
  1. Build GDB 7.11 and GDB 8.3 (or GDB 7.12) with python support
  2. Build a simple "test" app that executes an infinite loop; we'll use it for debugging
  3. In do_continue.py, write a callable like the one below:
import _gdb
class DoContinue():
    def __call__(self):
        _gdb.execute("continue")
_gdb.post_event(DoContinue())
  4. Experiment the following use case with the two GDB versions mentioned:
     a. Start debugging - "gdb test"
     b. Run the app - "run"
     c. Hit CTRL+C; app must be correctly interrupted
     d. Run the script with the gdb.post_event() - "source do_continue.py"; app will be running at this point
     e. Press CTRL+C. Program gets interrupted when using GDB 7.11 but not when using GDB 8.3.

Can someone explain the behaviour seen in GDB 7.12+? Is it expected? How can I make GDB 7.12+ behave like GDB 7.11?

Thank you,
Adrian
Reply | Threaded
Open this post in threaded view
|

Re: GDB 7.11 vs. 7.12+ -- expected behaviour after posting a "continue" event?

Jonah Graham
On Sat, 15 Feb 2020 at 13:31, Adrian Oltean <[hidden email]> wrote:
> I have a set of python scripts that execute "continue" via gdb.post_event() at some point. What I noticed is a weird behaviour after switching to GDB 7.12+. Initially, I've been using GDB 7.11.

I think this "weird behaviour" can me summarized as continue is now
being run in the background. i.e. it behaves as if "continue&" had
been run in the CLI instead of "continue"

Adrian and I have been discussing this on CDT's dev mailing list. The
assumption is that this changed related to "new-ui" as the behaviour
changed between 7.11 and 7.12. I can confirm that commit a8836c9 [1]
specifically as part of the new-ui change causes the behaviour change.
That commit changes some of the sync/async behaviour.

I tried reverting a8836c9 on top of the gdb-7.12-release tag and the
continue behaviour returns to the pre-7.12 behaviour.

I assume this change was an unintended side effect. @Pedro is this
something that can or should be fixed/changed?

Thanks,
Jonah

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=a8836c9358a11055a08d11ecacc5d7c8f6d5e7a8