* gdbarch.sh (core_xfer_shared_libraries): New.
* corelow.c (core_xfer_partial): Handle TARGET_OBJECT_LIBRARIES. * gdb_obstack.h (obstack_grow_str, obstack_grow_str0): New. * xml-support.c (gdb_xml_parse): Debug output tweaks. (xml_escape_text): New. * xml-support.h (xml_escape_text): Declare. * config/i386/cygwin.mh (NATDEPFILES): Move corelow.o to ... * config/i386/cygwin.mt (TDEPFILES): ... here. * win32-nat.c: (fetch_elf_core_registers): Delete. (win32_elf_core_fn): Delete. (_initialize_core_win32): Delete. * i386-cygwin-tdep.c: Include "regset.h", "gdb_objstack.h", "xml-support.h" and "gdbcore.h". (i386_win32_gregset_reg_offset): New. (I386_WIN32_SIZEOF_GREGSET): New. (i386_win32_regset_from_core_section): New. (win32_xfer_shared_library): New. (struct cpms_data): New. (core_process_module_section): New. (win32_core_xfer_shared_libraries): New. (i386_cygwin_skip_trampoline_code): Register gregset_reg_offset, gregset_num_regs, sizeof_gregset members of tdep. Register regset_from_core_section and core_xfer_shared_libraries callbacks. * Makefile.in (i386-cygwin-tdep.o): Update dependencies. * gdbarch.h, gdbarch.c: Regenerate.
This commit is contained in:
parent
7160c4c357
commit
de58486143
|
@ -1,3 +1,39 @@
|
||||||
|
2007-09-04 Pedro Alves <pedro_alves@portugalmail.pt>
|
||||||
|
Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* gdbarch.sh (core_xfer_shared_libraries): New.
|
||||||
|
|
||||||
|
* corelow.c (core_xfer_partial): Handle TARGET_OBJECT_LIBRARIES.
|
||||||
|
|
||||||
|
* gdb_obstack.h (obstack_grow_str, obstack_grow_str0): New.
|
||||||
|
|
||||||
|
* xml-support.c (gdb_xml_parse): Debug output tweaks.
|
||||||
|
(xml_escape_text): New.
|
||||||
|
* xml-support.h (xml_escape_text): Declare.
|
||||||
|
|
||||||
|
* config/i386/cygwin.mh (NATDEPFILES): Move corelow.o to ...
|
||||||
|
* config/i386/cygwin.mt (TDEPFILES): ... here.
|
||||||
|
|
||||||
|
* win32-nat.c: (fetch_elf_core_registers): Delete.
|
||||||
|
(win32_elf_core_fn): Delete.
|
||||||
|
(_initialize_core_win32): Delete.
|
||||||
|
|
||||||
|
* i386-cygwin-tdep.c: Include "regset.h", "gdb_objstack.h",
|
||||||
|
"xml-support.h" and "gdbcore.h".
|
||||||
|
(i386_win32_gregset_reg_offset): New.
|
||||||
|
(I386_WIN32_SIZEOF_GREGSET): New.
|
||||||
|
(i386_win32_regset_from_core_section): New.
|
||||||
|
(win32_xfer_shared_library): New.
|
||||||
|
(struct cpms_data): New.
|
||||||
|
(core_process_module_section): New.
|
||||||
|
(win32_core_xfer_shared_libraries): New.
|
||||||
|
(i386_cygwin_skip_trampoline_code): Register gregset_reg_offset,
|
||||||
|
gregset_num_regs, sizeof_gregset members of tdep. Register
|
||||||
|
regset_from_core_section and core_xfer_shared_libraries callbacks.
|
||||||
|
|
||||||
|
* Makefile.in (i386-cygwin-tdep.o): Update dependencies.
|
||||||
|
* gdbarch.h, gdbarch.c: Regenerate.
|
||||||
|
|
||||||
2007-09-03 Daniel Jacobowitz <dan@codesourcery.com>
|
2007-09-03 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
* corelow.c (core_xfer_partial): Pass writebuf to
|
* corelow.c (core_xfer_partial): Pass writebuf to
|
||||||
|
|
|
@ -2102,7 +2102,8 @@ i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
|
||||||
i386bsd-tdep.o: i386bsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
|
i386bsd-tdep.o: i386bsd-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) \
|
||||||
$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) $(i386_tdep_h)
|
$(gdbcore_h) $(regcache_h) $(osabi_h) $(gdb_string_h) $(i386_tdep_h)
|
||||||
i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \
|
i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(osabi_h) $(gdb_string_h) \
|
||||||
$(i386_tdep_h)
|
$(i386_tdep_h) $(regset_h) $(gdb_obstack_h) $(xml_support_h) \
|
||||||
|
$(gdbcore_h)
|
||||||
i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
|
i386fbsd-nat.o: i386fbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
|
||||||
$(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \
|
$(target_h) $(fbsd_nat_h) $(i386_tdep_h) $(i386bsd_nat_h) \
|
||||||
$(bsd_kvm_h)
|
$(bsd_kvm_h)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
MH_CFLAGS=
|
MH_CFLAGS=
|
||||||
NATDEPFILES= i386-nat.o win32-nat.o corelow.o
|
NATDEPFILES= i386-nat.o win32-nat.o
|
||||||
NAT_FILE=nm-cygwin.h
|
NAT_FILE=nm-cygwin.h
|
||||||
XM_CLIBS=
|
XM_CLIBS=
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# Target: Intel 386 run win32
|
# Target: Intel 386 run win32
|
||||||
TDEPFILES= i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \
|
TDEPFILES= i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \
|
||||||
solib-target.o
|
solib-target.o corelow.o
|
||||||
|
|
|
@ -592,6 +592,18 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
case TARGET_OBJECT_LIBRARIES:
|
||||||
|
if (core_gdbarch
|
||||||
|
&& gdbarch_core_xfer_shared_libraries_p (core_gdbarch))
|
||||||
|
{
|
||||||
|
if (writebuf)
|
||||||
|
return -1;
|
||||||
|
return
|
||||||
|
gdbarch_core_xfer_shared_libraries (core_gdbarch,
|
||||||
|
readbuf, offset, len);
|
||||||
|
}
|
||||||
|
/* FALL THROUGH */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (ops->beneath != NULL)
|
if (ops->beneath != NULL)
|
||||||
return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
|
return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
|
||||||
|
|
|
@ -40,4 +40,9 @@
|
||||||
#define obstack_chunk_alloc xmalloc
|
#define obstack_chunk_alloc xmalloc
|
||||||
#define obstack_chunk_free xfree
|
#define obstack_chunk_free xfree
|
||||||
|
|
||||||
|
#define obstack_grow_str(OBSTACK,STRING) \
|
||||||
|
obstack_grow (OBSTACK, STRING, strlen (STRING))
|
||||||
|
#define obstack_grow_str0(OBSTACK,STRING) \
|
||||||
|
obstack_grow0 (OBSTACK, STRING, strlen (STRING))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/* Dynamic architecture support for GDB, the GNU debugger.
|
/* Dynamic architecture support for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -11,12 +11,12 @@
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 3 of the License, or
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
@ -225,6 +225,7 @@ struct gdbarch
|
||||||
gdbarch_register_reggroup_p_ftype *register_reggroup_p;
|
gdbarch_register_reggroup_p_ftype *register_reggroup_p;
|
||||||
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
|
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
|
||||||
gdbarch_regset_from_core_section_ftype *regset_from_core_section;
|
gdbarch_regset_from_core_section_ftype *regset_from_core_section;
|
||||||
|
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
|
||||||
int vtable_function_descriptors;
|
int vtable_function_descriptors;
|
||||||
int vbit_in_delta;
|
int vbit_in_delta;
|
||||||
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
|
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
|
||||||
|
@ -346,6 +347,7 @@ struct gdbarch startup_gdbarch =
|
||||||
default_register_reggroup_p, /* register_reggroup_p */
|
default_register_reggroup_p, /* register_reggroup_p */
|
||||||
0, /* fetch_pointer_argument */
|
0, /* fetch_pointer_argument */
|
||||||
0, /* regset_from_core_section */
|
0, /* regset_from_core_section */
|
||||||
|
0, /* core_xfer_shared_libraries */
|
||||||
0, /* vtable_function_descriptors */
|
0, /* vtable_function_descriptors */
|
||||||
0, /* vbit_in_delta */
|
0, /* vbit_in_delta */
|
||||||
0, /* skip_permanent_breakpoint */
|
0, /* skip_permanent_breakpoint */
|
||||||
|
@ -592,6 +594,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
|
||||||
/* Skip verify of register_reggroup_p, invalid_p == 0 */
|
/* Skip verify of register_reggroup_p, invalid_p == 0 */
|
||||||
/* Skip verify of fetch_pointer_argument, has predicate */
|
/* Skip verify of fetch_pointer_argument, has predicate */
|
||||||
/* Skip verify of regset_from_core_section, has predicate */
|
/* Skip verify of regset_from_core_section, has predicate */
|
||||||
|
/* Skip verify of core_xfer_shared_libraries, has predicate */
|
||||||
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
|
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
|
||||||
/* Skip verify of vbit_in_delta, invalid_p == 0 */
|
/* Skip verify of vbit_in_delta, invalid_p == 0 */
|
||||||
/* Skip verify of skip_permanent_breakpoint, has predicate */
|
/* Skip verify of skip_permanent_breakpoint, has predicate */
|
||||||
|
@ -710,6 +713,12 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
|
||||||
fprintf_unfiltered (file,
|
fprintf_unfiltered (file,
|
||||||
"gdbarch_dump: convert_register_p = <0x%lx>\n",
|
"gdbarch_dump: convert_register_p = <0x%lx>\n",
|
||||||
(long) current_gdbarch->convert_register_p);
|
(long) current_gdbarch->convert_register_p);
|
||||||
|
fprintf_unfiltered (file,
|
||||||
|
"gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
|
||||||
|
gdbarch_core_xfer_shared_libraries_p (current_gdbarch));
|
||||||
|
fprintf_unfiltered (file,
|
||||||
|
"gdbarch_dump: core_xfer_shared_libraries = <0x%lx>\n",
|
||||||
|
(long) current_gdbarch->core_xfer_shared_libraries);
|
||||||
fprintf_unfiltered (file,
|
fprintf_unfiltered (file,
|
||||||
"gdbarch_dump: decr_pc_after_break = 0x%s\n",
|
"gdbarch_dump: decr_pc_after_break = 0x%s\n",
|
||||||
paddr_nz (current_gdbarch->decr_pc_after_break));
|
paddr_nz (current_gdbarch->decr_pc_after_break));
|
||||||
|
@ -2886,6 +2895,30 @@ set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch,
|
||||||
gdbarch->regset_from_core_section = regset_from_core_section;
|
gdbarch->regset_from_core_section = regset_from_core_section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
|
||||||
|
{
|
||||||
|
gdb_assert (gdbarch != NULL);
|
||||||
|
return gdbarch->core_xfer_shared_libraries != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LONGEST
|
||||||
|
gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len)
|
||||||
|
{
|
||||||
|
gdb_assert (gdbarch != NULL);
|
||||||
|
gdb_assert (gdbarch->core_xfer_shared_libraries != NULL);
|
||||||
|
if (gdbarch_debug >= 2)
|
||||||
|
fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_shared_libraries called\n");
|
||||||
|
return gdbarch->core_xfer_shared_libraries (gdbarch, readbuf, offset, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch,
|
||||||
|
gdbarch_core_xfer_shared_libraries_ftype core_xfer_shared_libraries)
|
||||||
|
{
|
||||||
|
gdbarch->core_xfer_shared_libraries = core_xfer_shared_libraries;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch)
|
gdbarch_vtable_function_descriptors (struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/* Dynamic architecture support for GDB, the GNU debugger.
|
/* Dynamic architecture support for GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
@ -11,12 +11,12 @@
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 3 of the License, or
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
@ -649,6 +649,15 @@ typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct g
|
||||||
extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
|
extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size);
|
||||||
extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section);
|
extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section);
|
||||||
|
|
||||||
|
/* Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
|
||||||
|
core file into buffer READBUF with length LEN. */
|
||||||
|
|
||||||
|
extern int gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch);
|
||||||
|
|
||||||
|
typedef LONGEST (gdbarch_core_xfer_shared_libraries_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len);
|
||||||
|
extern LONGEST gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, LONGEST len);
|
||||||
|
extern void set_gdbarch_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries);
|
||||||
|
|
||||||
/* If the elements of C++ vtables are in-place function descriptors rather
|
/* If the elements of C++ vtables are in-place function descriptors rather
|
||||||
than normal function pointers (which may point to code or a descriptor),
|
than normal function pointers (which may point to code or a descriptor),
|
||||||
set this to one. */
|
set this to one. */
|
||||||
|
|
|
@ -634,6 +634,10 @@ F::CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct t
|
||||||
# name SECT_NAME and size SECT_SIZE.
|
# name SECT_NAME and size SECT_SIZE.
|
||||||
M::const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size
|
M::const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size
|
||||||
|
|
||||||
|
# Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
|
||||||
|
# core file into buffer READBUF with length LEN.
|
||||||
|
M::LONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, LONGEST len:readbuf, offset, len
|
||||||
|
|
||||||
# If the elements of C++ vtables are in-place function descriptors rather
|
# If the elements of C++ vtables are in-place function descriptors rather
|
||||||
# than normal function pointers (which may point to code or a descriptor),
|
# than normal function pointers (which may point to code or a descriptor),
|
||||||
# set this to one.
|
# set this to one.
|
||||||
|
|
|
@ -19,10 +19,197 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "osabi.h"
|
#include "osabi.h"
|
||||||
|
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
|
||||||
#include "i386-tdep.h"
|
#include "i386-tdep.h"
|
||||||
|
#include "regset.h"
|
||||||
|
#include "gdb_obstack.h"
|
||||||
|
#include "xml-support.h"
|
||||||
|
#include "gdbcore.h"
|
||||||
|
|
||||||
|
/* Core file support. */
|
||||||
|
|
||||||
|
/* This vector maps GDB's idea of a register's number into an address
|
||||||
|
in the win32 exception context vector. */
|
||||||
|
|
||||||
|
static int i386_win32_gregset_reg_offset[] =
|
||||||
|
{
|
||||||
|
176, /* eax */
|
||||||
|
172, /* ecx */
|
||||||
|
168, /* edx */
|
||||||
|
164, /* ebx */
|
||||||
|
|
||||||
|
196, /* esp */
|
||||||
|
180, /* ebp */
|
||||||
|
160, /* esi */
|
||||||
|
156, /* edi */
|
||||||
|
|
||||||
|
184, /* eip */
|
||||||
|
192, /* eflags */
|
||||||
|
188, /* cs */
|
||||||
|
200, /* ss */
|
||||||
|
|
||||||
|
152, /* ds */
|
||||||
|
148, /* es */
|
||||||
|
144, /* fs */
|
||||||
|
140, /* gs */
|
||||||
|
|
||||||
|
56, /* FloatSave.RegisterArea[0 * 10] */
|
||||||
|
66, /* FloatSave.RegisterArea[1 * 10] */
|
||||||
|
76, /* FloatSave.RegisterArea[2 * 10] */
|
||||||
|
86, /* FloatSave.RegisterArea[3 * 10] */
|
||||||
|
96, /* FloatSave.RegisterArea[4 * 10] */
|
||||||
|
106, /* FloatSave.RegisterArea[5 * 10] */
|
||||||
|
116, /* FloatSave.RegisterArea[6 * 10] */
|
||||||
|
126, /* FloatSave.RegisterArea[7 * 10] */
|
||||||
|
|
||||||
|
28, /* FloatSave.ControlWord */
|
||||||
|
32, /* FloatSave.StatusWord */
|
||||||
|
36, /* FloatSave.TagWord */
|
||||||
|
44, /* FloatSave.ErrorSelector */
|
||||||
|
40, /* FloatSave.ErrorOffset */
|
||||||
|
52, /* FloatSave.DataSelector */
|
||||||
|
48, /* FloatSave.DataOffset */
|
||||||
|
44, /* FloatSave.ErrorSelector */
|
||||||
|
|
||||||
|
/* XMM0-7 */
|
||||||
|
364, /* ExtendedRegisters[10*16] */
|
||||||
|
380, /* ExtendedRegisters[11*16] */
|
||||||
|
396, /* ExtendedRegisters[12*16] */
|
||||||
|
412, /* ExtendedRegisters[13*16] */
|
||||||
|
428, /* ExtendedRegisters[14*16] */
|
||||||
|
444, /* ExtendedRegisters[15*16] */
|
||||||
|
460, /* ExtendedRegisters[16*16] */
|
||||||
|
476, /* ExtendedRegisters[17*16] */
|
||||||
|
|
||||||
|
/* MXCSR */
|
||||||
|
228 /* ExtendedRegisters[24] */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define I386_WIN32_SIZEOF_GREGSET 716
|
||||||
|
|
||||||
|
/* Return the appropriate register set for the core section identified
|
||||||
|
by SECT_NAME and SECT_SIZE. */
|
||||||
|
|
||||||
|
static const struct regset *
|
||||||
|
i386_win32_regset_from_core_section (struct gdbarch *gdbarch,
|
||||||
|
const char *sect_name, size_t sect_size)
|
||||||
|
{
|
||||||
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
|
|
||||||
|
if (strcmp (sect_name, ".reg") == 0
|
||||||
|
&& sect_size == I386_WIN32_SIZEOF_GREGSET)
|
||||||
|
{
|
||||||
|
if (tdep->gregset == NULL)
|
||||||
|
tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
|
||||||
|
i386_collect_gregset);
|
||||||
|
return tdep->gregset;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
win32_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
|
||||||
|
struct obstack *obstack)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
obstack_grow_str (obstack, "<library name=\"");
|
||||||
|
p = xml_escape_text (so_name);
|
||||||
|
obstack_grow_str (obstack, p);
|
||||||
|
xfree (p);
|
||||||
|
obstack_grow_str (obstack, "\"><segment address=\"0x");
|
||||||
|
/* The symbols in a dll are offset by 0x1000, which is the the
|
||||||
|
offset from 0 of the first byte in an image - because of the file
|
||||||
|
header and the section alignment. */
|
||||||
|
p = paddr_nz (load_addr + 0x1000);
|
||||||
|
obstack_grow_str (obstack, p);
|
||||||
|
obstack_grow_str (obstack, "\"/></library>");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cpms_data
|
||||||
|
{
|
||||||
|
struct obstack *obstack;
|
||||||
|
int module_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
core_process_module_section (bfd *abfd, asection *sect, void *obj)
|
||||||
|
{
|
||||||
|
struct cpms_data *data = obj;
|
||||||
|
|
||||||
|
char *module_name;
|
||||||
|
size_t module_name_size;
|
||||||
|
CORE_ADDR base_addr;
|
||||||
|
|
||||||
|
char *buf = NULL;
|
||||||
|
|
||||||
|
if (strncmp (sect->name, ".module", 7) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
buf = xmalloc (bfd_get_section_size (sect) + 1);
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
printf_unfiltered ("memory allocation failed for %s\n", sect->name);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if (!bfd_get_section_contents (abfd, sect,
|
||||||
|
buf, 0, bfd_get_section_size (sect)))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* A DWORD (data_type) followed by struct win32_core_module_info. */
|
||||||
|
|
||||||
|
base_addr =
|
||||||
|
extract_unsigned_integer (buf + 4, 4);
|
||||||
|
|
||||||
|
module_name_size =
|
||||||
|
extract_unsigned_integer (buf + 8, 4);
|
||||||
|
|
||||||
|
module_name = buf + 12;
|
||||||
|
if (module_name - buf + module_name_size > bfd_get_section_size (sect))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
/* The first module is the .exe itself. */
|
||||||
|
if (data->module_count != 0)
|
||||||
|
win32_xfer_shared_library (module_name, base_addr, data->obstack);
|
||||||
|
data->module_count++;
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (buf)
|
||||||
|
xfree (buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LONGEST
|
||||||
|
win32_core_xfer_shared_libraries (struct gdbarch *gdbarch,
|
||||||
|
gdb_byte *readbuf,
|
||||||
|
ULONGEST offset, LONGEST len)
|
||||||
|
{
|
||||||
|
struct obstack obstack;
|
||||||
|
const char *buf;
|
||||||
|
LONGEST len_avail;
|
||||||
|
struct cpms_data data = { &obstack, 0 };
|
||||||
|
|
||||||
|
obstack_init (&obstack);
|
||||||
|
obstack_grow_str (&obstack, "<library-list>\n");
|
||||||
|
bfd_map_over_sections (core_bfd,
|
||||||
|
core_process_module_section,
|
||||||
|
&data);
|
||||||
|
obstack_grow_str0 (&obstack, "</library-list>\n");
|
||||||
|
|
||||||
|
buf = obstack_finish (&obstack);
|
||||||
|
len_avail = strlen (buf);
|
||||||
|
if (offset >= len_avail)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (len > len_avail - offset)
|
||||||
|
len = len_avail - offset;
|
||||||
|
memcpy (readbuf, buf + offset, len);
|
||||||
|
|
||||||
|
obstack_free (&obstack, NULL);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
|
i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
|
||||||
|
@ -38,18 +225,32 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
set_gdbarch_skip_trampoline_code (gdbarch, i386_cygwin_skip_trampoline_code);
|
set_gdbarch_skip_trampoline_code (gdbarch, i386_cygwin_skip_trampoline_code);
|
||||||
|
|
||||||
tdep->struct_return = reg_struct_return;
|
tdep->struct_return = reg_struct_return;
|
||||||
|
|
||||||
|
tdep->gregset_reg_offset = i386_win32_gregset_reg_offset;
|
||||||
|
tdep->gregset_num_regs = ARRAY_SIZE (i386_win32_gregset_reg_offset);
|
||||||
|
tdep->sizeof_gregset = I386_WIN32_SIZEOF_GREGSET;
|
||||||
|
|
||||||
|
/* Core file support. */
|
||||||
|
set_gdbarch_regset_from_core_section
|
||||||
|
(gdbarch, i386_win32_regset_from_core_section);
|
||||||
|
set_gdbarch_core_xfer_shared_libraries
|
||||||
|
(gdbarch, win32_core_xfer_shared_libraries);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum gdb_osabi
|
static enum gdb_osabi
|
||||||
i386_cygwin_osabi_sniffer (bfd * abfd)
|
i386_cygwin_osabi_sniffer (bfd *abfd)
|
||||||
{
|
{
|
||||||
char *target_name = bfd_get_target (abfd);
|
char *target_name = bfd_get_target (abfd);
|
||||||
|
|
||||||
/* Interix also uses pei-i386.
|
/* Interix also uses pei-i386.
|
||||||
We need a way to distinguish between the two. */
|
We need a way to distinguish between the two. */
|
||||||
if (strcmp (target_name, "pei-i386") == 0)
|
if (strcmp (target_name, "pei-i386") == 0)
|
||||||
return GDB_OSABI_CYGWIN;
|
return GDB_OSABI_CYGWIN;
|
||||||
|
|
||||||
|
/* Cygwin uses elf core dumps. */
|
||||||
|
if (strcmp (target_name, "elf32-i386") == 0)
|
||||||
|
return GDB_OSABI_CYGWIN;
|
||||||
|
|
||||||
return GDB_OSABI_UNKNOWN;
|
return GDB_OSABI_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +263,10 @@ _initialize_i386_cygwin_tdep (void)
|
||||||
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
|
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
|
||||||
i386_cygwin_osabi_sniffer);
|
i386_cygwin_osabi_sniffer);
|
||||||
|
|
||||||
|
/* Cygwin uses elf core dumps. */
|
||||||
|
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
|
||||||
|
i386_cygwin_osabi_sniffer);
|
||||||
|
|
||||||
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_CYGWIN,
|
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_CYGWIN,
|
||||||
i386_cygwin_init_abi);
|
i386_cygwin_init_abi);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2242,23 +2242,6 @@ win32_current_sos (void)
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
fetch_elf_core_registers (struct regcache *regcache,
|
|
||||||
char *core_reg_sect,
|
|
||||||
unsigned core_reg_size,
|
|
||||||
int which,
|
|
||||||
CORE_ADDR reg_addr)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
if (core_reg_size < sizeof (CONTEXT))
|
|
||||||
{
|
|
||||||
error (_("Core file register section too small (%u bytes)."), core_reg_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
|
|
||||||
regcache_raw_supply (regcache, r, core_reg_sect + mappings[r]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
open_symbol_file_object (void *from_ttyp)
|
open_symbol_file_object (void *from_ttyp)
|
||||||
{
|
{
|
||||||
|
@ -2460,21 +2443,6 @@ win32_win32_thread_alive (ptid_t ptid)
|
||||||
FALSE : TRUE;
|
FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct core_fns win32_elf_core_fns =
|
|
||||||
{
|
|
||||||
bfd_target_elf_flavour,
|
|
||||||
default_check_format,
|
|
||||||
default_core_sniffer,
|
|
||||||
fetch_elf_core_registers,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_core_win32 (void)
|
|
||||||
{
|
|
||||||
deprecated_add_core_fns (&win32_elf_core_fns);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_check_for_gdb_ini (void)
|
_initialize_check_for_gdb_ini (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2242,23 +2242,6 @@ win32_current_sos (void)
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
fetch_elf_core_registers (struct regcache *regcache,
|
|
||||||
char *core_reg_sect,
|
|
||||||
unsigned core_reg_size,
|
|
||||||
int which,
|
|
||||||
CORE_ADDR reg_addr)
|
|
||||||
{
|
|
||||||
int r;
|
|
||||||
if (core_reg_size < sizeof (CONTEXT))
|
|
||||||
{
|
|
||||||
error (_("Core file register section too small (%u bytes)."), core_reg_size);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++)
|
|
||||||
regcache_raw_supply (regcache, r, core_reg_sect + mappings[r]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
open_symbol_file_object (void *from_ttyp)
|
open_symbol_file_object (void *from_ttyp)
|
||||||
{
|
{
|
||||||
|
@ -2460,21 +2443,6 @@ win32_win32_thread_alive (ptid_t ptid)
|
||||||
FALSE : TRUE;
|
FALSE : TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct core_fns win32_elf_core_fns =
|
|
||||||
{
|
|
||||||
bfd_target_elf_flavour,
|
|
||||||
default_check_format,
|
|
||||||
default_core_sniffer,
|
|
||||||
fetch_elf_core_registers,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_core_win32 (void)
|
|
||||||
{
|
|
||||||
deprecated_add_core_fns (&win32_elf_core_fns);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_initialize_check_for_gdb_ini (void)
|
_initialize_check_for_gdb_ini (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -544,6 +544,8 @@ gdb_xml_parse (struct gdb_xml_parser *parser, const char *buffer)
|
||||||
enum XML_Status status;
|
enum XML_Status status;
|
||||||
const char *error_string;
|
const char *error_string;
|
||||||
|
|
||||||
|
gdb_xml_debug (parser, _("Starting:\n%s"), buffer);
|
||||||
|
|
||||||
status = XML_Parse (parser->expat_parser, buffer, strlen (buffer), 1);
|
status = XML_Parse (parser->expat_parser, buffer, strlen (buffer), 1);
|
||||||
|
|
||||||
if (status == XML_STATUS_OK && parser->error.reason == 0)
|
if (status == XML_STATUS_OK && parser->error.reason == 0)
|
||||||
|
@ -869,8 +871,7 @@ xml_process_xincludes (const char *name, const char *text,
|
||||||
result = xstrdup (obstack_finish (&data->obstack));
|
result = xstrdup (obstack_finish (&data->obstack));
|
||||||
|
|
||||||
if (depth == 0)
|
if (depth == 0)
|
||||||
gdb_xml_debug (parser, _("XInclude processing succeeded:\n%s"),
|
gdb_xml_debug (parser, _("XInclude processing succeeded."));
|
||||||
result);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = NULL;
|
result = NULL;
|
||||||
|
@ -934,6 +935,68 @@ show_debug_xml (struct ui_file *file, int from_tty,
|
||||||
fprintf_filtered (file, _("XML debugging is %s.\n"), value);
|
fprintf_filtered (file, _("XML debugging is %s.\n"), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return a malloc allocated string with special characters from TEXT
|
||||||
|
replaced by entity references. */
|
||||||
|
|
||||||
|
char *
|
||||||
|
xml_escape_text (const char *text)
|
||||||
|
{
|
||||||
|
char *result;
|
||||||
|
int i, special;
|
||||||
|
|
||||||
|
/* Compute the length of the result. */
|
||||||
|
for (i = 0, special = 0; text[i] != '\0'; i++)
|
||||||
|
switch (text[i])
|
||||||
|
{
|
||||||
|
case '\'':
|
||||||
|
case '\"':
|
||||||
|
special += 5;
|
||||||
|
break;
|
||||||
|
case '&':
|
||||||
|
special += 4;
|
||||||
|
break;
|
||||||
|
case '<':
|
||||||
|
case '>':
|
||||||
|
special += 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Expand the result. */
|
||||||
|
result = xmalloc (i + special + 1);
|
||||||
|
for (i = 0, special = 0; text[i] != '\0'; i++)
|
||||||
|
switch (text[i])
|
||||||
|
{
|
||||||
|
case '\'':
|
||||||
|
strcpy (result + i + special, "'");
|
||||||
|
special += 5;
|
||||||
|
break;
|
||||||
|
case '\"':
|
||||||
|
strcpy (result + i + special, """);
|
||||||
|
special += 5;
|
||||||
|
break;
|
||||||
|
case '&':
|
||||||
|
strcpy (result + i + special, "&");
|
||||||
|
special += 4;
|
||||||
|
break;
|
||||||
|
case '<':
|
||||||
|
strcpy (result + i + special, "<");
|
||||||
|
special += 3;
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
strcpy (result + i + special, ">");
|
||||||
|
special += 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
result[i + special] = text[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result[i + special] = '\0';
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void _initialize_xml_support (void);
|
void _initialize_xml_support (void);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -28,6 +28,30 @@ struct gdb_xml_parser;
|
||||||
struct gdb_xml_element;
|
struct gdb_xml_element;
|
||||||
struct gdb_xml_attribute;
|
struct gdb_xml_attribute;
|
||||||
|
|
||||||
|
/* Return an XML document which was compiled into GDB, from
|
||||||
|
the given FILENAME, or NULL if the file was not compiled in. */
|
||||||
|
|
||||||
|
const char *fetch_xml_builtin (const char *filename);
|
||||||
|
|
||||||
|
/* A to_xfer_partial helper function which reads XML files which were
|
||||||
|
compiled into GDB. The target may call this function from its own
|
||||||
|
to_xfer_partial handler, after converting object and annex to the
|
||||||
|
appropriate filename. */
|
||||||
|
|
||||||
|
LONGEST xml_builtin_xfer_partial (const char *filename,
|
||||||
|
gdb_byte *readbuf, const gdb_byte *writebuf,
|
||||||
|
ULONGEST offset, LONGEST len);
|
||||||
|
|
||||||
|
/* The text of compiled-in XML documents, from xml-builtin.c
|
||||||
|
(generated). */
|
||||||
|
|
||||||
|
extern const char *xml_builtin[][2];
|
||||||
|
|
||||||
|
/* Return a malloc allocated string with special characters from TEXT
|
||||||
|
replaced by entity references. */
|
||||||
|
|
||||||
|
char *xml_escape_text (const char *text);
|
||||||
|
|
||||||
/* Support for XInclude. */
|
/* Support for XInclude. */
|
||||||
|
|
||||||
/* Callback to fetch a new XML file, based on the provided HREF. */
|
/* Callback to fetch a new XML file, based on the provided HREF. */
|
||||||
|
@ -46,24 +70,6 @@ char *xml_process_xincludes (const char *name, const char *text,
|
||||||
xml_fetch_another fetcher, void *fetcher_baton,
|
xml_fetch_another fetcher, void *fetcher_baton,
|
||||||
int depth);
|
int depth);
|
||||||
|
|
||||||
/* Return an XML document which was compiled into GDB, from
|
|
||||||
the given FILENAME, or NULL if the file was not compiled in. */
|
|
||||||
|
|
||||||
const char *fetch_xml_builtin (const char *filename);
|
|
||||||
|
|
||||||
/* A to_xfer_partial helper function which reads XML files which were
|
|
||||||
compiled into GDB. The target may call this function from its own
|
|
||||||
to_xfer_partial handler, after converting object and annex to the
|
|
||||||
appropriate filename. */
|
|
||||||
|
|
||||||
LONGEST xml_builtin_xfer_partial (const char *filename,
|
|
||||||
gdb_byte *readbuf, const gdb_byte *writebuf,
|
|
||||||
ULONGEST offset, LONGEST len);
|
|
||||||
|
|
||||||
/* The text of compiled-in XML documents, from xml-builtin.c
|
|
||||||
(generated). */
|
|
||||||
extern const char *xml_builtin[][2];
|
|
||||||
|
|
||||||
/* Simplified XML parser infrastructure. */
|
/* Simplified XML parser infrastructure. */
|
||||||
|
|
||||||
/* A name and value pair, used to record parsed attributes. */
|
/* A name and value pair, used to record parsed attributes. */
|
||||||
|
|
Loading…
Reference in New Issue