Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] TLS resolving for separate_debug_objfile
Date: Fri, 01 Sep 2006 11:12:00 -0000	[thread overview]
Message-ID: <20060901111241.GA23025@host0.dyn.jankratochvil.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

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  <jan.kratochvil@redhat.com>

	* dwarf2loc.c (dwarf_expr_tls_address): Fix for separate debuginfo.


Regards,
Jan

[-- Attachment #2: gdb-separate_debug_objfile_backlink.patch --]
[-- Type: text/plain, Size: 580 bytes --]

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;

[-- Attachment #3: gdb-separate_debug_objfile_backlink-testsuite-fedoracore.patch --]
[-- Type: text/plain, Size: 3390 bytes --]

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 <stdio.h>
+
+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"

             reply	other threads:[~2006-09-01 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-01 11:12 Jan Kratochvil [this message]
2006-09-01 12:53 ` Daniel Jacobowitz
2006-09-01 23:18   ` Jan Kratochvil

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=20060901111241.GA23025@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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