mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-28 01:50:48 +00:00
2007-07-03 Markus Deuling <deuling@de.ibm.com>
* cp-namespace.c (lookup_symbol_file): Add block to lookup_symbol_global call. * Makefile.in (solist_h): Add dependency on symtab header. (symtab.o): Add dependency on solist header. * solib.c (solib_global_lookup): New function. * solib-svr4.c (scan_dyntag): Likewise. (elf_locate_base): Call helper routine scan_dyntag. (elf_lookup_lib_symbol): New function. (_initialize_svr4_solib): Add elf_lookup_lib_symbol to svr4_so_ops. * solist.h (symtab.h): New include. (struct target_so_ops): New member lookup_lib_global_symbol. (solib_global_lookup): New prototype. * symtab.c: New include solist.h. (lookup_objfile_from_block): New function. (lookup_global_symbol_from_objfile): New function. (basic_lookup_symbol_nonlocal): Add block to lookup_symbol_global call. (lookup_symbol_global): Call library-specific lookup procedure. * symtab.h (lookup_global_symbol_from_objfile): New prototype. * NEWS: Document framework. testsuite/ * gdb.base/solib-symbol.exp: New file (testcase multiple symbol lookup). * gdb.base/solib-symbol-lib.c: Likewise. * gdb.base/solib-symbol-main.c: Likewise.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2007-07-03 Markus Deuling <deuling@de.ibm.com>
|
||||
|
||||
* gdb.base/solib-symbol.exp: New file (testcase multiple symbol lookup).
|
||||
* gdb.base/solib-symbol-lib.c: Likewise.
|
||||
* gdb.base/solib-symbol-main.c: Likewise.
|
||||
|
||||
2007-07-02 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* config/gdbserver.exp (gdb_reconnect): New.
|
||||
|
||||
32
gdb/testsuite/gdb.base/solib-symbol-lib.c
Normal file
32
gdb/testsuite/gdb.base/solib-symbol-lib.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright 2007 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.
|
||||
|
||||
Contributed by Markus Deuling <deuling@de.ibm.com>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
void
|
||||
foo ()
|
||||
{
|
||||
printf ("foo in lib\n");
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
foo2()
|
||||
{
|
||||
printf ("foo2 in lib\n");
|
||||
return;
|
||||
}
|
||||
43
gdb/testsuite/gdb.base/solib-symbol-main.c
Normal file
43
gdb/testsuite/gdb.base/solib-symbol-main.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Copyright 2007 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.
|
||||
|
||||
Contributed by Markus Deuling <deuling@de.ibm.com>.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
extern void foo();
|
||||
void foo3();
|
||||
void foo2();
|
||||
|
||||
int main ()
|
||||
{
|
||||
printf ("in main\n");
|
||||
foo ();
|
||||
foo3 ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void foo3()
|
||||
{
|
||||
printf ("foo3 in main\n");
|
||||
return;
|
||||
}
|
||||
|
||||
void foo2()
|
||||
{
|
||||
printf ("foo2 in main\n");
|
||||
return;
|
||||
}
|
||||
|
||||
80
gdb/testsuite/gdb.base/solib-symbol.exp
Normal file
80
gdb/testsuite/gdb.base/solib-symbol.exp
Normal file
@@ -0,0 +1,80 @@
|
||||
# Copyright 2007 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.
|
||||
#
|
||||
# Contributed by Markus Deuling <deuling@de.ibm.com>.
|
||||
#
|
||||
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
# Library file.
|
||||
set libname "solib-symbol-lib"
|
||||
set srcfile_lib ${srcdir}/${subdir}/${libname}.c
|
||||
set binfile_lib ${objdir}/${subdir}/${libname}.so
|
||||
set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
|
||||
# Binary file.
|
||||
set testfile "solib-symbol-main"
|
||||
set srcfile ${srcdir}/${subdir}/${testfile}.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
set bin_flags [list debug shlib=${binfile_lib}]
|
||||
|
||||
if [get_compiler_info ${binfile}] {
|
||||
return -1
|
||||
}
|
||||
|
||||
if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $lib_flags] != ""
|
||||
|| [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } {
|
||||
untested "Could not compile $binfile_lib or $binfile."
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_exit
|
||||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $binfile_lib
|
||||
|
||||
if ![runto_main] then {
|
||||
fail "Can't run to main"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Set a breakpoint in the binary.
|
||||
gdb_test "br foo2" \
|
||||
"Breakpoint.*file.*${srcfile}.*" \
|
||||
"foo2 in main"
|
||||
|
||||
delete_breakpoints
|
||||
|
||||
# Break in the library.
|
||||
gdb_test "br foo" \
|
||||
"" \
|
||||
"foo in libmd"
|
||||
|
||||
gdb_test "continue" \
|
||||
"Continuing.*" \
|
||||
"continue"
|
||||
|
||||
# This symbol is now looked up in the ELF library.
|
||||
gdb_test "br foo2" \
|
||||
"Breakpoint.*file.*${srcfile_lib}.*" \
|
||||
"foo2 in mdlib"
|
||||
|
||||
gdb_exit
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user