From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7990 invoked by alias); 8 Aug 2011 21:10:04 -0000 Received: (qmail 7981 invoked by uid 22791); 8 Aug 2011 21:10:03 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Aug 2011 21:09:42 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p78L9gAW028898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 8 Aug 2011 17:09:42 -0400 Received: from host1.jankratochvil.net (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p78L9eFA032046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 8 Aug 2011 17:09:41 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p78L9dLU019978; Mon, 8 Aug 2011 23:09:39 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p78L9cVC019977; Mon, 8 Aug 2011 23:09:38 +0200 Date: Mon, 08 Aug 2011 21:10:00 -0000 From: Jan Kratochvil To: Paul Pluzhnikov Cc: gdb-patches@sourceware.org Subject: Re: [patch] Implement qXfer:libraries for Linux/gdbserver Message-ID: <20110808210938.GA19337@host1.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-08/txt/msg00156.txt.bz2 Hi Paul, with: ./gdbserver :1234 ~/t/pause64 ../gdb ~/t/pause64 -ex 'target remote localhost:1234' -ex 'b main' -ex c it falls back back memory-transfers as DT_DEBUG is zero initially at _start. just to get the patch integrated on some final patches assembly. Thanks, Jan gdb/gdbserver/ 2011-08-08 Jan Kratochvil Fix initial zero DT_DEBUG. * linux-low.c (linux_add_process): Remove r_debug initialization. (get_r_debug): Update function comment. Return -1 when DT_DEBUG is not found. (linux_qxfer_libraries): Call get_r_debug on -1 (not 0). Return on both -1 or 0. --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -264,7 +264,6 @@ linux_add_process (int pid, int attached) proc = add_process (pid, attached); proc->private = xcalloc (1, sizeof (*proc->private)); - proc->private->r_debug = (CORE_ADDR) -1; if (the_low_target.new_process != NULL) proc->private->arch_private = the_low_target.new_process (); @@ -4863,7 +4862,8 @@ get_dynamic (const int pid, const int is_elf64) return 0; } -/* Return &_r_debug in the inferior, or 0 if not present. */ +/* Return &_r_debug in the inferior, or -1 if not present. Return value + can be 0 if the inferior does not yet have the library list initialized. */ static CORE_ADDR get_r_debug (const int pid, const int is_elf64) @@ -4874,7 +4874,7 @@ get_r_debug (const int pid, const int is_elf64) dynamic_memaddr = get_dynamic (pid, is_elf64); if (dynamic_memaddr == 0) - return 0; + return (CORE_ADDR) -1; while (linux_read_memory (dynamic_memaddr, buf, dyn_size) == 0) { @@ -4981,12 +4981,10 @@ linux_qxfer_libraries (const char *annex, unsigned char *readbuf, is_elf64 = elf_64_file_p (filename); lmo = is_elf64 ? &lmo_64bit_offsets : &lmo_32bit_offsets; - if (priv->r_debug == (CORE_ADDR) -1) + if (priv->r_debug == 0) priv->r_debug = get_r_debug (pid, is_elf64); - gdb_assert (priv->r_debug != (CORE_ADDR) -1); - - if (priv->r_debug == 0) + if (priv->r_debug == (CORE_ADDR) -1 || priv->r_debug == 0) { document = xstrdup ("\n"); }