From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5867 invoked by alias); 11 Apr 2010 14:18:00 -0000 Received: (qmail 5845 invoked by uid 22791); 11 Apr 2010 14:17:59 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Apr 2010 14:17:55 +0000 Received: (qmail 832 invoked from network); 11 Apr 2010 14:17:51 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Apr 2010 14:17:51 -0000 From: Pedro Alves To: "H.J. Lu" Subject: Re: Fix solib-disc.exp regression with x86 gdbserver Date: Sun, 11 Apr 2010 14:18:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <201004110252.35997.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004111517.48725.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00321.txt.bz2 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