2012-03-05 19:41:51 +08:00
|
|
|
/* Target-dependent code for OpenVMS IA-64.
|
|
|
|
|
2018-01-01 12:43:02 +08:00
|
|
|
Copyright (C) 2012-2018 Free Software Foundation, Inc.
|
2012-03-05 19:41:51 +08:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
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 3 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, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "frame-unwind.h"
|
|
|
|
#include "ia64-tdep.h"
|
|
|
|
#include "osabi.h"
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
#include "gdbcore.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBUNWIND_IA64_H
|
|
|
|
|
|
|
|
/* Libunwind callback accessor function to acquire procedure unwind-info. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
ia64_vms_find_proc_info_x (unw_addr_space_t as, unw_word_t ip,
|
|
|
|
unw_proc_info_t *pi,
|
|
|
|
int need_unwind_info, void *arg)
|
|
|
|
{
|
* gdbarch.sh (target_gdbarch): Remove macro.
(get_target_gdbarch): Rename to target_gdbarch.
* gdbarch.c, gdbarch.h: Rebuild.
* ada-tasks.c, aix-thread.c, amd64-linux-nat.c, arch-utils.c,
arm-tdep.c, auxv.c, breakpoint.c, bsd-uthread.c, corefile.c,
darwin-nat-info.c, dcache.c, dsrec.c, exec.c, fbsd-nat.c,
filesystem.c, gcore.c, gnu-nat.c, i386-darwin-nat.c, i386-nat.c,
ia64-vms-tdep.c, inf-ptrace.c, infcmd.c, jit.c, linux-nat.c,
linux-tdep.c, linux-thread-db.c, m32r-rom.c, memattr.c,
mep-tdep.c, microblaze-tdep.c, mips-linux-nat.c,
mips-linux-tdep.c, mips-tdep.c, monitor.c, moxie-tdep.c,
nto-procfs.c, nto-tdep.c, ppc-linux-nat.c, proc-service.c,
procfs.c, progspace.c, ravenscar-thread.c, record.c,
remote-m32r-sdi.c, remote-mips.c, remote-sim.c, remote.c,
rl78-tdep.c, rs6000-nat.c, rx-tdep.c, s390-nat.c, sol-thread.c,
solib-darwin.c, solib-dsbt.c, solib-frv.c, solib-ia64-hpux.c,
solib-irix.c, solib-pa64.c, solib-som.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, solib.c, spu-linux-nat.c,
spu-multiarch.c, spu-tdep.c, symfile-mem.c, symfile.c, symtab.c,
target-descriptions.c, target.c, target.h, tracepoint.c,
windows-nat.c, windows-tdep.c, xcoffsolib.c, cli/cli-dump.c,
common/agent.c, mi/mi-interp.c, python/py-finishbreakpoint.c,
python/py-inferior.c, python/python.c: Update.
2012-11-10 03:58:03 +08:00
|
|
|
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
|
2012-03-05 19:41:51 +08:00
|
|
|
gdb_byte buf[32];
|
|
|
|
const char *annex = core_addr_to_string (ip);
|
|
|
|
LONGEST res;
|
|
|
|
CORE_ADDR table_addr;
|
|
|
|
unsigned int info_len;
|
|
|
|
|
target_stack -> current_top_target() throughout
The recent C++ification of target_ops replaced references to the old
"current_target" squashed target throughout with references to a
"target_stack" pointer. I had picked the "target_stack" name very
early in the multi-target work, and managed to stick with it, even
though it's a bit of a misnomer, since it isn't really a "target
stack" object, but a pointer into the current top target in the stack.
As I'm splitting more pieces off of the multi-target branch, I've come
to think that it's better to rename it now. A following patch will
introduce a new class to represent a target stack, and "target_stack"
would be _its_ ideal name. (In the branch, the class is called
a_target_stack to work around the clash.)
Thus this commit renames target_stack to current_top_target and
replaces all references throughout. Also, while at it,
current_top_target is made a function instead of a pointer, to make it
possible to change its internal implementation without leaking
implementation details out. In a couple patches, the implementation
of the function will change to refer to a target stack object, and
then further down the multi-target work, it'll change again to find
the right target stack for the current inferior.
gdb/ChangeLog:
2018-06-07 Pedro Alves <palves@redhat.com>
* target.h (target_stack): Delete.
(current_top_target): Declare function.
* target.c (target_stack): Delete.
(g_current_top_target): New.
(current_top_target): New function.
* auxv.c: Use current_top_target instead of target_stack
throughout.
* avr-tdep.c: Likewise.
* breakpoint.c: Likewise.
* corefile.c: Likewise.
* elfread.c: Likewise.
* eval.c: Likewise.
* exceptions.c: Likewise.
* frame.c: Likewise.
* gdbarch-selftests.c: Likewise.
* gnu-v3-abi.c: Likewise.
* ia64-tdep.c: Likewise.
* ia64-vms-tdep.c: Likewise.
* infcall.c: Likewise.
* infcmd.c: Likewise.
* infrun.c: Likewise.
* linespec.c: Likewise.
* linux-tdep.c: Likewise.
* minsyms.c: Likewise.
* ppc-linux-nat.c: Likewise.
* ppc-linux-tdep.c: Likewise.
* procfs.c: Likewise.
* regcache.c: Likewise.
* remote.c: Likewise.
* rs6000-tdep.c: Likewise.
* s390-linux-nat.c: Likewise.
* s390-tdep.c: Likewise.
* solib-aix.c: Likewise.
* solib-darwin.c: Likewise.
* solib-dsbt.c: Likewise.
* solib-spu.c: Likewise.
* solib-svr4.c: Likewise.
* solib-target.c: Likewise.
* sparc-tdep.c: Likewise.
* sparc64-tdep.c: Likewise.
* spu-tdep.c: Likewise.
* symfile.c: Likewise.
* symtab.c: Likewise.
* target-descriptions.c: Likewise.
* target-memory.c: Likewise.
* target.c: Likewise.
* target.h: Likewise.
* tracefile-tfile.c: Likewise.
* tracepoint.c: Likewise.
* valops.c: Likewise.
* valprint.c: Likewise.
* value.c: Likewise.
* windows-tdep.c: Likewise.
* mi/mi-main.c: Likewise.
2018-06-08 00:27:46 +08:00
|
|
|
res = target_read (current_top_target (), TARGET_OBJECT_OPENVMS_UIB,
|
2012-03-05 19:41:51 +08:00
|
|
|
annex + 2, buf, 0, sizeof (buf));
|
|
|
|
|
|
|
|
if (res != sizeof (buf))
|
|
|
|
return -UNW_ENOINFO;
|
|
|
|
|
|
|
|
pi->format = UNW_INFO_FORMAT_REMOTE_TABLE;
|
|
|
|
pi->start_ip = extract_unsigned_integer (buf + 0, 8, byte_order);
|
|
|
|
pi->end_ip = extract_unsigned_integer (buf + 8, 8, byte_order);
|
|
|
|
pi->gp = extract_unsigned_integer (buf + 24, 8, byte_order);
|
|
|
|
table_addr = extract_unsigned_integer (buf + 16, 8, byte_order);
|
|
|
|
|
|
|
|
if (table_addr == 0)
|
|
|
|
{
|
|
|
|
/* No unwind data. */
|
|
|
|
pi->unwind_info = NULL;
|
|
|
|
pi->unwind_info_size = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = target_read_memory (table_addr, buf, 8);
|
|
|
|
if (res != 0)
|
|
|
|
return -UNW_ENOINFO;
|
|
|
|
|
|
|
|
/* Check version. */
|
|
|
|
if (extract_unsigned_integer (buf + 6, 2, byte_order) != 1)
|
|
|
|
return -UNW_EBADVERSION;
|
|
|
|
info_len = extract_unsigned_integer (buf + 0, 4, byte_order);
|
|
|
|
pi->unwind_info_size = 8 * info_len;
|
|
|
|
|
|
|
|
/* Read info. */
|
|
|
|
pi->unwind_info = xmalloc (pi->unwind_info_size);
|
|
|
|
|
|
|
|
res = target_read_memory (table_addr + 8,
|
Fix compilation error in ia64-vms-tdep.c with libunwind-ia64
I found this when doing a --enable-targets=all build with libunwind-ia64
properly configured.
CXX ia64-vms-tdep.o
/home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c: In function ‘int ia64_vms_find_proc_info_x(unw_addr_space_t, unw_word_t, unw_proc_info_t*, int, void*)’:
/home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:79:33: error: invalid conversion from ‘void*’ to ‘gdb_byte* {aka unsigned char*}’ [-fpermissive]
pi->unwind_info, pi->unwind_info_size);
^
In file included from /home/emaisin/src/binutils-gdb/gdb/target.h:70:0,
from /home/emaisin/src/binutils-gdb/gdb/exec.h:23,
from /home/emaisin/src/binutils-gdb/gdb/gdbcore.h:29,
from /home/emaisin/src/binutils-gdb/gdb/ia64-vms-tdep.c:25:
/home/emaisin/src/binutils-gdb/gdb/target/target.h:35:12: note: initializing argument 2 of ‘int target_read_memory(CORE_ADDR, gdb_byte*, ssize_t)’
extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
^
gdb/ChangeLog:
* ia64-vms-tdep.c (ia64_vms_find_proc_info_x): Add cast.
2018-07-17 02:15:09 +08:00
|
|
|
(gdb_byte *) pi->unwind_info, pi->unwind_info_size);
|
2012-03-05 19:41:51 +08:00
|
|
|
if (res != 0)
|
|
|
|
{
|
|
|
|
xfree (pi->unwind_info);
|
|
|
|
pi->unwind_info = NULL;
|
|
|
|
return -UNW_ENOINFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Handle OSSD (OS Specific Data). This extension to ia64 unwind
|
|
|
|
information by OpenVMS is currently not handled by libunwind, but
|
|
|
|
looks to be used only in very specific context, and is not generated by
|
|
|
|
GCC. */
|
|
|
|
|
|
|
|
pi->lsda = table_addr + 8 + pi->unwind_info_size;
|
|
|
|
if (extract_unsigned_integer (buf + 4, 2, byte_order) & 3)
|
|
|
|
{
|
|
|
|
pi->lsda += 8;
|
|
|
|
/* There might be an handler, but this is not used for unwinding. */
|
|
|
|
pi->handler = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Libunwind callback accessor function for cleanup. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
ia64_vms_put_unwind_info (unw_addr_space_t as,
|
|
|
|
unw_proc_info_t *pip, void *arg)
|
|
|
|
{
|
|
|
|
/* Nothing required for now. */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Libunwind callback accessor function to get head of the dynamic
|
|
|
|
unwind-info registration list. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
ia64_vms_get_dyn_info_list (unw_addr_space_t as,
|
|
|
|
unw_word_t *dilap, void *arg)
|
|
|
|
{
|
|
|
|
return -UNW_ENOINFO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set of libunwind callback acccessor functions. */
|
|
|
|
static unw_accessors_t ia64_vms_unw_accessors;
|
|
|
|
static unw_accessors_t ia64_vms_unw_rse_accessors;
|
|
|
|
|
2012-03-09 03:08:11 +08:00
|
|
|
/* Set of ia64-libunwind-tdep gdb callbacks and data for generic
|
|
|
|
ia64-libunwind-tdep code to use. */
|
2012-03-05 19:41:51 +08:00
|
|
|
static struct libunwind_descr ia64_vms_libunwind_descr;
|
|
|
|
|
|
|
|
#endif /* HAVE_LIBUNWIND_IA64_H */
|
|
|
|
|
|
|
|
static void
|
|
|
|
ia64_openvms_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|
|
|
{
|
|
|
|
set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBUNWIND_IA64_H
|
|
|
|
/* Override the default descriptor. */
|
|
|
|
ia64_vms_unw_accessors = ia64_unw_accessors;
|
|
|
|
ia64_vms_unw_accessors.find_proc_info = ia64_vms_find_proc_info_x;
|
|
|
|
ia64_vms_unw_accessors.put_unwind_info = ia64_vms_put_unwind_info;
|
|
|
|
ia64_vms_unw_accessors.get_dyn_info_list_addr = ia64_vms_get_dyn_info_list;
|
|
|
|
|
|
|
|
ia64_vms_unw_rse_accessors = ia64_unw_rse_accessors;
|
|
|
|
ia64_vms_unw_rse_accessors.find_proc_info = ia64_vms_find_proc_info_x;
|
|
|
|
ia64_vms_unw_rse_accessors.put_unwind_info = ia64_vms_put_unwind_info;
|
|
|
|
ia64_vms_unw_rse_accessors.get_dyn_info_list_addr = ia64_vms_get_dyn_info_list;
|
|
|
|
|
|
|
|
ia64_vms_libunwind_descr = ia64_libunwind_descr;
|
|
|
|
ia64_vms_libunwind_descr.accessors = &ia64_vms_unw_accessors;
|
|
|
|
ia64_vms_libunwind_descr.special_accessors = &ia64_vms_unw_rse_accessors;
|
|
|
|
|
|
|
|
libunwind_frame_set_descr (gdbarch, &ia64_vms_libunwind_descr);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-03-05 22:53:56 +08:00
|
|
|
_initialize_ia64_vms_tdep (void)
|
2012-03-05 19:41:51 +08:00
|
|
|
{
|
|
|
|
gdbarch_register_osabi (bfd_arch_ia64, 0, GDB_OSABI_OPENVMS,
|
|
|
|
ia64_openvms_init_abi);
|
|
|
|
}
|