Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Marc Khouzam <marc.khouzam@ericsson.com>,
	"'gdb-patches@sourceware.org'" <gdb-patches@sourceware.org>
Subject: Re: [patch] [gdbserver] Do not crash on file load without inferior
Date: Sat, 05 Mar 2011 11:18:00 -0000	[thread overview]
Message-ID: <201103051117.48593.pedro@codesourcery.com> (raw)
In-Reply-To: <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"


  reply	other threads:[~2011-03-05 11:18 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
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 [this message]
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=201103051117.48593.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=marc.khouzam@ericsson.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