X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fi386-cygwin-tdep.c;h=fb940f8b7581abfe480ede2ab927a18ec162c183;hb=a95babbf381faac591ef74244aba6b399448c653;hp=af1db70e171fc421f66b5912fd9319172c431340;hpb=dc05df573e1aa9dc6e970734e85d22f2f8bc4047;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index af1db70e17..fb940f8b75 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for Cygwin running on i386's, for GDB. - Copyright (C) 2003, 2007, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2003, 2007-2012 Free Software Foundation, Inc. This file is part of GDB. @@ -28,6 +28,7 @@ #include "gdbcore.h" #include "solib.h" #include "solib-target.h" +#include "inferior.h" /* Core file support. */ @@ -113,6 +114,7 @@ i386_windows_regset_from_core_section (struct gdbarch *gdbarch, struct cpms_data { + struct gdbarch *gdbarch; struct obstack *obstack; int module_count; }; @@ -121,6 +123,7 @@ static void core_process_module_section (bfd *abfd, asection *sect, void *obj) { struct cpms_data *data = obj; + enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch); char *module_name; size_t module_name_size; @@ -146,10 +149,10 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) /* A DWORD (data_type) followed by struct windows_core_module_info. */ base_addr = - extract_unsigned_integer (buf + 4, 4); + extract_unsigned_integer (buf + 4, 4, byte_order); module_name_size = - extract_unsigned_integer (buf + 8, 4); + extract_unsigned_integer (buf + 8, 4, byte_order); module_name = buf + 12; if (module_name - buf + module_name_size > bfd_get_section_size (sect)) @@ -157,7 +160,8 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) /* The first module is the .exe itself. */ if (data->module_count != 0) - windows_xfer_shared_library (module_name, base_addr, data->obstack); + windows_xfer_shared_library (module_name, base_addr, + data->gdbarch, data->obstack); data->module_count++; out: @@ -174,7 +178,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, struct obstack obstack; const char *buf; LONGEST len_avail; - struct cpms_data data = { &obstack, 0 }; + struct cpms_data data = { gdbarch, &obstack, 0 }; obstack_init (&obstack); obstack_grow_str (&obstack, "\n"); @@ -196,10 +200,32 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, return len; } +/* This is how we want PTIDs from core files to be printed. */ + +static char * +i386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) +{ + static char buf[80]; + + if (ptid_get_lwp (ptid) != 0) + { + snprintf (buf, sizeof (buf), "Thread 0x%lx", ptid_get_lwp (ptid)); + return buf; + } + + return normal_pid_to_str (ptid); +} + static CORE_ADDR i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { - return i386_pe_skip_trampoline_code (pc, NULL); + return i386_pe_skip_trampoline_code (frame, pc, NULL); +} + +static const char * +i386_cygwin_auto_wide_charset (void) +{ + return "UTF-16"; } static void @@ -224,6 +250,13 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) (gdbarch, i386_windows_regset_from_core_section); set_gdbarch_core_xfer_shared_libraries (gdbarch, windows_core_xfer_shared_libraries); + set_gdbarch_core_pid_to_str (gdbarch, i386_windows_core_pid_to_str); + + set_gdbarch_auto_wide_charset (gdbarch, i386_cygwin_auto_wide_charset); + + /* Canonical paths on this target look like + `c:\Program Files\Foo App\mydll.dll', for example. */ + set_gdbarch_has_dos_based_file_system (gdbarch, 1); } static enum gdb_osabi @@ -232,7 +265,7 @@ i386_cygwin_osabi_sniffer (bfd *abfd) char *target_name = bfd_get_target (abfd); /* 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) return GDB_OSABI_CYGWIN;