diff --git a/gdb/amd64-windows-nat.c b/gdb/amd64-windows-nat.c new file mode 100644 index 0000000..88815a9 --- /dev/null +++ b/gdb/amd64-windows-nat.c @@ -0,0 +1,92 @@ +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. + + 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 . */ + +#include "defs.h" +#include "win32-nat.h" + +#include + +#define context_offset(x) (offsetof (CONTEXT, x)) +static const int mappings[] = +{ + context_offset (Rax), + context_offset (Rbx), + context_offset (Rcx), + context_offset (Rdx), + context_offset (Rsi), + context_offset (Rdi), + context_offset (Rbp), + context_offset (Rsp), + context_offset (R8), + context_offset (R9), + context_offset (R10), + context_offset (R11), + context_offset (R12), + context_offset (R13), + context_offset (R14), + context_offset (R15), + context_offset (Rip), + context_offset (EFlags), + context_offset (SegCs), + context_offset (SegSs), + context_offset (SegDs), + context_offset (SegEs), + context_offset (SegFs), + context_offset (SegGs), + context_offset (FloatSave.FloatRegisters[0]), + context_offset (FloatSave.FloatRegisters[1]), + context_offset (FloatSave.FloatRegisters[2]), + context_offset (FloatSave.FloatRegisters[3]), + context_offset (FloatSave.FloatRegisters[4]), + context_offset (FloatSave.FloatRegisters[5]), + context_offset (FloatSave.FloatRegisters[6]), + context_offset (FloatSave.FloatRegisters[7]), + context_offset (FloatSave.ControlWord), + context_offset (FloatSave.StatusWord), + context_offset (FloatSave.TagWord), + context_offset (FloatSave.ErrorSelector), + context_offset (FloatSave.ErrorOffset), + context_offset (FloatSave.DataSelector), + context_offset (FloatSave.DataOffset), + context_offset (FloatSave.ErrorSelector) + /* XMM0-7 */ , + context_offset (Xmm0), + context_offset (Xmm1), + context_offset (Xmm2), + context_offset (Xmm3), + context_offset (Xmm4), + context_offset (Xmm5), + context_offset (Xmm6), + context_offset (Xmm7), + context_offset (Xmm8), + context_offset (Xmm9), + context_offset (Xmm10), + context_offset (Xmm11), + context_offset (Xmm12), + context_offset (Xmm13), + context_offset (Xmm14), + context_offset (Xmm15), + /* MXCSR */ + context_offset (FloatSave.MxCsr) +}; +#undef context_offset + +void +_initialize_amd64_windows_nat (void) +{ + win32_set_context_register_offsets (mappings); +} diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c new file mode 100644 index 0000000..fc224a8 --- /dev/null +++ b/gdb/amd64-windows-tdep.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2009 Free Software Foundation, Inc. + + 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 . */ + +#include "defs.h" +#include "osabi.h" +#include "amd64-tdep.h" +#include "solib.h" +#include "solib-target.h" + +static void +amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + amd64_init_abi (info, gdbarch); + + /* On Windows, "long"s are only 32bit. */ + set_gdbarch_long_bit (gdbarch, 32); + + set_solib_ops (gdbarch, &solib_target_so_ops); +} + +void +_initialize_amd64_windows_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_CYGWIN, + amd64_windows_init_abi); +} + diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 41c4933..c1ea9da 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -495,8 +495,8 @@ gdbarch_update_p (struct gdbarch_info info) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " - "Architecture 0x%08lx (%s) unchanged\n", - (long) new_gdbarch, + "Architecture %s (%s) unchanged\n", + host_address_to_string (new_gdbarch), gdbarch_bfd_arch_info (new_gdbarch)->printable_name); return 1; } @@ -504,8 +504,8 @@ gdbarch_update_p (struct gdbarch_info info) /* It's a new architecture, swap it in. */ if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " - "New architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, + "New architecture %s (%s) selected\n", + host_address_to_string (new_gdbarch), gdbarch_bfd_arch_info (new_gdbarch)->printable_name); deprecated_current_gdbarch_select_hack (new_gdbarch); diff --git a/gdb/config.in b/gdb/config.in index bceba76..1badecf 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -175,6 +175,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `kill' function. */ +#undef HAVE_KILL + /* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES @@ -561,6 +564,9 @@ /* Define to 1 if you have the `_mcleanup' function. */ #undef HAVE__MCLEANUP +/* Define to 1 if host is LLP64 (pointers is 64bits and "long" is32bits) */ +#undef HOST_IS_LLP64 + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST diff --git a/gdb/config/i386/cygwin.mh b/gdb/config/i386/cygwin.mh index 36f6cc5..5d7f75f 100644 --- a/gdb/config/i386/cygwin.mh +++ b/gdb/config/i386/cygwin.mh @@ -1,4 +1,4 @@ MH_CFLAGS= -NATDEPFILES= i386-nat.o win32-nat.o +NATDEPFILES= i386-nat.o win32-nat.o i386-windows-nat.o NAT_FILE=nm-cygwin.h XM_CLIBS= diff --git a/gdb/config/i386/mingw.mh b/gdb/config/i386/mingw.mh index 36f6cc5..5d7f75f 100644 --- a/gdb/config/i386/mingw.mh +++ b/gdb/config/i386/mingw.mh @@ -1,4 +1,4 @@ MH_CFLAGS= -NATDEPFILES= i386-nat.o win32-nat.o +NATDEPFILES= i386-nat.o win32-nat.o i386-windows-nat.o NAT_FILE=nm-cygwin.h XM_CLIBS= diff --git a/gdb/config/i386/mingw64.mh b/gdb/config/i386/mingw64.mh new file mode 100644 index 0000000..6da61e5 --- /dev/null +++ b/gdb/config/i386/mingw64.mh @@ -0,0 +1,2 @@ +NATDEPFILES= i386-nat.o win32-nat.o amd64-windows-nat.o +NAT_FILE=nm-cygwin64.h diff --git a/gdb/config/i386/nm-cygwin64.h b/gdb/config/i386/nm-cygwin64.h new file mode 100644 index 0000000..71b2682 --- /dev/null +++ b/gdb/config/i386/nm-cygwin64.h @@ -0,0 +1,36 @@ +/* Copyright 2008, 2009 Free Software Foundation, Inc. + + 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 . */ + +#define ADD_SHARED_SYMBOL_FILES dll_symbol_command +void dll_symbol_command (char *, int); + +#define I386_USE_GENERIC_WATCHPOINTS + +#include "i386/nm-i386.h" + +/* Support for hardware-assisted breakpoints and watchpoints. */ + +#define I386_DR_LOW_SET_CONTROL(VAL) cygwin_set_dr7 (VAL) +extern void cygwin_set_dr7 (unsigned); + +#define I386_DR_LOW_SET_ADDR(N,ADDR) cygwin_set_dr (N,ADDR) +extern void cygwin_set_dr (int, CORE_ADDR); + +#define I386_DR_LOW_RESET_ADDR(N) + +#define I386_DR_LOW_GET_STATUS() cygwin_get_dr6 () +extern unsigned cygwin_get_dr6 (void); diff --git a/gdb/configure b/gdb/configure index bb2f7a5..22db7e8 100755 --- a/gdb/configure +++ b/gdb/configure @@ -15420,8 +15420,9 @@ fi + for ac_func in canonicalize_file_name realpath getrusage getuid \ - getgid poll pread64 sbrk setpgid setpgrp setsid \ + getgid kill poll pread64 sbrk setpgid setpgrp setsid \ sigaction sigprocmask sigsetmask socketpair syscall \ ttrace wborder setlocale do @@ -18370,6 +18371,64 @@ _ACEOF fi +# Check if the host is LLP64 (pointers are 64bits and "long" is only 32bits). + +echo "$as_me:$LINENO: checking host is LLP64" >&5 +echo $ECHO_N "checking host is LLP64... $ECHO_C" >&6 +if test "${gdb_cv_host_is_llp64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + gdb_cv_host_is_llp64=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +return !(sizeof (void *) == 8 && sizeof (long) == 4); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + gdb_cv_host_is_llp64=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +gdb_cv_host_is_llp64=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $gdb_cv_host_is_llp64" >&5 +echo "${ECHO_T}$gdb_cv_host_is_llp64" >&6 +if test $gdb_cv_host_is_llp64 = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HOST_IS_LLP64 1 +_ACEOF + +fi + # Check if the compiler and runtime support printing decfloats. echo "$as_me:$LINENO: checking for decfloat support in printf" >&5 diff --git a/gdb/configure.ac b/gdb/configure.ac index 4e0cf7d..8774309 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -774,7 +774,7 @@ AC_FUNC_ALLOCA AC_FUNC_MMAP AC_FUNC_VFORK AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \ - getgid poll pread64 sbrk setpgid setpgrp setsid \ + getgid kill poll pread64 sbrk setpgid setpgrp setsid \ sigaction sigprocmask sigsetmask socketpair syscall \ ttrace wborder setlocale]) @@ -1189,6 +1189,20 @@ if test $gdb_cv_printf_has_long_long = yes; then [Define to 1 if the "%ll" format works to print long longs.]) fi +# Check if the host is LLP64 (pointers are 64bits and "long" is only 32bits). + +AC_CACHE_CHECK([host is LLP64], + gdb_cv_host_is_llp64, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[return !(sizeof (void *) == 8 && sizeof (long) == 4);]])], + gdb_cv_host_is_llp64=yes, + gdb_cv_host_is_llp64=no, + gdb_cv_host_is_llp64=no)]) +if test $gdb_cv_host_is_llp64 = yes; then + AC_DEFINE(HOST_IS_LLP64, 1, + [Define to 1 if host is LLP64 (pointers is 64bits and "long" is32bits)]) +fi + # Check if the compiler and runtime support printing decfloats. AC_CACHE_CHECK([for decfloat support in printf], diff --git a/gdb/configure.host b/gdb/configure.host index b9ed7ae..1d6218f 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -171,7 +171,9 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu) gdb_host=nbsd64 ;; x86_64-*-openbsd*) gdb_host=obsd64 ;; - +x86_64-*-mingw*) gdb_host=mingw64 + gdb_host_obs=mingw-hdep.o + ;; m32r*-*-linux*) gdb_host=linux ;; xtensa*-*-linux*) gdb_host=linux ;; diff --git a/gdb/configure.tgt b/gdb/configure.tgt index b9cd21b..f5a4357 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -201,13 +201,13 @@ i[34567]86-*-gnu*) i[34567]86-*-cygwin*) # Target: Intel 386 running win32 gdb_target_obs="i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \ - solib-target.o corelow.o" + solib-target.o corelow.o win32-tdep.o" build_gdbserver=yes ;; i[34567]86-*-mingw32*) # Target: Intel 386 running win32 gdb_target_obs="i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \ - solib-target.o corelow.o" + solib-target.o corelow.o win32-tdep.o" build_gdbserver=yes ;; i[34567]86-*-*) @@ -522,6 +522,12 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ bsd-uthread.o corelow.o solib.o solib-svr4.o" ;; +x86_64-*-mingw*) + # Target: MingW/amd64 + gdb_target_obs="amd64-tdep.o amd64-windows-tdep.o \ + i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \ + solib-target.o win32-tdep.o" + ;; x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu) # Target: NetBSD/amd64 gdb_target_obs="amd64-tdep.o amd64nbsd-tdep.o i386-tdep.o i387-tdep.o \ diff --git a/gdb/defs.h b/gdb/defs.h index 4465676..a500fd6 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -132,6 +132,17 @@ typedef bfd_vma CORE_ADDR; #endif /* ! LONGEST */ +/* Define an integer type that has the same size as a pointer type. + It is sometimes necessary to cast a pointer to an integer type + (for instance to perform bitwise operations on it), and we need + to use an integer type that has the same size as the pointer + to prevent an error message from GCC. */ +#ifdef HOST_IS_LLP64 +typedef long long ptr_int_t; +#else +typedef long ptr_int_t; +#endif + #ifndef min #define min(a, b) ((a) < (b) ? (a) : (b)) #endif diff --git a/gdb/event-top.c b/gdb/event-top.c index 5483608..dd223e1 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -50,6 +50,14 @@ static void change_line_handler (void); static void change_annotation_level (void); static void command_handler (char *command); +#if defined (SIGHUP) && !defined (HAVE_KILL) +/* On x86_64-windows, MingW's signal.h defines SIGHUP but does not + provide "kill". However, the code that uses SIGHUP below also + uses kill. So, if kill is not available, pretend SIGHUP isn't + either. */ +#undef SIGHUP +#endif + /* Signal handlers. */ #ifdef SIGQUIT static void handle_sigquit (int sig); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index dd6ad7f..c328a2b 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -652,35 +652,35 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: addr_bit = %s\n", plongest (gdbarch->addr_bit)); fprintf_unfiltered (file, - "gdbarch_dump: addr_bits_remove = <0x%lx>\n", - (long) gdbarch->addr_bits_remove); + "gdbarch_dump: addr_bits_remove = <%s>\n", + host_address_to_string (gdbarch->addr_bits_remove)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_address_class_name_to_type_flags_p() = %d\n", gdbarch_address_class_name_to_type_flags_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: address_class_name_to_type_flags = <0x%lx>\n", - (long) gdbarch->address_class_name_to_type_flags); + "gdbarch_dump: address_class_name_to_type_flags = <%s>\n", + host_address_to_string (gdbarch->address_class_name_to_type_flags)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_address_class_type_flags_p() = %d\n", gdbarch_address_class_type_flags_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: address_class_type_flags = <0x%lx>\n", - (long) gdbarch->address_class_type_flags); + "gdbarch_dump: address_class_type_flags = <%s>\n", + host_address_to_string (gdbarch->address_class_type_flags)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_address_class_type_flags_to_name_p() = %d\n", gdbarch_address_class_type_flags_to_name_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n", - (long) gdbarch->address_class_type_flags_to_name); + "gdbarch_dump: address_class_type_flags_to_name = <%s>\n", + host_address_to_string (gdbarch->address_class_type_flags_to_name)); fprintf_unfiltered (file, - "gdbarch_dump: address_to_pointer = <0x%lx>\n", - (long) gdbarch->address_to_pointer); + "gdbarch_dump: address_to_pointer = <%s>\n", + host_address_to_string (gdbarch->address_to_pointer)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_adjust_breakpoint_address_p() = %d\n", gdbarch_adjust_breakpoint_address_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: adjust_breakpoint_address = <0x%lx>\n", - (long) gdbarch->adjust_breakpoint_address); + "gdbarch_dump: adjust_breakpoint_address = <%s>\n", + host_address_to_string (gdbarch->adjust_breakpoint_address)); fprintf_unfiltered (file, "gdbarch_dump: believe_pcc_promotion = %s\n", plongest (gdbarch->believe_pcc_promotion)); @@ -691,8 +691,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: bits_big_endian = %s\n", plongest (gdbarch->bits_big_endian)); fprintf_unfiltered (file, - "gdbarch_dump: breakpoint_from_pc = <0x%lx>\n", - (long) gdbarch->breakpoint_from_pc); + "gdbarch_dump: breakpoint_from_pc = <%s>\n", + host_address_to_string (gdbarch->breakpoint_from_pc)); fprintf_unfiltered (file, "gdbarch_dump: byte_order = %s\n", plongest (gdbarch->byte_order)); @@ -703,35 +703,35 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: call_dummy_location = %s\n", plongest (gdbarch->call_dummy_location)); fprintf_unfiltered (file, - "gdbarch_dump: cannot_fetch_register = <0x%lx>\n", - (long) gdbarch->cannot_fetch_register); + "gdbarch_dump: cannot_fetch_register = <%s>\n", + host_address_to_string (gdbarch->cannot_fetch_register)); fprintf_unfiltered (file, "gdbarch_dump: cannot_step_breakpoint = %s\n", plongest (gdbarch->cannot_step_breakpoint)); fprintf_unfiltered (file, - "gdbarch_dump: cannot_store_register = <0x%lx>\n", - (long) gdbarch->cannot_store_register); + "gdbarch_dump: cannot_store_register = <%s>\n", + host_address_to_string (gdbarch->cannot_store_register)); fprintf_unfiltered (file, "gdbarch_dump: char_signed = %s\n", plongest (gdbarch->char_signed)); fprintf_unfiltered (file, - "gdbarch_dump: coff_make_msymbol_special = <0x%lx>\n", - (long) gdbarch->coff_make_msymbol_special); + "gdbarch_dump: coff_make_msymbol_special = <%s>\n", + host_address_to_string (gdbarch->coff_make_msymbol_special)); fprintf_unfiltered (file, - "gdbarch_dump: construct_inferior_arguments = <0x%lx>\n", - (long) gdbarch->construct_inferior_arguments); + "gdbarch_dump: construct_inferior_arguments = <%s>\n", + host_address_to_string (gdbarch->construct_inferior_arguments)); fprintf_unfiltered (file, - "gdbarch_dump: convert_from_func_ptr_addr = <0x%lx>\n", - (long) gdbarch->convert_from_func_ptr_addr); + "gdbarch_dump: convert_from_func_ptr_addr = <%s>\n", + host_address_to_string (gdbarch->convert_from_func_ptr_addr)); fprintf_unfiltered (file, - "gdbarch_dump: convert_register_p = <0x%lx>\n", - (long) gdbarch->convert_register_p); + "gdbarch_dump: convert_register_p = <%s>\n", + host_address_to_string (gdbarch->convert_register_p)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_core_read_description_p() = %d\n", gdbarch_core_read_description_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: core_read_description = <0x%lx>\n", - (long) gdbarch->core_read_description); + "gdbarch_dump: core_read_description = <%s>\n", + host_address_to_string (gdbarch->core_read_description)); fprintf_unfiltered (file, "gdbarch_dump: core_regset_sections = %s\n", host_address_to_string (gdbarch->core_regset_sections)); @@ -739,8 +739,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n", gdbarch_core_xfer_shared_libraries_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: core_xfer_shared_libraries = <0x%lx>\n", - (long) gdbarch->core_xfer_shared_libraries); + "gdbarch_dump: core_xfer_shared_libraries = <%s>\n", + host_address_to_string (gdbarch->core_xfer_shared_libraries)); fprintf_unfiltered (file, "gdbarch_dump: decr_pc_after_break = %s\n", core_addr_to_string_nz (gdbarch->decr_pc_after_break)); @@ -754,20 +754,20 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_displaced_step_copy_insn_p() = %d\n", gdbarch_displaced_step_copy_insn_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: displaced_step_copy_insn = <0x%lx>\n", - (long) gdbarch->displaced_step_copy_insn); + "gdbarch_dump: displaced_step_copy_insn = <%s>\n", + host_address_to_string (gdbarch->displaced_step_copy_insn)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_displaced_step_fixup_p() = %d\n", gdbarch_displaced_step_fixup_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: displaced_step_fixup = <0x%lx>\n", - (long) gdbarch->displaced_step_fixup); + "gdbarch_dump: displaced_step_fixup = <%s>\n", + host_address_to_string (gdbarch->displaced_step_fixup)); fprintf_unfiltered (file, - "gdbarch_dump: displaced_step_free_closure = <0x%lx>\n", - (long) gdbarch->displaced_step_free_closure); + "gdbarch_dump: displaced_step_free_closure = <%s>\n", + host_address_to_string (gdbarch->displaced_step_free_closure)); fprintf_unfiltered (file, - "gdbarch_dump: displaced_step_location = <0x%lx>\n", - (long) gdbarch->displaced_step_location); + "gdbarch_dump: displaced_step_location = <%s>\n", + host_address_to_string (gdbarch->displaced_step_location)); fprintf_unfiltered (file, "gdbarch_dump: double_bit = %s\n", plongest (gdbarch->double_bit)); @@ -778,29 +778,29 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_dummy_id_p() = %d\n", gdbarch_dummy_id_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: dummy_id = <0x%lx>\n", - (long) gdbarch->dummy_id); + "gdbarch_dump: dummy_id = <%s>\n", + host_address_to_string (gdbarch->dummy_id)); fprintf_unfiltered (file, - "gdbarch_dump: dwarf2_reg_to_regnum = <0x%lx>\n", - (long) gdbarch->dwarf2_reg_to_regnum); + "gdbarch_dump: dwarf2_reg_to_regnum = <%s>\n", + host_address_to_string (gdbarch->dwarf2_reg_to_regnum)); fprintf_unfiltered (file, - "gdbarch_dump: ecoff_reg_to_regnum = <0x%lx>\n", - (long) gdbarch->ecoff_reg_to_regnum); + "gdbarch_dump: ecoff_reg_to_regnum = <%s>\n", + host_address_to_string (gdbarch->ecoff_reg_to_regnum)); fprintf_unfiltered (file, - "gdbarch_dump: elf_make_msymbol_special = <0x%lx>\n", - (long) gdbarch->elf_make_msymbol_special); + "gdbarch_dump: elf_make_msymbol_special = <%s>\n", + host_address_to_string (gdbarch->elf_make_msymbol_special)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_fetch_pointer_argument_p() = %d\n", gdbarch_fetch_pointer_argument_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: fetch_pointer_argument = <0x%lx>\n", - (long) gdbarch->fetch_pointer_argument); + "gdbarch_dump: fetch_pointer_argument = <%s>\n", + host_address_to_string (gdbarch->fetch_pointer_argument)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_fetch_tls_load_module_address_p() = %d\n", gdbarch_fetch_tls_load_module_address_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: fetch_tls_load_module_address = <0x%lx>\n", - (long) gdbarch->fetch_tls_load_module_address); + "gdbarch_dump: fetch_tls_load_module_address = <%s>\n", + host_address_to_string (gdbarch->fetch_tls_load_module_address)); fprintf_unfiltered (file, "gdbarch_dump: float_bit = %s\n", plongest (gdbarch->float_bit)); @@ -814,8 +814,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_frame_align_p() = %d\n", gdbarch_frame_align_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: frame_align = <0x%lx>\n", - (long) gdbarch->frame_align); + "gdbarch_dump: frame_align = <%s>\n", + host_address_to_string (gdbarch->frame_align)); fprintf_unfiltered (file, "gdbarch_dump: frame_args_skip = %s\n", core_addr_to_string_nz (gdbarch->frame_args_skip)); @@ -823,8 +823,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_frame_num_args_p() = %d\n", gdbarch_frame_num_args_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: frame_num_args = <0x%lx>\n", - (long) gdbarch->frame_num_args); + "gdbarch_dump: frame_num_args = <%s>\n", + host_address_to_string (gdbarch->frame_num_args)); fprintf_unfiltered (file, "gdbarch_dump: frame_red_zone_size = %s\n", plongest (gdbarch->frame_red_zone_size)); @@ -832,8 +832,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_get_longjmp_target_p() = %d\n", gdbarch_get_longjmp_target_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: get_longjmp_target = <0x%lx>\n", - (long) gdbarch->get_longjmp_target); + "gdbarch_dump: get_longjmp_target = <%s>\n", + host_address_to_string (gdbarch->get_longjmp_target)); fprintf_unfiltered (file, "gdbarch_dump: has_global_solist = %s\n", plongest (gdbarch->has_global_solist)); @@ -841,14 +841,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: have_nonsteppable_watchpoint = %s\n", plongest (gdbarch->have_nonsteppable_watchpoint)); fprintf_unfiltered (file, - "gdbarch_dump: in_function_epilogue_p = <0x%lx>\n", - (long) gdbarch->in_function_epilogue_p); + "gdbarch_dump: in_function_epilogue_p = <%s>\n", + host_address_to_string (gdbarch->in_function_epilogue_p)); fprintf_unfiltered (file, - "gdbarch_dump: in_solib_return_trampoline = <0x%lx>\n", - (long) gdbarch->in_solib_return_trampoline); + "gdbarch_dump: in_solib_return_trampoline = <%s>\n", + host_address_to_string (gdbarch->in_solib_return_trampoline)); fprintf_unfiltered (file, - "gdbarch_dump: inner_than = <0x%lx>\n", - (long) gdbarch->inner_than); + "gdbarch_dump: inner_than = <%s>\n", + host_address_to_string (gdbarch->inner_than)); fprintf_unfiltered (file, "gdbarch_dump: int_bit = %s\n", plongest (gdbarch->int_bit)); @@ -856,8 +856,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_integer_to_address_p() = %d\n", gdbarch_integer_to_address_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: integer_to_address = <0x%lx>\n", - (long) gdbarch->integer_to_address); + "gdbarch_dump: integer_to_address = <%s>\n", + host_address_to_string (gdbarch->integer_to_address)); fprintf_unfiltered (file, "gdbarch_dump: long_bit = %s\n", plongest (gdbarch->long_bit)); @@ -877,11 +877,11 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: max_insn_length = %s\n", plongest (gdbarch->max_insn_length)); fprintf_unfiltered (file, - "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n", - (long) gdbarch->memory_insert_breakpoint); + "gdbarch_dump: memory_insert_breakpoint = <%s>\n", + host_address_to_string (gdbarch->memory_insert_breakpoint)); fprintf_unfiltered (file, - "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n", - (long) gdbarch->memory_remove_breakpoint); + "gdbarch_dump: memory_remove_breakpoint = <%s>\n", + host_address_to_string (gdbarch->memory_remove_breakpoint)); fprintf_unfiltered (file, "gdbarch_dump: num_pseudo_regs = %s\n", plongest (gdbarch->num_pseudo_regs)); @@ -895,32 +895,32 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_overlay_update_p() = %d\n", gdbarch_overlay_update_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: overlay_update = <0x%lx>\n", - (long) gdbarch->overlay_update); + "gdbarch_dump: overlay_update = <%s>\n", + host_address_to_string (gdbarch->overlay_update)); fprintf_unfiltered (file, "gdbarch_dump: pc_regnum = %s\n", plongest (gdbarch->pc_regnum)); fprintf_unfiltered (file, - "gdbarch_dump: pointer_to_address = <0x%lx>\n", - (long) gdbarch->pointer_to_address); + "gdbarch_dump: pointer_to_address = <%s>\n", + host_address_to_string (gdbarch->pointer_to_address)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_print_float_info_p() = %d\n", gdbarch_print_float_info_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: print_float_info = <0x%lx>\n", - (long) gdbarch->print_float_info); + "gdbarch_dump: print_float_info = <%s>\n", + host_address_to_string (gdbarch->print_float_info)); fprintf_unfiltered (file, - "gdbarch_dump: print_insn = <0x%lx>\n", - (long) gdbarch->print_insn); + "gdbarch_dump: print_insn = <%s>\n", + host_address_to_string (gdbarch->print_insn)); fprintf_unfiltered (file, - "gdbarch_dump: print_registers_info = <0x%lx>\n", - (long) gdbarch->print_registers_info); + "gdbarch_dump: print_registers_info = <%s>\n", + host_address_to_string (gdbarch->print_registers_info)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_print_vector_info_p() = %d\n", gdbarch_print_vector_info_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: print_vector_info = <0x%lx>\n", - (long) gdbarch->print_vector_info); + "gdbarch_dump: print_vector_info = <%s>\n", + host_address_to_string (gdbarch->print_vector_info)); fprintf_unfiltered (file, "gdbarch_dump: ps_regnum = %s\n", plongest (gdbarch->ps_regnum)); @@ -928,14 +928,14 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_pseudo_register_read_p() = %d\n", gdbarch_pseudo_register_read_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: pseudo_register_read = <0x%lx>\n", - (long) gdbarch->pseudo_register_read); + "gdbarch_dump: pseudo_register_read = <%s>\n", + host_address_to_string (gdbarch->pseudo_register_read)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_pseudo_register_write_p() = %d\n", gdbarch_pseudo_register_write_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: pseudo_register_write = <0x%lx>\n", - (long) gdbarch->pseudo_register_write); + "gdbarch_dump: pseudo_register_write = <%s>\n", + host_address_to_string (gdbarch->pseudo_register_write)); fprintf_unfiltered (file, "gdbarch_dump: ptr_bit = %s\n", plongest (gdbarch->ptr_bit)); @@ -943,62 +943,62 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_push_dummy_call_p() = %d\n", gdbarch_push_dummy_call_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: push_dummy_call = <0x%lx>\n", - (long) gdbarch->push_dummy_call); + "gdbarch_dump: push_dummy_call = <%s>\n", + host_address_to_string (gdbarch->push_dummy_call)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_push_dummy_code_p() = %d\n", gdbarch_push_dummy_code_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: push_dummy_code = <0x%lx>\n", - (long) gdbarch->push_dummy_code); + "gdbarch_dump: push_dummy_code = <%s>\n", + host_address_to_string (gdbarch->push_dummy_code)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_read_pc_p() = %d\n", gdbarch_read_pc_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: read_pc = <0x%lx>\n", - (long) gdbarch->read_pc); + "gdbarch_dump: read_pc = <%s>\n", + host_address_to_string (gdbarch->read_pc)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_record_special_symbol_p() = %d\n", gdbarch_record_special_symbol_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: record_special_symbol = <0x%lx>\n", - (long) gdbarch->record_special_symbol); + "gdbarch_dump: record_special_symbol = <%s>\n", + host_address_to_string (gdbarch->record_special_symbol)); fprintf_unfiltered (file, - "gdbarch_dump: register_name = <0x%lx>\n", - (long) gdbarch->register_name); + "gdbarch_dump: register_name = <%s>\n", + host_address_to_string (gdbarch->register_name)); fprintf_unfiltered (file, - "gdbarch_dump: register_reggroup_p = <0x%lx>\n", - (long) gdbarch->register_reggroup_p); + "gdbarch_dump: register_reggroup_p = <%s>\n", + host_address_to_string (gdbarch->register_reggroup_p)); fprintf_unfiltered (file, - "gdbarch_dump: register_sim_regno = <0x%lx>\n", - (long) gdbarch->register_sim_regno); + "gdbarch_dump: register_sim_regno = <%s>\n", + host_address_to_string (gdbarch->register_sim_regno)); fprintf_unfiltered (file, - "gdbarch_dump: register_to_value = <0x%lx>\n", - (long) gdbarch->register_to_value); + "gdbarch_dump: register_to_value = <%s>\n", + host_address_to_string (gdbarch->register_to_value)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_register_type_p() = %d\n", gdbarch_register_type_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: register_type = <0x%lx>\n", - (long) gdbarch->register_type); + "gdbarch_dump: register_type = <%s>\n", + host_address_to_string (gdbarch->register_type)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n", gdbarch_regset_from_core_section_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: regset_from_core_section = <0x%lx>\n", - (long) gdbarch->regset_from_core_section); + "gdbarch_dump: regset_from_core_section = <%s>\n", + host_address_to_string (gdbarch->regset_from_core_section)); fprintf_unfiltered (file, - "gdbarch_dump: remote_register_number = <0x%lx>\n", - (long) gdbarch->remote_register_number); + "gdbarch_dump: remote_register_number = <%s>\n", + host_address_to_string (gdbarch->remote_register_number)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_return_value_p() = %d\n", gdbarch_return_value_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: return_value = <0x%lx>\n", - (long) gdbarch->return_value); + "gdbarch_dump: return_value = <%s>\n", + host_address_to_string (gdbarch->return_value)); fprintf_unfiltered (file, - "gdbarch_dump: sdb_reg_to_regnum = <0x%lx>\n", - (long) gdbarch->sdb_reg_to_regnum); + "gdbarch_dump: sdb_reg_to_regnum = <%s>\n", + host_address_to_string (gdbarch->sdb_reg_to_regnum)); fprintf_unfiltered (file, "gdbarch_dump: short_bit = %s\n", plongest (gdbarch->short_bit)); @@ -1006,38 +1006,38 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_single_step_through_delay_p() = %d\n", gdbarch_single_step_through_delay_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: single_step_through_delay = <0x%lx>\n", - (long) gdbarch->single_step_through_delay); + "gdbarch_dump: single_step_through_delay = <%s>\n", + host_address_to_string (gdbarch->single_step_through_delay)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_skip_main_prologue_p() = %d\n", gdbarch_skip_main_prologue_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: skip_main_prologue = <0x%lx>\n", - (long) gdbarch->skip_main_prologue); + "gdbarch_dump: skip_main_prologue = <%s>\n", + host_address_to_string (gdbarch->skip_main_prologue)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_skip_permanent_breakpoint_p() = %d\n", gdbarch_skip_permanent_breakpoint_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: skip_permanent_breakpoint = <0x%lx>\n", - (long) gdbarch->skip_permanent_breakpoint); + "gdbarch_dump: skip_permanent_breakpoint = <%s>\n", + host_address_to_string (gdbarch->skip_permanent_breakpoint)); fprintf_unfiltered (file, - "gdbarch_dump: skip_prologue = <0x%lx>\n", - (long) gdbarch->skip_prologue); + "gdbarch_dump: skip_prologue = <%s>\n", + host_address_to_string (gdbarch->skip_prologue)); fprintf_unfiltered (file, - "gdbarch_dump: skip_solib_resolver = <0x%lx>\n", - (long) gdbarch->skip_solib_resolver); + "gdbarch_dump: skip_solib_resolver = <%s>\n", + host_address_to_string (gdbarch->skip_solib_resolver)); fprintf_unfiltered (file, - "gdbarch_dump: skip_trampoline_code = <0x%lx>\n", - (long) gdbarch->skip_trampoline_code); + "gdbarch_dump: skip_trampoline_code = <%s>\n", + host_address_to_string (gdbarch->skip_trampoline_code)); fprintf_unfiltered (file, - "gdbarch_dump: smash_text_address = <0x%lx>\n", - (long) gdbarch->smash_text_address); + "gdbarch_dump: smash_text_address = <%s>\n", + host_address_to_string (gdbarch->smash_text_address)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_software_single_step_p() = %d\n", gdbarch_software_single_step_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: software_single_step = <0x%lx>\n", - (long) gdbarch->software_single_step); + "gdbarch_dump: software_single_step = <%s>\n", + host_address_to_string (gdbarch->software_single_step)); fprintf_unfiltered (file, "gdbarch_dump: sofun_address_maybe_missing = %s\n", plongest (gdbarch->sofun_address_maybe_missing)); @@ -1045,50 +1045,50 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: sp_regnum = %s\n", plongest (gdbarch->sp_regnum)); fprintf_unfiltered (file, - "gdbarch_dump: stab_reg_to_regnum = <0x%lx>\n", - (long) gdbarch->stab_reg_to_regnum); + "gdbarch_dump: stab_reg_to_regnum = <%s>\n", + host_address_to_string (gdbarch->stab_reg_to_regnum)); fprintf_unfiltered (file, - "gdbarch_dump: stabs_argument_has_addr = <0x%lx>\n", - (long) gdbarch->stabs_argument_has_addr); + "gdbarch_dump: stabs_argument_has_addr = <%s>\n", + host_address_to_string (gdbarch->stabs_argument_has_addr)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_static_transform_name_p() = %d\n", gdbarch_static_transform_name_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: static_transform_name = <0x%lx>\n", - (long) gdbarch->static_transform_name); + "gdbarch_dump: static_transform_name = <%s>\n", + host_address_to_string (gdbarch->static_transform_name)); fprintf_unfiltered (file, "gdbarch_dump: target_desc = %s\n", - plongest ((long) gdbarch->target_desc)); + host_address_to_string (gdbarch->target_desc)); fprintf_unfiltered (file, - "gdbarch_dump: target_signal_from_host = <0x%lx>\n", - (long) gdbarch->target_signal_from_host); + "gdbarch_dump: target_signal_from_host = <%s>\n", + host_address_to_string (gdbarch->target_signal_from_host)); fprintf_unfiltered (file, - "gdbarch_dump: target_signal_to_host = <0x%lx>\n", - (long) gdbarch->target_signal_to_host); + "gdbarch_dump: target_signal_to_host = <%s>\n", + host_address_to_string (gdbarch->target_signal_to_host)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_unwind_pc_p() = %d\n", gdbarch_unwind_pc_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: unwind_pc = <0x%lx>\n", - (long) gdbarch->unwind_pc); + "gdbarch_dump: unwind_pc = <%s>\n", + host_address_to_string (gdbarch->unwind_pc)); fprintf_unfiltered (file, "gdbarch_dump: gdbarch_unwind_sp_p() = %d\n", gdbarch_unwind_sp_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: unwind_sp = <0x%lx>\n", - (long) gdbarch->unwind_sp); + "gdbarch_dump: unwind_sp = <%s>\n", + host_address_to_string (gdbarch->unwind_sp)); fprintf_unfiltered (file, - "gdbarch_dump: value_from_register = <0x%lx>\n", - (long) gdbarch->value_from_register); + "gdbarch_dump: value_from_register = <%s>\n", + host_address_to_string (gdbarch->value_from_register)); fprintf_unfiltered (file, - "gdbarch_dump: value_to_register = <0x%lx>\n", - (long) gdbarch->value_to_register); + "gdbarch_dump: value_to_register = <%s>\n", + host_address_to_string (gdbarch->value_to_register)); fprintf_unfiltered (file, "gdbarch_dump: vbit_in_delta = %s\n", plongest (gdbarch->vbit_in_delta)); fprintf_unfiltered (file, - "gdbarch_dump: virtual_frame_pointer = <0x%lx>\n", - (long) gdbarch->virtual_frame_pointer); + "gdbarch_dump: virtual_frame_pointer = <%s>\n", + host_address_to_string (gdbarch->virtual_frame_pointer)); fprintf_unfiltered (file, "gdbarch_dump: vtable_function_descriptors = %s\n", plongest (gdbarch->vtable_function_descriptors)); @@ -1096,8 +1096,8 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: gdbarch_write_pc_p() = %d\n", gdbarch_write_pc_p (gdbarch)); fprintf_unfiltered (file, - "gdbarch_dump: write_pc = <0x%lx>\n", - (long) gdbarch->write_pc); + "gdbarch_dump: write_pc = <%s>\n", + host_address_to_string (gdbarch->write_pc)); if (gdbarch->dump_tdep != NULL) gdbarch->dump_tdep (gdbarch, file); } @@ -3462,9 +3462,9 @@ gdbarch_register (enum bfd_architecture bfd_architecture, } /* log it */ if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n", + fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, %s)\n", bfd_arch_info->printable_name, - (long) init); + host_address_to_string (init)); /* Append it */ (*curr) = XMALLOC (struct gdbarch_registration); (*curr)->bfd_architecture = bfd_architecture; @@ -3543,11 +3543,11 @@ find_arch_by_info (struct gdbarch_info info) "find_arch_by_info: info.osabi %d (%s)\n", info.osabi, gdbarch_osabi_name (info.osabi)); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.abfd 0x%lx\n", - (long) info.abfd); + "find_arch_by_info: info.abfd %s\n", + host_address_to_string (info.abfd)); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.tdep_info 0x%lx\n", - (long) info.tdep_info); + "find_arch_by_info: info.tdep_info %s\n", + host_address_to_string (info.tdep_info)); } /* Find the tdep code that knows about this architecture. */ @@ -3586,8 +3586,8 @@ find_arch_by_info (struct gdbarch_info info) struct gdbarch_list *this; if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " - "Previous architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, + "Previous architecture %s (%s) selected\n", + host_address_to_string (new_gdbarch), new_gdbarch->bfd_arch_info->printable_name); /* Find the existing arch in the list. */ for (list = ®o->arches; @@ -3608,8 +3608,8 @@ find_arch_by_info (struct gdbarch_info info) /* It's a new architecture. */ if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " - "New architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, + "New architecture %s (%s) selected\n", + host_address_to_string (new_gdbarch), new_gdbarch->bfd_arch_info->printable_name); /* Insert the new architecture into the front of the architecture diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 11256f3..dc8fb08 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -343,7 +343,7 @@ i:int:byte_order_for_code:::BFD_ENDIAN_BIG # i:enum gdb_osabi:osabi:::GDB_OSABI_UNKNOWN # -i:const struct target_desc *:target_desc:::::::plongest ((long) gdbarch->target_desc) +i:const struct target_desc *:target_desc:::::::host_address_to_string (gdbarch->target_desc) # The bit byte-order has to do just with numbering of bits in debugging symbols # and such. Conceptually, it's quite separate from byte/word byte order. @@ -1474,8 +1474,8 @@ do if class_is_function_p then printf " fprintf_unfiltered (file,\n" - printf " \"gdbarch_dump: ${function} = <0x%%lx>\\\\n\",\n" - printf " (long) gdbarch->${function});\n" + printf " \"gdbarch_dump: ${function} = <%%s>\\\\n\",\n" + printf " host_address_to_string (gdbarch->${function}));\n" else # It is a variable case "${print}:${returntype}" in @@ -1826,9 +1826,9 @@ gdbarch_register (enum bfd_architecture bfd_architecture, } /* log it */ if (gdbarch_debug) - fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n", + fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, %s)\n", bfd_arch_info->printable_name, - (long) init); + host_address_to_string (init)); /* Append it */ (*curr) = XMALLOC (struct gdbarch_registration); (*curr)->bfd_architecture = bfd_architecture; @@ -1907,11 +1907,11 @@ find_arch_by_info (struct gdbarch_info info) "find_arch_by_info: info.osabi %d (%s)\n", info.osabi, gdbarch_osabi_name (info.osabi)); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.abfd 0x%lx\n", - (long) info.abfd); + "find_arch_by_info: info.abfd %s\n", + host_address_to_string (info.abfd)); fprintf_unfiltered (gdb_stdlog, - "find_arch_by_info: info.tdep_info 0x%lx\n", - (long) info.tdep_info); + "find_arch_by_info: info.tdep_info %s\n", + host_address_to_string (info.tdep_info)); } /* Find the tdep code that knows about this architecture. */ @@ -1950,8 +1950,8 @@ find_arch_by_info (struct gdbarch_info info) struct gdbarch_list *this; if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " - "Previous architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, + "Previous architecture %s (%s) selected\n", + host_address_to_string (new_gdbarch), new_gdbarch->bfd_arch_info->printable_name); /* Find the existing arch in the list. */ for (list = ®o->arches; @@ -1972,8 +1972,8 @@ find_arch_by_info (struct gdbarch_info info) /* It's a new architecture. */ if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: " - "New architecture 0x%08lx (%s) selected\n", - (long) new_gdbarch, + "New architecture %s (%s) selected\n", + host_address_to_string (new_gdbarch), new_gdbarch->bfd_arch_info->printable_name); /* Insert the new architecture into the front of the architecture diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index 3457cf2..12240e7 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -21,7 +21,7 @@ #include "osabi.h" #include "gdb_string.h" #include "i386-tdep.h" -#include "i386-cygwin-tdep.h" +#include "win32-tdep.h" #include "regset.h" #include "gdb_obstack.h" #include "xml-support.h" diff --git a/gdb/i386-cygwin-tdep.h b/gdb/i386-cygwin-tdep.h deleted file mode 100644 index f3d9997..0000000 --- a/gdb/i386-cygwin-tdep.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Target-dependent code for Cygwin running on i386's, for GDB. - - Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. - - 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 . */ - -#ifndef I386_CYGWIN_TDEP_H -#define I386_CYGWIN_TDEP_H - -struct obstack; - -extern void win32_xfer_shared_library (const char* so_name, - CORE_ADDR load_addr, - struct obstack *obstack); - -#endif /* I386_CYGWIN_TDEP_H */ diff --git a/gdb/i386-windows-nat.c b/gdb/i386-windows-nat.c new file mode 100644 index 0000000..a22d6e8 --- /dev/null +++ b/gdb/i386-windows-nat.c @@ -0,0 +1,76 @@ +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. + + 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 . */ + +#include "defs.h" +#include "win32-nat.h" + +#include + +#define context_offset(x) ((int)&(((CONTEXT *)NULL)->x)) +static const int mappings[] = +{ + context_offset (Eax), + context_offset (Ecx), + context_offset (Edx), + context_offset (Ebx), + context_offset (Esp), + context_offset (Ebp), + context_offset (Esi), + context_offset (Edi), + context_offset (Eip), + context_offset (EFlags), + context_offset (SegCs), + context_offset (SegSs), + context_offset (SegDs), + context_offset (SegEs), + context_offset (SegFs), + context_offset (SegGs), + context_offset (FloatSave.RegisterArea[0 * 10]), + context_offset (FloatSave.RegisterArea[1 * 10]), + context_offset (FloatSave.RegisterArea[2 * 10]), + context_offset (FloatSave.RegisterArea[3 * 10]), + context_offset (FloatSave.RegisterArea[4 * 10]), + context_offset (FloatSave.RegisterArea[5 * 10]), + context_offset (FloatSave.RegisterArea[6 * 10]), + context_offset (FloatSave.RegisterArea[7 * 10]), + context_offset (FloatSave.ControlWord), + context_offset (FloatSave.StatusWord), + context_offset (FloatSave.TagWord), + context_offset (FloatSave.ErrorSelector), + context_offset (FloatSave.ErrorOffset), + context_offset (FloatSave.DataSelector), + context_offset (FloatSave.DataOffset), + context_offset (FloatSave.ErrorSelector) + /* XMM0-7 */ , + context_offset (ExtendedRegisters[10*16]), + context_offset (ExtendedRegisters[11*16]), + context_offset (ExtendedRegisters[12*16]), + context_offset (ExtendedRegisters[13*16]), + context_offset (ExtendedRegisters[14*16]), + context_offset (ExtendedRegisters[15*16]), + context_offset (ExtendedRegisters[16*16]), + context_offset (ExtendedRegisters[17*16]), + /* MXCSR */ + context_offset (ExtendedRegisters[24]) +}; +#undef context_offset + +void +_initialize_i386_windows_nat (void) +{ + win32_set_context_register_offsets (mappings); +} diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 693f01b..7cbcc59 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1161,7 +1161,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct mdebug_extra_func_info))); memset (e, 0, sizeof (struct mdebug_extra_func_info)); - SYMBOL_VALUE (s) = (long) e; + SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; e->numargs = top_stack->numargs; e->pdr.framereg = -1; add_symbol (s, top_stack->cur_st, top_stack->cur_block); @@ -1817,7 +1817,6 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, struct gdbarch *gdbarch = get_objfile_arch (pst->objfile); struct symbol *s, *i; struct block *b; - struct mdebug_extra_func_info *e; char *sh_name; /* Simple rule to find files linked "-x" */ @@ -1917,9 +1916,10 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, if (i) { - e = (struct mdebug_extra_func_info *) SYMBOL_VALUE (i); + struct mdebug_extra_func_info *e; + + e = (struct mdebug_extra_func_info *) SYMBOL_VALUE_BYTES (i); e->pdr = *pr; - e->pdr.isym = (long) s; /* GDB expects the absolute function start address for the procedure descriptor in e->pdr.adr. @@ -3938,7 +3938,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) SYMBOL_DOMAIN (s) = LABEL_DOMAIN; SYMBOL_CLASS (s) = LOC_CONST; SYMBOL_TYPE (s) = mdebug_type_void; - SYMBOL_VALUE (s) = (long) e; + SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e; e->pdr.framereg = -1; add_symbol_to_list (s, &local_symbols); } diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c index 1d49ad9..7ed48c4 100644 --- a/gdb/ser-mingw.c +++ b/gdb/ser-mingw.c @@ -61,7 +61,7 @@ ser_windows_open (struct serial *scb, const char *name) return -1; } - scb->fd = _open_osfhandle ((long) h, O_RDWR); + scb->fd = _open_osfhandle ((intptr_t) h, O_RDWR); if (scb->fd < 0) { errno = ENOENT; diff --git a/gdb/target.c b/gdb/target.c index 0f9e42a..0eec46a 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1200,11 +1200,12 @@ target_xfer_partial (struct target_ops *ops, const unsigned char *myaddr = NULL; fprintf_unfiltered (gdb_stdlog, - "%s:target_xfer_partial (%d, %s, 0x%lx, 0x%lx, %s, %s) = %s", + "%s:target_xfer_partial (%d, %s, %s, %s, %s, %s) = %s", ops->to_shortname, (int) object, (annex ? annex : "(null)"), - (long) readbuf, (long) writebuf, + host_address_to_string (readbuf), + host_address_to_string (writebuf), core_addr_to_string_nz (offset), plongest (len), plongest (retval)); @@ -1219,7 +1220,7 @@ target_xfer_partial (struct target_ops *ops, fputs_unfiltered (", bytes =", gdb_stdlog); for (i = 0; i < retval; i++) { - if ((((long) &(myaddr[i])) & 0xf) == 0) + if ((((ptr_int_t) &(myaddr[i])) & 0xf) == 0) { if (targetdebug < 2 && i > 0) { @@ -2717,9 +2718,9 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, attrib, target); fprintf_unfiltered (gdb_stdlog, - "target_xfer_memory (0x%x, xxx, %d, %s, xxx) = %d", - (unsigned int) memaddr, /* possable truncate long long */ - len, write ? "write" : "read", retval); + "target_xfer_memory (%s, xxx, %d, %s, xxx) = %d", + paddress (memaddr), len, write ? "write" : "read", + retval); if (retval > 0) { @@ -2728,7 +2729,7 @@ deprecated_debug_xfer_memory (CORE_ADDR memaddr, bfd_byte *myaddr, int len, fputs_unfiltered (", bytes =", gdb_stdlog); for (i = 0; i < retval; i++) { - if ((((long) &(myaddr[i])) & 0xf) == 0) + if ((((ptr_int_t) &(myaddr[i])) & 0xf) == 0) { if (targetdebug < 2 && i > 0) { diff --git a/gdb/utils.c b/gdb/utils.c index 4740a48..d289509 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1255,12 +1255,7 @@ print_spaces (int n, struct ui_file *file) void gdb_print_host_address (const void *addr, struct ui_file *stream) { - - /* We could use the %p conversion specifier to fprintf if we had any - way of knowing whether this host supports it. But the following - should work on the Alpha and on 32 bit machines. */ - - fprintf_filtered (stream, "0x%lx", (unsigned long) addr); + fprintf_filtered (stream, "%s", host_address_to_string (addr)); } @@ -3069,7 +3064,17 @@ const char * host_address_to_string (const void *addr) { char *str = get_cell (); + + /* We could use the %p conversion specifier to sprintf if we had any + way of knowing whether this host supports it. */ +#ifdef HOST_IS_LLP64 + /* On LLP64 hosts, longs are only 32bits whereas pointers are 64bit. + Use a "long long" to print our address. */ + sprintf (str, "0x%llx", (unsigned long long) addr); +#else + /* The following should work on the Alpha and on 32 bit machines. */ sprintf (str, "0x%lx", (unsigned long) addr); +#endif return str; } diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index 06294bf..9a1a28c 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -60,7 +60,8 @@ #include "i386-tdep.h" #include "i387-tdep.h" -#include "i386-cygwin-tdep.h" +#include "win32-tdep.h" +#include "win32-nat.h" static struct target_ops win32_ops; @@ -85,6 +86,12 @@ enum #endif #include +#ifndef CONTEXT_EXTENDED_REGISTERS +/* This macro is only defined on ia32. It only makes sense on this target, + so define it as zero if not already defined. */ +#define CONTEXT_EXTENDED_REGISTERS 0 +#endif + #define CONTEXT_DEBUGGER_DR CONTEXT_DEBUGGER | CONTEXT_DEBUG_REGISTERS \ | CONTEXT_EXTENDED_REGISTERS @@ -155,11 +162,16 @@ static int debug_memory = 0; /* show target memory accesses */ static int debug_exceptions = 0; /* show target exceptions */ static int useshell = 0; /* use shell for subprocesses */ -/* This vector maps GDB's idea of a register's number into an address +/* This vector maps GDB's idea of a register's number into an offset in the win32 exception context vector. It also contains the bit mask needed to load the register in question. + The contents of this table can only be computed by the units + that provide CPU-specific support for Windows native debugging. + These units should set the table by calling + win32_set_context_register_offsets. + One day we could read a reg, we could inspect the context we already have loaded, if it doesn't have the bit set that we need, we read that set of registers in using GetThreadContext. If the @@ -168,55 +180,7 @@ static int useshell = 0; /* use shell for subprocesses */ the other regs of the group, and then we copy the info in and set out bit. */ -#define context_offset(x) ((int)&(((CONTEXT *)NULL)->x)) -static const int mappings[] = -{ - context_offset (Eax), - context_offset (Ecx), - context_offset (Edx), - context_offset (Ebx), - context_offset (Esp), - context_offset (Ebp), - context_offset (Esi), - context_offset (Edi), - context_offset (Eip), - context_offset (EFlags), - context_offset (SegCs), - context_offset (SegSs), - context_offset (SegDs), - context_offset (SegEs), - context_offset (SegFs), - context_offset (SegGs), - context_offset (FloatSave.RegisterArea[0 * 10]), - context_offset (FloatSave.RegisterArea[1 * 10]), - context_offset (FloatSave.RegisterArea[2 * 10]), - context_offset (FloatSave.RegisterArea[3 * 10]), - context_offset (FloatSave.RegisterArea[4 * 10]), - context_offset (FloatSave.RegisterArea[5 * 10]), - context_offset (FloatSave.RegisterArea[6 * 10]), - context_offset (FloatSave.RegisterArea[7 * 10]), - context_offset (FloatSave.ControlWord), - context_offset (FloatSave.StatusWord), - context_offset (FloatSave.TagWord), - context_offset (FloatSave.ErrorSelector), - context_offset (FloatSave.ErrorOffset), - context_offset (FloatSave.DataSelector), - context_offset (FloatSave.DataOffset), - context_offset (FloatSave.ErrorSelector) - /* XMM0-7 */ , - context_offset (ExtendedRegisters[10*16]), - context_offset (ExtendedRegisters[11*16]), - context_offset (ExtendedRegisters[12*16]), - context_offset (ExtendedRegisters[13*16]), - context_offset (ExtendedRegisters[14*16]), - context_offset (ExtendedRegisters[15*16]), - context_offset (ExtendedRegisters[16*16]), - context_offset (ExtendedRegisters[17*16]), - /* MXCSR */ - context_offset (ExtendedRegisters[24]) -}; - -#undef context_offset +static const int *mappings; /* This vector maps the target's idea of an exception (extracted from the DEBUG_EVENT structure) to GDB's idea. */ @@ -238,6 +202,15 @@ static const struct xlate_exception {STATUS_FLOAT_DIVIDE_BY_ZERO, TARGET_SIGNAL_FPE}, {-1, -1}}; +/* Set the MAPPINGS static global to OFFSETS. + See the description of MAPPINGS for more details. */ + +void +win32_set_context_register_offsets (const int *offsets) +{ + mappings = offsets; +} + static void check (BOOL ok, const char *file, int line) { @@ -475,7 +448,7 @@ static DWORD WINAPI (*psapi_GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR, is zero return the first loaded module (which is always the name of the executable). */ static int -get_module_name (DWORD base_address, char *dll_name_ret) +get_module_name (LPVOID base_address, char *dll_name_ret) { DWORD len; MODULEINFO mi; @@ -518,7 +491,7 @@ get_module_name (DWORD base_address, char *dll_name_ret) &mi, sizeof (mi))) error (_("Can't get module info")); - if (!base_address || (DWORD) (mi.lpBaseOfDll) == base_address) + if (!base_address || mi.lpBaseOfDll == base_address) { /* Try to find the name of the given module */ len = psapi_GetModuleFileNameExA (current_process_handle, @@ -554,7 +527,7 @@ struct safe_symbol_file_add_args /* Maintain a linked list of "so" information. */ struct lm_info { - DWORD load_addr; + LPVOID load_addr; }; static struct so_list solib_start, *solib_end; @@ -613,7 +586,7 @@ safe_symbol_file_add (char *name, int from_tty, } static struct so_list * -win32_make_so (const char *name, DWORD load_addr) +win32_make_so (const char *name, LPVOID load_addr) { struct so_list *so; char buf[MAX_PATH + 1]; @@ -696,7 +669,7 @@ get_image_name (HANDLE h, void *address, int unicode) char *address_ptr; int len = 0; char b[2]; - DWORD done; + SIZE_T done; /* Attempt to read the name of the dll that was detected. This is documented to work only when actively debugging @@ -740,7 +713,7 @@ handle_load_dll (void *dummy) dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0'; - if (!get_module_name ((DWORD) event->lpBaseOfDll, dll_buf)) + if (!get_module_name (event->lpBaseOfDll, dll_buf)) dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0'; dll_name = dll_buf; @@ -751,11 +724,11 @@ handle_load_dll (void *dummy) if (!dll_name) return 1; - solib_end->next = win32_make_so (dll_name, (DWORD) event->lpBaseOfDll); + solib_end->next = win32_make_so (dll_name, event->lpBaseOfDll); solib_end = solib_end->next; DEBUG_EVENTS (("gdb: Loading dll \"%s\" at 0x%lx.\n", solib_end->so_name, - (DWORD) solib_end->lm_info->load_addr)); + solib_end->lm_info->load_addr)); return 1; } @@ -771,7 +744,7 @@ win32_free_so (struct so_list *so) static int handle_unload_dll (void *dummy) { - DWORD lpBaseOfDll = (DWORD) current_event.u.UnloadDll.lpBaseOfDll; + LPVOID lpBaseOfDll = current_event.u.UnloadDll.lpBaseOfDll; struct so_list *so; for (so = &solib_start; so->next != NULL; so = so->next) @@ -1001,7 +974,7 @@ info_w32_command (char *args, int from_tty) #define DEBUG_EXCEPTION_SIMPLE(x) if (debug_exceptions) \ printf_unfiltered ("gdb: Target exception %s at 0x%08lx\n", x, \ - (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress) + current_event.u.Exception.ExceptionRecord.ExceptionAddress) static int handle_exception (struct target_waitstatus *ourstatus) @@ -1115,7 +1088,7 @@ handle_exception (struct target_waitstatus *ourstatus) return -1; printf_unfiltered ("gdb: unknown target exception 0x%08lx at 0x%08lx\n", current_event.u.Exception.ExceptionRecord.ExceptionCode, - (DWORD) current_event.u.Exception.ExceptionRecord.ExceptionAddress); + current_event.u.Exception.ExceptionRecord.ExceptionAddress); ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; break; } @@ -1521,7 +1494,7 @@ win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus) } static void -do_initial_win32_stuff (DWORD pid, int attaching) +do_initial_win32_stuff (struct target_ops *ops, DWORD pid, int attaching) { extern int stop_after_trap; int i; @@ -1541,7 +1514,7 @@ do_initial_win32_stuff (DWORD pid, int attaching) #endif current_event.dwProcessId = pid; memset (¤t_event, 0, sizeof (current_event)); - push_target (&win32_ops); + push_target (ops); disable_breakpoints_in_shlibs (); win32_clear_solib (); clear_proceed_status (); @@ -1581,8 +1554,8 @@ do_initial_win32_stuff (DWORD pid, int attaching) If loading these functions succeeds use them to actually detach from the inferior process, otherwise behave as usual, pretending that detach has worked. */ -static BOOL WINAPI (*DebugSetProcessKillOnExit)(BOOL); -static BOOL WINAPI (*DebugActiveProcessStop)(DWORD); +static BOOL WINAPI (*kernel32_DebugSetProcessKillOnExit)(BOOL); +static BOOL WINAPI (*kernel32_DebugActiveProcessStop)(DWORD); static int has_detach_ability (void) @@ -1593,13 +1566,14 @@ has_detach_ability (void) kernel32 = LoadLibrary ("kernel32.dll"); if (kernel32) { - if (!DebugSetProcessKillOnExit) - DebugSetProcessKillOnExit = GetProcAddress (kernel32, - "DebugSetProcessKillOnExit"); - if (!DebugActiveProcessStop) - DebugActiveProcessStop = GetProcAddress (kernel32, - "DebugActiveProcessStop"); - if (DebugSetProcessKillOnExit && DebugActiveProcessStop) + if (!kernel32_DebugSetProcessKillOnExit) + kernel32_DebugSetProcessKillOnExit = + (void *) GetProcAddress (kernel32, "DebugSetProcessKillOnExit"); + if (!kernel32_DebugActiveProcessStop) + kernel32_DebugActiveProcessStop = + (void *) GetProcAddress (kernel32, "DebugActiveProcessStop"); + if (kernel32_DebugSetProcessKillOnExit + && kernel32_DebugActiveProcessStop) return 1; } return 0; @@ -1634,13 +1608,14 @@ set_process_privilege (const char *privilege, BOOL enable) if (!(advapi32 = LoadLibrary ("advapi32.dll"))) goto out; if (!OpenProcessToken) - OpenProcessToken = GetProcAddress (advapi32, "OpenProcessToken"); + OpenProcessToken = + (void *) GetProcAddress (advapi32, "OpenProcessToken"); if (!LookupPrivilegeValue) - LookupPrivilegeValue = GetProcAddress (advapi32, - "LookupPrivilegeValueA"); + LookupPrivilegeValue = + (void *) GetProcAddress (advapi32, "LookupPrivilegeValueA"); if (!AdjustTokenPrivileges) - AdjustTokenPrivileges = GetProcAddress (advapi32, - "AdjustTokenPrivileges"); + AdjustTokenPrivileges = + (void *) GetProcAddress (advapi32, "AdjustTokenPrivileges"); if (!OpenProcessToken || !LookupPrivilegeValue || !AdjustTokenPrivileges) { advapi32 = NULL; @@ -1719,7 +1694,7 @@ win32_attach (struct target_ops *ops, char *args, int from_tty) error (_("Can't attach to process.")); if (has_detach_ability ()) - DebugSetProcessKillOnExit (FALSE); + kernel32_DebugSetProcessKillOnExit (FALSE); if (from_tty) { @@ -1735,7 +1710,7 @@ win32_attach (struct target_ops *ops, char *args, int from_tty) gdb_flush (gdb_stdout); } - do_initial_win32_stuff (pid, 1); + do_initial_win32_stuff (ops, pid, 1); target_terminal_ours (); } @@ -1749,13 +1724,13 @@ win32_detach (struct target_ops *ops, char *args, int from_tty) ptid_t ptid = {-1}; win32_resume (ptid, 0, TARGET_SIGNAL_0); - if (!DebugActiveProcessStop (current_event.dwProcessId)) + if (!kernel32_DebugActiveProcessStop (current_event.dwProcessId)) { error (_("Can't detach process %lu (error %lu)"), current_event.dwProcessId, GetLastError ()); detached = 0; } - DebugSetProcessKillOnExit (FALSE); + kernel32_DebugSetProcessKillOnExit (FALSE); } if (detached && from_tty) { @@ -1770,7 +1745,7 @@ win32_detach (struct target_ops *ops, char *args, int from_tty) inferior_ptid = null_ptid; detach_inferior (current_event.dwProcessId); - unpush_target (&win32_ops); + unpush_target (ops); } static char * @@ -1945,7 +1920,7 @@ win32_create_inferior (struct target_ops *ops, char *exec_file, else saw_create = 0; - do_initial_win32_stuff (pi.dwProcessId, 0); + do_initial_win32_stuff (ops, pi.dwProcessId, 0); /* win32_continue (DBG_CONTINUE, -1); */ } @@ -1960,7 +1935,7 @@ win32_mourn_inferior (struct target_ops *ops) CHECK (CloseHandle (current_process_handle)); open_process_used = 0; } - unpush_target (&win32_ops); + unpush_target (ops); generic_mourn_inferior (); } @@ -1980,7 +1955,7 @@ win32_xfer_memory (CORE_ADDR memaddr, gdb_byte *our, int len, int write, struct mem_attrib *mem, struct target_ops *target) { - DWORD done = 0; + SIZE_T done = 0; if (write) { DEBUG_MEM (("gdb: write target memory, %d bytes at 0x%08lx\n", @@ -2074,7 +2049,8 @@ win32_xfer_shared_libraries (struct target_ops *ops, obstack_init (&obstack); obstack_grow_str (&obstack, "\n"); for (so = solib_start.next; so; so = so->next) - win32_xfer_shared_library (so->so_name, so->lm_info->load_addr, &obstack); + win32_xfer_shared_library (so->so_name, (CORE_ADDR) so->lm_info->load_addr, + &obstack); obstack_grow_str0 (&obstack, "\n"); buf = obstack_finish (&obstack); diff --git a/gdb/win32-nat.h b/gdb/win32-nat.h new file mode 100644 index 0000000..6b8287d --- /dev/null +++ b/gdb/win32-nat.h @@ -0,0 +1,24 @@ +/* Copyright 2008, 2009 Free Software Foundation, Inc. + + 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 . */ + +#ifndef WIN32_NAT_H +#define WIN32_NAT_H + +extern void win32_set_context_register_offsets (const int *offsets); + +#endif + diff --git a/gdb/win32-tdep.c b/gdb/win32-tdep.c new file mode 100644 index 0000000..1a4bae8 --- /dev/null +++ b/gdb/win32-tdep.c @@ -0,0 +1,41 @@ +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. + + 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 . */ + +#include "defs.h" +#include "win32-tdep.h" +#include "gdb_obstack.h" +#include "xml-support.h" + +void +win32_xfer_shared_library (const char* so_name, CORE_ADDR load_addr, + struct obstack *obstack) +{ + char *p; + obstack_grow_str (obstack, ""); +} + + diff --git a/gdb/win32-tdep.h b/gdb/win32-tdep.h new file mode 100644 index 0000000..a38aa33 --- /dev/null +++ b/gdb/win32-tdep.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2008, 2009 Free Software Foundation, Inc. + + 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 . */ + +#ifndef WIN32_TDEP_H +#define WIN32_TDEP_H + +struct obstack; + +extern void win32_xfer_shared_library (const char* so_name, + CORE_ADDR load_addr, + struct obstack *obstack); + +#endif