From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: Re: [patch] [gdbserver] Do not crash on file load without inferior
Date: Thu, 24 Feb 2011 14:26:00 -0000 [thread overview]
Message-ID: <201102241242.49342.pedro@codesourcery.com> (raw)
In-Reply-To: <20110224114001.GA24673@host1.dyn.jankratochvil.net>
On Thursday 24 February 2011 11:40:02, Jan Kratochvil wrote:
> Hi Pedro,
>
> I always got:
>
> (gdb) file .../gdb/testsuite/gdb.server/ext-run
> Load new symbol table from ".../gdb/testsuite/gdb.server/ext-run"? (y or n) y
> Reading symbols from .../gdb/testsuite/gdb.server/ext-run...done.
> gdbserver: Current inferior requested, but current_inferior is NULL
>
> Remote connection closed
> (gdb)
>
> if one connects to gdbserver --multi before loading the file. One needs to
> load the file first to be able to place a breakpoint at *_start or main.
>
> But I face other bugs so I cannot say much more.
>
> I do not think this patch can ever have a regression.
Thanks. I that revealed a problem on the GDB side instead.
E.g., if you have two inferiors loaded, and the not-current
inferior is running, but you do "file" on the not-running-yet
inferior, you'll see:
$ ./gdb ./testsuite/gdb.server/ext-run -ex "tar extended-remote :9999" -ex "set remote exec-file /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.server/ext-run" -ex "start"
...
Reading symbols from /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.server/ext-run...done.
Setting up the environment for debugging gdb.
Remote debugging using :9999
Temporary breakpoint 1 at 0x4004ef: file ../../../src/gdb/testsuite/gdb.server/server.c, line 21.
Starting program: /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.server/ext-run
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffe068) at ../../../src/gdb/testsuite/gdb.server/server.c:21
21 return 0;
(gdb) add-inferior
Added inferior 2
(gdb) info inferiors
Num Description Executable
2 <null>
* 1 process 15952 /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.server/ext-run
(gdb) inferior 2
[Switching to inferior 2 [Thread 0.0] (<noexec>)]
(gdb) set debug remote 1
(gdb) file /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.server/ext-run
Reading symbols from /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.server/ext-run...done.
Sending packet: $Hgp0.0#ad...Packet received: OK
^^^^^^^
Sending packet: $qSymbol::#5b...Packet received: qSymbol:6764625f6167656e745f6764625f74705f686561705f627566666572
Sending packet: $qSymbol::6764625f6167656e745f6764625f74705f686561705f627566666572#1e...Packet received: qSymbol:6764625f6167656e745f6764625f6a756d705f7061645f627566666572
Sending packet: $qSymbol::6764625f6167656e745f6764625f6a756d705f7061645f627566666572#e1...Packet received: qSymbol:6764625f6167656e745f6764625f6a756d705f7061645f6275666665725f656e64
Sending packet: $qSymbol::6764625f6167656e745f6764625f6a756d705f7061645f6275666665725f656e64#ec...Packet received: qSymbol:6764625f6167656e745f636f6c6c656374696e67
But, Hgp0.0 means select _any_ thread in any process, not _no thread at all_.
Meaning GDBserver's current_inferior ends up set to a thread of the
wrong process, and GDBserver is querying inferior 1's symbols on
inferior 2! See on GDBserver:
(gdb) p current_inferior->entry.id
$3 = {pid = 15952, lwp = 15952, tid = 0}
So I think that we shouldn't send qSymbol at all when inferior_ptid is
null_ptid or rather with !target_has_execution (which ends up in
default_child_has_execution and currently resolves the same)?
--
Pedro Alves
next prev parent reply other threads:[~2011-02-24 12:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 12:42 Jan Kratochvil
2011-02-24 14:26 ` Pedro Alves [this message]
2011-03-04 21:25 ` Marc Khouzam
2011-03-04 21:32 ` Pedro Alves
2011-03-04 21:37 ` Jan Kratochvil
2011-03-04 22:05 ` Pedro Alves
2011-03-04 22:14 ` Michael Snyder
2011-03-05 4:11 ` Jan Kratochvil
2011-03-05 11:18 ` Pedro Alves
2011-03-05 12:19 ` Jan Kratochvil
2011-03-08 13:37 ` Pedro Alves
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=201102241242.49342.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@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