From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25178 invoked by alias); 1 Sep 2006 11:12:53 -0000 Received: (qmail 25170 invoked by uid 22791); 1 Sep 2006 11:12:52 -0000 X-Spam-Check-By: sourceware.org Received: from ip-160-218-139-152.eurotel.cz (HELO host0.dyn.jankratochvil.net) (160.218.139.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 01 Sep 2006 11:12:49 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.13.7/8.13.7) with ESMTP id k81BCiFs023113 for ; Fri, 1 Sep 2006 13:12:44 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.13.7/8.13.7/Submit) id k81BCfH7023112 for gdb-patches@sourceware.org; Fri, 1 Sep 2006 13:12:41 +0200 Date: Fri, 01 Sep 2006 11:12:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] TLS resolving for separate_debug_objfile Message-ID: <20060901111241.GA23025@host0.dyn.jankratochvil.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="liOOAslEiF7prFVr" Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00001.txt.bz2 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 671 Hi, attached patch will fix (gdb) print errno otherwise producing Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list for me on Fedora Core 5/devel. Despite I also attached the testsuite the testsuite itself is probably not suitable for the mainline as I failed to reproduce the bug on CVS version of GDB (OK, I did not try too much, I believe mainline GDB will not find the separate debuginfo file there at all). I hope the patch looks correct and harmless enough. 2006-09-01 Jan Kratochvil * dwarf2loc.c (dwarf_expr_tls_address): Fix for separate debuginfo. Regards, Jan --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-separate_debug_objfile_backlink.patch" Content-length: 580 diff -u -X /home/jkratoch/.diffi.list -rN gdb-6.5-orig/gdb/dwarf2loc.c gdb-6.5/gdb/dwarf2loc.c --- gdb-6.5-orig/gdb/dwarf2loc.c 2005-12-17 23:33:59.000000000 +0100 +++ gdb-6.5/gdb/dwarf2loc.c 2006-09-01 12:24:33.000000000 +0200 @@ -198,6 +198,9 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset) struct objfile *objfile = debaton->objfile; volatile struct gdb_exception ex; + if (objfile->separate_debug_objfile_backlink != NULL) + objfile = objfile->separate_debug_objfile_backlink; + TRY_CATCH (ex, RETURN_MASK_ALL) { CORE_ADDR lm_addr; --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gdb-separate_debug_objfile_backlink-testsuite-fedoracore.patch" Content-length: 3390 diff -u -X /home/jkratoch/.diffi.list -rN gdb-6.5-orig/gdb/testsuite/gdb.threads/tls-sepdebug.c gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.c --- gdb-6.5-orig/gdb/testsuite/gdb.threads/tls-sepdebug.c 1970-01-01 01:00:00.000000000 +0100 +++ gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.c 2006-09-01 12:18:06.000000000 +0200 @@ -0,0 +1,41 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2006 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@prep.ai.mit.edu */ + +#include + +int x; + +void bar() +{ + x--; +} + +void foo() +{ + x++; +} + +int main() +{ + foo(); + bar(); + return 0; +} diff -u -X /home/jkratoch/.diffi.list -rN gdb-6.5-orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.exp --- gdb-6.5-orig/gdb/testsuite/gdb.threads/tls-sepdebug.exp 1970-01-01 01:00:00.000000000 +0100 +++ gdb-6.5/gdb/testsuite/gdb.threads/tls-sepdebug.exp 2006-09-01 12:23:29.000000000 +0200 @@ -0,0 +1,47 @@ +# Copyright 2006 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +if $tracelevel then { + strace $tracelevel +} + +set testfile tls-sepdebug +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested "Couldn't compile test program" + return -1 +} + +# Get things started. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +# For C programs, "start" should stop in main(). + +gdb_test "start" \ + "main \\(\\) at .*tls-sepdebug.c.*" \ + "start" + +# Check for: Cannot find shared library `/usr/lib/debug/lib/libc-2.4.90.so.debug' in dynamic linker's load module list +# as happens with TLS variables and `separate_debug_objfile_backlink'. + +gdb_test "print errno" \ + "\\\$1 = \[0-9\].*" \ + "print errno" --liOOAslEiF7prFVr--