This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] [gdbserver] Do not crash on file load without inferior
- From: Pedro Alves <pedro at codesourcery dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: Marc Khouzam <marc dot khouzam at ericsson dot com>, "'gdb-patches at sourceware dot org'" <gdb-patches at sourceware dot org>
- Date: Sat, 5 Mar 2011 11:17:48 +0000
- Subject: Re: [patch] [gdbserver] Do not crash on file load without inferior
- References: <20110224114001.GA24673@host1.dyn.jankratochvil.net> <201103042205.51281.pedro@codesourcery.com> <20110305041102.GA16509@host1.jankratochvil.net>
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"