Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] TLS resolving for separate_debug_objfile
@ 2006-09-01 11:12 Jan Kratochvil
  2006-09-01 12:53 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2006-09-01 11:12 UTC (permalink / raw)
  To: gdb-patches

[-- 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"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-01 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-01 11:12 [patch] TLS resolving for separate_debug_objfile Jan Kratochvil
2006-09-01 12:53 ` Daniel Jacobowitz
2006-09-01 23:18   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox