From: Duane Ellis <duane@duaneellis.com>
To: Ofir Cohen <ofircohenn@gmail.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: GDB Python - gdb.execute() - with a timeout?
Date: Tue, 28 Jul 2015 12:14:00 -0000 [thread overview]
Message-ID: <7E44F1FD-CC35-419A-BA31-8D0B5D847DEC@duaneellis.com> (raw)
In-Reply-To: <CAHOBVAe3UMMOXFB5mfAqZm-EUrkdOpNrxf4JHOhi+ps1N3_mAA@mail.gmail.com>
> This is achievable via pexpect wrapper.
Thanks for the example but that won’t work for my situation - solution needs to run from within a GUI that has already wrapped GDB/LLDB in some form (for example eclipse). The pexpect solution - is external and controls GDB, in my scenario something else is already controlling GDB (i.e.: Eclipse or Emacs-GUD mode)
I have an idea - but don’t know how to implement parts of it
After (X) timeout period I need to simulate pressing “control-C” via the gdb_python solution.
The idea is that Control_C at the GDB command console will cause GDB “cont” to stop - and send a “target halt” command and thus the gdb.excute(‘cont’) call will finish & return.
That would probably be sufficient for my purposes, the idea is sort of this:
Mainline thread:
Set global “timeout period”
FORK - creating new “timeout thread”
perform gdb.execute(“cont”)
*CANCEL* the timeout thread.
Meanwhile, timeout thread
sleeps for “timeout period”
After timeout period - ?? somehow ?? Simulate human pressing Control-C at the GDB console window
Some notes:
(A) I know that GDB is single threaded
(B) I know there is an ‘event queue’ or ‘work queue’
(C) As I understand Python threads must “post” an event to a GDB event/work queue
(D) Eventually when GDB is ‘safe’ that work item would be executed.
Assuming that work item is a call to a Python function, I don’t see how via Python the way to simulate “control-C” at the command console.
Am I missing something? Any suggestions?
Thanks.
prev parent reply other threads:[~2015-07-28 12:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 12:23 Duane Ellis
2015-07-28 10:09 ` Ofir Cohen
2015-07-28 12:14 ` Duane Ellis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7E44F1FD-CC35-419A-BA31-8D0B5D847DEC@duaneellis.com \
--to=duane@duaneellis.com \
--cc=gdb@sourceware.org \
--cc=ofircohenn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox