From: Kevin Pouget <kevin.pouget@gmail.com>
To: Tom Tromey <tromey@redhat.com>,
Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Dejagnu testing issue
Date: Fri, 21 Oct 2011 08:33:00 -0000 [thread overview]
Message-ID: <CAPftXUJ5xrFnYRVK+-FkRw_Gv48BscqOBw2mpo8rA5OJdTJtVw@mail.gmail.com> (raw)
In-Reply-To: <m31uu7r9jo.fsf@fleche.redhat.com>
On Thu, Oct 20, 2011 at 5:02 PM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Kevin" == Kevin Pouget <kevin.pouget@gmail.com> writes:
>
> Kevin> how can I read a value from what GDB writes, and use it later to
> Kevin> validate some tests.
>
> Kevin> For instance, the pid:
>
> Kevin> I know it's it "info inferiors" --> ".*process HERE .*", I would like
> Kevin> to save it, and then do something like "detach", "attach $PID"
>
> Kevin> (don't get me wrong, I know there are some alternatives to get the
> Kevin> PID, but I really want to read it from a GDB command)
>
> You can do it, with some difficulty, using gdb_test_multiple and
> examining expect_out in your match. This is done in some places in the
> code.
Thanks for your reponses (and sorry for posted on the wrong
mailing-list, it was supposed to go to gdb@sourceware.org)
for the record, here is the way to get the pid based on "expect_out":
gdb_test_multiple "info inferior" "list inferiors" {
-re ".* \* 1.*process (\[0-9\]*).*$gdb_prompt $" {
set pid $expect_out(1,string)
pass "list inferiors"
}
}
> Kevin> By the way, is it a normal that I can't set a thread breakpoint this way:
>
>>> break <somewhere> thread $_thread
>>> Junk after thread keyword.
>
> Kevin> (that would have bypassed the problem described above !)
>
> Yes, the 'thread' modifier just takes an integer.
> You can use eval though:
>
> eval "break ... thread %d", $_thread
from a user point of view, it's not obvious why $_thread is not an
integer / what it actually is, but I guess there are some background
reasons. Anyway, output parsing and `eval' did the trick, thanks
Kevin
Kevin
next prev parent reply other threads:[~2011-10-21 8:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-20 14:56 Kevin Pouget
2011-10-20 15:02 ` Jan Kratochvil
2011-10-20 15:04 ` Tom Tromey
2011-10-21 8:33 ` Kevin Pouget [this message]
2011-10-21 8:42 ` Jan Kratochvil
2011-10-24 9:15 ` Kevin Pouget
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=CAPftXUJ5xrFnYRVK+-FkRw_Gv48BscqOBw2mpo8rA5OJdTJtVw@mail.gmail.com \
--to=kevin.pouget@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=tromey@redhat.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