This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [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>, drow at false dot org
- Cc: Denis PILAT <denis dot pilat at st dot com>
- Date: Wed, 03 Jan 2007 16:02:06 +0100
- Subject: Re: [RFA] gdbserver with reversed arguments seg. fault
- References: <459B778D.4000500@st.com> <20070103144423.GB12452@nevyn.them.org>
Daniel Jacobowitz wrote:
On Wed, Jan 03, 2007 at 10:29:49AM +0100, Denis PILAT wrote:
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.
What exactly did you do to get this crash? What's the backtrace look
like? It didn't happen for me.
Here is the output :
> ./gdbserver ~/tmp/hello/hello.out :2222
Cannot exec :2222: No such file or directory.
Process :2222 created; pid = 25945
Child exited with retcode = 7f
Could not open remote device: Invalid argument.
Killing inferior
Segmentation fault (core dumped)
Here is the backtrace:
Program received signal SIGSEGV, Segmentation fault.
inferior_target_data (inferior=0x0)
at
/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/gdb/gdb/gdbserver/inferiors.c:227
227 {
(gdb) bt
#0 inferior_target_data (inferior=0x0)
at
/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/gdb/gdb/gdbserver/inferiors.c:227
#1 0x0804e2a9 in main (argc=3, argv=0xbfff9414)
at
/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/gdb/gdb/gdbserver/server.c:620