Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Fix solib-disc.exp regression with x86 gdbserver
Date: Sun, 11 Apr 2010 14:18:00 -0000	[thread overview]
Message-ID: <201004111517.48725.pedro@codesourcery.com> (raw)
In-Reply-To: <u2t6dc9ffc81004110704rbaad7d87p244379515e782c51@mail.gmail.com>

On Sunday 11 April 2010 15:04:39, H.J. Lu wrote:
> How can I debug gdbserver with gdb? I tried and it didn't work.

What doesn't work?  It Just Works for me:

 $gdb -q --args ./gdbserver :9999 ~/gdb/tests/threads
 Reading symbols from /home/pedro/gdb/gdbserver_tracepoints_step_over_bkpt_pushed/build/gdb/gdbserver/gdbserver...done.
 (gdb) start
 Temporary breakpoint 1 at 0x40f51f: file ../../../src/gdb/gdbserver/server.c, line 2238.
 Starting program: /home/pedro/gdb/gdbserver_tracepoints_step_over_bkpt_pushed/build/gdb/gdbserver/gdbserver :9999 /home/pedro/gdb/tests/threads
 
 Temporary breakpoint 1, main (argc=4, argv=0x7fffffffe068) at ../../../src/gdb/gdbserver/server.c:2238
 2238      char **next_arg = &argv[1];
 (gdb)


Attaching works too:

 $ ./gdbserver :9999 ~/gdb/tests/threads
 ...

 $ gdb -p $(pidof gdbserver)
 ...

It used to be GDB would get confused due to the uses of the clone
syscall in linux-low.c, and so breakpoints wouldn't work.  The
easy workaround was just to comment out the linux_test_for_tracefork
call (and hardcode linux_supports_tracefork_flag as 1, to get the
same behaviour you'd get without the hack).  clone is only used
on uclinux/nommu, so you shouldn't need the hack anymore on linux.

gdbserver's "--debug" command line switch is also useful (it enables
all that the internal debug output controlled by `if (debug_threads)').
"(gdb) monitor set debug 1" has the same effect.

-- 
Pedro Alves


  reply	other threads:[~2010-04-11 14:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-11  1:52 Pedro Alves
2010-04-11 14:04 ` H.J. Lu
2010-04-11 14:18   ` Pedro Alves [this message]
2010-04-11 15:43     ` H.J. Lu
2010-04-11 16:17       ` Pedro Alves
2010-04-11 16:22         ` H.J. Lu
2010-04-11 16:59     ` H.J. Lu
2010-04-11 16:04 ` H.J. Lu
2010-04-11 16:13   ` Pedro Alves
2010-04-11 16:18     ` H.J. Lu
2010-04-11 21:12 ` H.J. Lu
2010-04-11 21:18   ` H.J. Lu
2010-04-12  7:46   ` Pedro Alves
2010-04-12 13:05     ` H.J. Lu
2010-04-12 13:26       ` 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=201004111517.48725.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.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