Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] [gdbserver] Do not crash on file load without inferior
@ 2011-02-24 12:42 Jan Kratochvil
  2011-02-24 14:26 ` Pedro Alves
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Kratochvil @ 2011-02-24 12:42 UTC (permalink / raw)
  To: gdb-patches

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"


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-03-08 13:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-24 12:42 [patch] [gdbserver] Do not crash on file load without inferior Jan Kratochvil
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox