Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>, gdb-patches@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: Re: [patch] Fix for PR gdb/10838
Date: Sat, 14 Nov 2009 02:04:00 -0000	[thread overview]
Message-ID: <8ac60eac0911131804q379d346fwd192d46f5452b314@mail.gmail.com> (raw)
In-Reply-To: <8ac60eac0911111648yf189469t875002ca5cafbefb@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

2009/11/11 Paul Pluzhnikov <ppluzhnikov@google.com>:

> That was fast :-)

Too fast, as it turns out :-(
I didn't test the gdbserver part, but this patch introduced a
gdbserver crash here:

Program terminated with signal 11, Segmentation fault.

#0  0x0000000000408b75 in look_up_one_symbol (name=0x7f6dc44ee3a2
"__nptl_threads_events", addrp=0x7fffcce720c8) at
../../../src/gdb/gdbserver/remote-utils.c:1374
1374      for (sym = proc->symbol_cache; sym; sym = sym->next)

proc is NULL.
Called from:

#0  0x0000000000408b75 in look_up_one_symbol () at
../../../src/gdb/gdbserver/remote-utils.c:1374
#1  0x000000000041ae0e in ps_pglobal_lookup () at
../../../src/gdb/gdbserver/proc-service.c:68
#2  0x00007f6dc44ed60d in td_ta_clear_event () from /lib/libthread_db.so.1
#3  0x000000000041ac8b in thread_db_free (proc=0x6311a0) at
../../../src/gdb/gdbserver/thread-db.c:773
#4  0x0000000000411b44 in linux_remove_process (process=0x6311a0) at
../../../src/gdb/gdbserver/linux-low.c:267

Attached patch fixes that (tested with gdbserver on Linux/x86_64 this time).
The gdb.mi/mi-non-stop-exit.exp test is still failing (regression
since 2009-10-27), but apparently for a different reason.

Thanks,
-- 
Paul Pluzhnikov


2009-11-13  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* proc-service.c (ps_pglobal_lookup): Handle error return
	* remote-utils.c (look_up_one_symbol): Don't crash if the process is gone.

[-- Attachment #2: gdbserver-crash-20091113.txt --]
[-- Type: text/plain, Size: 1220 bytes --]

Index: gdbserver/proc-service.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/proc-service.c,v
retrieving revision 1.14
diff -u -p -u -r1.14 proc-service.c
--- gdbserver/proc-service.c	13 Oct 2009 13:51:21 -0000	1.14
+++ gdbserver/proc-service.c	14 Nov 2009 01:04:48 -0000
@@ -65,7 +65,7 @@ ps_pglobal_lookup (gdb_ps_prochandle_t p
 {
   CORE_ADDR addr;
 
-  if (look_up_one_symbol (name, &addr) == 0)
+  if (look_up_one_symbol (name, &addr) <= 0)
     return PS_NOSYM;
 
   *sym_addr = (psaddr_t) (unsigned long) addr;
Index: gdbserver/remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.68
diff -u -p -u -r1.68 remote-utils.c
--- gdbserver/remote-utils.c	6 Jul 2009 18:31:20 -0000	1.68
+++ gdbserver/remote-utils.c	14 Nov 2009 01:04:48 -0000
@@ -1369,6 +1369,9 @@ look_up_one_symbol (const char *name, CO
   struct process_info *proc;
 
   proc = current_process ();
+  if (proc == NULL)
+    /* Could happen if the process has just exited.  */
+    return -1;
 
   /* Check the cache first.  */
   for (sym = proc->symbol_cache; sym; sym = sym->next)

  reply	other threads:[~2009-11-14  2:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-12  0:35 Paul Pluzhnikov
2009-11-12  0:43 ` Daniel Jacobowitz
2009-11-12  0:48   ` Paul Pluzhnikov
2009-11-14  2:04     ` Paul Pluzhnikov [this message]
2009-11-15 17:37       ` Daniel Jacobowitz
2009-11-15 17:43         ` Doug Evans
2009-11-15 17:47           ` Daniel Jacobowitz
2009-11-16 15:11       ` Pedro Alves
2009-11-16 15:14         ` Pedro Alves
2009-11-16 16:05         ` Paul Pluzhnikov

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=8ac60eac0911131804q379d346fwd192d46f5452b314@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=dje@google.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