lkml.org 
[lkml]   [1997]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectA gdb patch for dynamic linker
Date
Hi,

The newer Linux kernel may load the dynamic linker anywhere it finds
a place for it. As the result,

# gdb ld.so

doesn't work under newer linux kernel when it tries to insert the
break point in the dynamic linker using the address found in the
dynamic linker binary since the kernel may not load the dynamic
linker at address 0. This patch seems to fix this problem.

Thanks.

--
H.J. Lu (hjl@gnu.org)
---
Sun Nov 23 12:45:26 1997 H.J. Lu (hjl@gnu.org)

* solib.c (enable_break): Find and use the load address when
debugging a dynamic linker for SVR4 shared library.

--- gdb-970817/gdb/solib.c.orig Sun Mar 9 21:13:53 1997
+++ gdb-970817/gdb/solib.c Sun Nov 23 12:53:00 1997
@@ -1398,6 +1398,7 @@
enable_break ()
{
int success = 0;
+ CORE_ADDR load_addr = 0;

#ifndef SVR4_SHARED_LIBS

@@ -1449,7 +1450,6 @@
{
unsigned int interp_sect_size;
char *buf;
- CORE_ADDR load_addr;
bfd *tmp_bfd;
CORE_ADDR sym_addr = 0;

@@ -1508,6 +1508,12 @@
warning ("Unable to find dynamic linker breakpoint function.");
warning ("GDB will be unable to debug shared library initializers");
warning ("and track explicitly loaded dynamic code.");
+ load_addr = 0;
+ }
+ else
+ {
+ if (exec_bfd->flags & DYNAMIC)
+ load_addr = read_pc () - exec_bfd->start_address;
}
#endif

@@ -1520,7 +1526,8 @@
msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
{
- create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
+ create_solib_event_breakpoint (load_addr +
+ SYMBOL_VALUE_ADDRESS (msymbol));
return 1;
}
}
\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.042 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site