This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] gdbserver with reversed arguments seg. fault
- From: Denis PILAT <denis dot pilat at st dot com>
- To: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 03 Jan 2007 10:29:49 +0100
- Subject: [RFA] gdbserver with reversed arguments seg. fault
Hi,
Following our discussion in the thread
http://sources.redhat.com/ml/gdb-patches/2007-01/msg00059.html
I'm proposing the attached patch to fix a segmentation fault that occurs
into gdbserver when you revert the binary filename with the "host:port"
argument.
In inferiors.c the inferior_target_data() function is called with a NULL
pointer argument. At the beginning I though of testing arguments but
none of them are tested in this whole file so I concluded it's up to the
caller to do so.
(I hope this time my patch is related to a version nearer from the HEAD :)
Denis
--
2007-01-03 Denis Pilat <denis.pilat@st.com>
* linux-low.c (linux_kill): handle the null case of all_threads.head.
Index: linux-low.c
===================================================================
--- linux-low.c (revision 545)
+++ linux-low.c (working copy)
@@ -255,9 +255,13 @@ static void
linux_kill (void)
{
struct thread_info *thread = (struct thread_info *) all_threads.head;
- struct process_info *process = get_thread_process (thread);
+ struct process_info *process;
int wstat;
+ if (! thread)
+ return;
+
+ process = get_thread_process (thread);
for_each_inferior (&all_threads, linux_kill_one_process);
/* See the comment in linux_kill_one_process. We did not kill the first