This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [gdbserver] Do not crash on file load without inferior


On Saturday 05 March 2011 04:11:03, Jan Kratochvil wrote:
> Given how cheap is to run the testsuite I do not think it is worth spending
> any human effort on coding without having the testsuite results available.

This passes the testsuite without regressions for me,
and I confirmed the new test fails with the gdb hunk
omitted.

Comments?

-- 
Pedro Alves

gdb/
2011-03-05  Pedro Alves  <pedro@codesourcery.com>

	* remote.c (remote_check_symbols): Skip if the target has no
	execution.

gdb/testsuite/
2011-03-05  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* gdb.server/ext-run.exp
	(load new file without any gdbserver inferior): New test.

---
 gdb/remote.c                         |   11 ++++++++++-
 gdb/testsuite/gdb.server/ext-run.exp |    5 +++++
 2 files changed, 15 insertions(+), 1 deletion(-)

Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c	2011-03-05 10:19:07.000000000 +0000
+++ src/gdb/remote.c	2011-03-05 10:54:28.582530001 +0000
@@ -3435,10 +3435,19 @@ remote_check_symbols (struct objfile *ob
   struct minimal_symbol *sym;
   int end;
 
+  /* The remote side has no concept of inferiors that aren't running
+     yet, it only knows about running processes.  If we're connected
+     but our current inferior is not running, we should not invite the
+     remote target to request symbol lookups related to its
+     (unrelated) current process.  */
+  if (!target_has_execution)
+    return;
+
   if (remote_protocol_packets[PACKET_qSymbol].support == PACKET_DISABLE)
     return;
 
-  /* Make sure the remote is pointing at the right process.  */
+  /* Make sure the remote is pointing at the right process.  Note
+     there's no way to select "no process".  */
   set_general_process ();
 
   /* Allocate a message buffer.  We can't reuse the input buffer in RS,
Index: src/gdb/testsuite/gdb.server/ext-run.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.server/ext-run.exp	2011-03-05 10:18:39.000000000 +0000
+++ src/gdb/testsuite/gdb.server/ext-run.exp	2011-03-05 10:49:00.772529995 +0000
@@ -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"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]