From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] [gdbserver] Do not crash on file load without inferior
Date: Thu, 24 Feb 2011 12:42:00 -0000 [thread overview]
Message-ID: <20110224114001.GA24673@host1.dyn.jankratochvil.net> (raw)
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,
Jan
gdb/gdbserver/
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* server.c (handle_query) <qSymbol::>: Do not error on NULL
CURRENT_INFERIOR.
gdb/testsuite/
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.server/ext-run.exp
(load new file without any gdbserver inferior): New test.
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1373,13 +1373,17 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
the library at all. We also re-validate breakpoints when we
see a second GDB breakpoint for the same address, and or when
we access breakpoint shadows. */
- validate_breakpoints ();
- if (target_supports_tracepoints ())
- tracepoint_look_up_symbols ();
+ if (current_inferior != NULL)
+ {
+ validate_breakpoints ();
- if (target_running () && the_target->look_up_symbols != NULL)
- (*the_target->look_up_symbols) ();
+ if (target_supports_tracepoints ())
+ tracepoint_look_up_symbols ();
+
+ if (target_running () && the_target->look_up_symbols != NULL)
+ (*the_target->look_up_symbols) ();
+ }
strcpy (own_buf, "OK");
return;
--- a/gdb/testsuite/gdb.server/ext-run.exp
+++ b/gdb/testsuite/gdb.server/ext-run.exp
@@ -60,4 +60,9 @@ if { [istarget *-*-linux*] } {
}
gdb_test "kill" "" "kill" "Kill the program being debugged.*" "y"
+
+gdb_load $binfile
+gdb_test "monitor help" "The following monitor commands.*" \
+ "load new file without any gdbserver inferior"
+
gdb_test_no_output "monitor exit"
next reply other threads:[~2011-02-24 11:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 12:42 Jan Kratochvil [this message]
2011-02-24 14:26 ` Pedro Alves
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=20110224114001.GA24673@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/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