* config/pa/hpux.mh (NATDEPFILES): Remove somread.o.
* configure: Rebuild. * configure.ac: Add somread.o to the build if BFD has SOM support. * somread.c: Include som/aout.h, not syms.h. (som_symtab_read): Use som_external_symbol_dictionary_record. Unpack records manually. (_initialize_somread): Declare.
This commit is contained in:
parent
679af3685c
commit
b2259038ba
5 changed files with 117 additions and 47 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2013-01-09 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* config/pa/hpux.mh (NATDEPFILES): Remove somread.o.
|
||||||
|
* configure: Rebuild.
|
||||||
|
* configure.ac: Add somread.o to the build if BFD has SOM
|
||||||
|
support.
|
||||||
|
* somread.c: Include som/aout.h, not syms.h.
|
||||||
|
(som_symtab_read): Use som_external_symbol_dictionary_record.
|
||||||
|
Unpack records manually.
|
||||||
|
(_initialize_somread): Declare.
|
||||||
|
|
||||||
2012-01-08 Mike Frysinger <vapier@gentoo.org>
|
2012-01-08 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* common/linux-ptrace.c (linux_ptrace_test_ret_to_nx) [__x86_64__]:
|
* common/linux-ptrace.c (linux_ptrace_test_ret_to_nx) [__x86_64__]:
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Host: PA-RISC HP-UX
|
# Host: PA-RISC HP-UX
|
||||||
NATDEPFILES= fork-child.o inf-ptrace.o inf-ttrace.o \
|
NATDEPFILES= fork-child.o inf-ptrace.o inf-ttrace.o \
|
||||||
hppa-hpux-nat.o somread.o
|
hppa-hpux-nat.o
|
||||||
|
|
52
gdb/configure
vendored
52
gdb/configure
vendored
|
@ -12674,6 +12674,58 @@ if test $gdb_cv_var_macho = yes; then
|
||||||
CONFIG_OBS="$CONFIG_OBS machoread.o"
|
CONFIG_OBS="$CONFIG_OBS machoread.o"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add SOM support to GDB, but only if BFD includes it.
|
||||||
|
|
||||||
|
OLD_CFLAGS=$CFLAGS
|
||||||
|
OLD_LDFLAGS=$LDFLAGS
|
||||||
|
OLD_LIBS=$LIBS
|
||||||
|
# Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS
|
||||||
|
# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
|
||||||
|
# always want our bfd.
|
||||||
|
CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
|
||||||
|
LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
|
||||||
|
intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
|
||||||
|
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
|
||||||
|
if test "$plugins" = "yes"; then
|
||||||
|
LIBS="-ldl $LIBS"
|
||||||
|
fi
|
||||||
|
LIBS="-lbfd -liberty $intl $LIBS"
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SOM support in BFD" >&5
|
||||||
|
$as_echo_n "checking for SOM support in BFD... " >&6; }
|
||||||
|
if test "${gdb_cv_var_som+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "bfd.h"
|
||||||
|
#include "som.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return bfd_som_attach_aux_hdr (NULL, 0, NULL);
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
gdb_cv_var_som=yes
|
||||||
|
else
|
||||||
|
gdb_cv_var_som=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_var_som" >&5
|
||||||
|
$as_echo "$gdb_cv_var_som" >&6; }
|
||||||
|
CFLAGS=$OLD_CFLAGS
|
||||||
|
LDFLAGS=$OLD_LDFLAGS
|
||||||
|
LIBS=$OLD_LIBS
|
||||||
|
if test $gdb_cv_var_som = yes; then
|
||||||
|
CONFIG_OBS="$CONFIG_OBS somread.o"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add any host-specific objects to GDB.
|
# Add any host-specific objects to GDB.
|
||||||
CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
|
CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
|
||||||
|
|
||||||
|
|
|
@ -2034,6 +2034,13 @@ if test $gdb_cv_var_macho = yes; then
|
||||||
CONFIG_OBS="$CONFIG_OBS machoread.o"
|
CONFIG_OBS="$CONFIG_OBS machoread.o"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add SOM support to GDB, but only if BFD includes it.
|
||||||
|
GDB_AC_CHECK_BFD([for SOM support in BFD], gdb_cv_var_som,
|
||||||
|
[bfd_som_attach_aux_hdr (NULL, 0, NULL)], som.h)
|
||||||
|
if test $gdb_cv_var_som = yes; then
|
||||||
|
CONFIG_OBS="$CONFIG_OBS somread.o"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add any host-specific objects to GDB.
|
# Add any host-specific objects to GDB.
|
||||||
CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
|
CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include <syms.h>
|
#include "som/aout.h"
|
||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "symfile.h"
|
#include "symfile.h"
|
||||||
#include "objfiles.h"
|
#include "objfiles.h"
|
||||||
|
@ -51,9 +51,9 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
int val, dynamic;
|
int val, dynamic;
|
||||||
char *stringtab;
|
char *stringtab;
|
||||||
asection *shlib_info;
|
asection *shlib_info;
|
||||||
struct symbol_dictionary_record *buf, *bufp, *endbufp;
|
struct som_external_symbol_dictionary_record *buf, *bufp, *endbufp;
|
||||||
char *symname;
|
char *symname;
|
||||||
CONST int symsize = sizeof (struct symbol_dictionary_record);
|
CONST int symsize = sizeof (struct som_external_symbol_dictionary_record);
|
||||||
CORE_ADDR text_offset, data_offset;
|
CORE_ADDR text_offset, data_offset;
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,14 +100,20 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
for (bufp = buf; bufp < endbufp; ++bufp)
|
for (bufp = buf; bufp < endbufp; ++bufp)
|
||||||
{
|
{
|
||||||
enum minimal_symbol_type ms_type;
|
enum minimal_symbol_type ms_type;
|
||||||
|
unsigned int flags = bfd_getb32 (bufp->flags);
|
||||||
|
unsigned int symbol_type
|
||||||
|
= (flags >> SOM_SYMBOL_TYPE_SH) & SOM_SYMBOL_TYPE_MASK;
|
||||||
|
unsigned int symbol_scope
|
||||||
|
= (flags >> SOM_SYMBOL_SCOPE_SH) & SOM_SYMBOL_SCOPE_MASK;
|
||||||
|
CORE_ADDR symbol_value = bfd_getb32 (bufp->symbol_value);
|
||||||
|
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
switch (bufp->symbol_scope)
|
switch (symbol_scope)
|
||||||
{
|
{
|
||||||
case SS_UNIVERSAL:
|
case SS_UNIVERSAL:
|
||||||
case SS_EXTERNAL:
|
case SS_EXTERNAL:
|
||||||
switch (bufp->symbol_type)
|
switch (symbol_type)
|
||||||
{
|
{
|
||||||
case ST_SYM_EXT:
|
case ST_SYM_EXT:
|
||||||
case ST_ARG_EXT:
|
case ST_ARG_EXT:
|
||||||
|
@ -117,15 +123,14 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
case ST_PRI_PROG:
|
case ST_PRI_PROG:
|
||||||
case ST_SEC_PROG:
|
case ST_SEC_PROG:
|
||||||
case ST_MILLICODE:
|
case ST_MILLICODE:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
ms_type = mst_text;
|
ms_type = mst_text;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_ENTRY:
|
case ST_ENTRY:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
/* For a dynamic executable, ST_ENTRY symbols are
|
/* For a dynamic executable, ST_ENTRY symbols are
|
||||||
the stubs, while the ST_CODE symbol is the real
|
the stubs, while the ST_CODE symbol is the real
|
||||||
function. */
|
function. */
|
||||||
|
@ -133,22 +138,20 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
ms_type = mst_solib_trampoline;
|
ms_type = mst_solib_trampoline;
|
||||||
else
|
else
|
||||||
ms_type = mst_text;
|
ms_type = mst_text;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_STUB:
|
case ST_STUB:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
ms_type = mst_solib_trampoline;
|
ms_type = mst_solib_trampoline;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_DATA:
|
case ST_DATA:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
bufp->symbol_value += data_offset;
|
symbol_value += data_offset;
|
||||||
ms_type = mst_data;
|
ms_type = mst_data;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -161,18 +164,17 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
case SS_GLOBAL:
|
case SS_GLOBAL:
|
||||||
#endif
|
#endif
|
||||||
case SS_LOCAL:
|
case SS_LOCAL:
|
||||||
switch (bufp->symbol_type)
|
switch (symbol_type)
|
||||||
{
|
{
|
||||||
case ST_SYM_EXT:
|
case ST_SYM_EXT:
|
||||||
case ST_ARG_EXT:
|
case ST_ARG_EXT:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case ST_CODE:
|
case ST_CODE:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
ms_type = mst_file_text;
|
ms_type = mst_file_text;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
|
|
||||||
check_strange_names:
|
check_strange_names:
|
||||||
/* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local
|
/* Utah GCC 2.5, FSF GCC 2.6 and later generate correct local
|
||||||
|
@ -200,37 +202,34 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
case ST_PRI_PROG:
|
case ST_PRI_PROG:
|
||||||
case ST_SEC_PROG:
|
case ST_SEC_PROG:
|
||||||
case ST_MILLICODE:
|
case ST_MILLICODE:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
ms_type = mst_file_text;
|
ms_type = mst_file_text;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_ENTRY:
|
case ST_ENTRY:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
/* SS_LOCAL symbols in a shared library do not have
|
/* SS_LOCAL symbols in a shared library do not have
|
||||||
export stubs, so we do not have to worry about
|
export stubs, so we do not have to worry about
|
||||||
using mst_file_text vs mst_solib_trampoline here like
|
using mst_file_text vs mst_solib_trampoline here like
|
||||||
we do for SS_UNIVERSAL and SS_EXTERNAL symbols above. */
|
we do for SS_UNIVERSAL and SS_EXTERNAL symbols above. */
|
||||||
ms_type = mst_file_text;
|
ms_type = mst_file_text;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ST_STUB:
|
case ST_STUB:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
ms_type = mst_solib_trampoline;
|
ms_type = mst_solib_trampoline;
|
||||||
bufp->symbol_value += text_offset;
|
symbol_value += text_offset;
|
||||||
bufp->symbol_value = gdbarch_addr_bits_remove
|
symbol_value = gdbarch_addr_bits_remove (gdbarch, symbol_value);
|
||||||
(gdbarch, bufp->symbol_value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ST_DATA:
|
case ST_DATA:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
bufp->symbol_value += data_offset;
|
symbol_value += data_offset;
|
||||||
ms_type = mst_file_data;
|
ms_type = mst_file_data;
|
||||||
goto check_strange_names;
|
goto check_strange_names;
|
||||||
|
|
||||||
|
@ -246,12 +245,12 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
This also happens for weak symbols, but their type is
|
This also happens for weak symbols, but their type is
|
||||||
ST_DATA. */
|
ST_DATA. */
|
||||||
case SS_UNSAT:
|
case SS_UNSAT:
|
||||||
switch (bufp->symbol_type)
|
switch (symbol_type)
|
||||||
{
|
{
|
||||||
case ST_STORAGE:
|
case ST_STORAGE:
|
||||||
case ST_DATA:
|
case ST_DATA:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bfd_getb32 (bufp->name) + stringtab;
|
||||||
bufp->symbol_value += data_offset;
|
symbol_value += data_offset;
|
||||||
ms_type = mst_data;
|
ms_type = mst_data;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -264,12 +263,11 @@ som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufp->name.n_strx > obj_som_stringtab_size (abfd))
|
if (bfd_getb32 (bufp->name) > obj_som_stringtab_size (abfd))
|
||||||
error (_("Invalid symbol data; bad HP string table offset: %d"),
|
error (_("Invalid symbol data; bad HP string table offset: %s"),
|
||||||
bufp->name.n_strx);
|
plongest (bfd_getb32 (bufp->name)));
|
||||||
|
|
||||||
prim_record_minimal_symbol (symname, bufp->symbol_value, ms_type,
|
prim_record_minimal_symbol (symname, symbol_value, ms_type, objfile);
|
||||||
objfile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,6 +424,8 @@ static const struct sym_fns som_sym_fns =
|
||||||
&psym_functions
|
&psym_functions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
initialize_file_ftype _initialize_somread;
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_somread (void)
|
_initialize_somread (void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue