gdb: ignore generated gcore
[deliverable/binutils-gdb.git] / gdb / i386-cygwin-tdep.c
index 56fb049c13f2f52b9cdf07e0286f7e4046918a0b..dc5d614e5ec09c6bad83f32fc52399e2db0f2933 100644 (file)
@@ -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-2013 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.  */
 
@@ -128,7 +129,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
   size_t module_name_size;
   CORE_ADDR base_addr;
 
-  char *buf = NULL;
+  gdb_byte *buf = NULL;
 
   if (strncmp (sect->name, ".module", 7) != 0)
     return;
@@ -153,9 +154,9 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
   module_name_size =
     extract_unsigned_integer (buf + 8, 4, byte_order);
 
-  module_name = buf + 12;
-  if (module_name - buf + module_name_size > bfd_get_section_size (sect))
+  if (12 + module_name_size > bfd_get_section_size (sect))
     goto out;
+  module_name = (char *) buf + 12;
 
   /* The first module is the .exe itself.  */
   if (data->module_count != 0)
@@ -199,12 +200,34 @@ 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 (frame, pc, NULL);
 }
 
+static const char *
+i386_cygwin_auto_wide_charset (void)
+{
+  return "UTF-16";
+}
+
 static void
 i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -227,6 +250,16 @@ 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);
+
+  set_gdbarch_iterate_over_objfiles_in_search_order
+    (gdbarch, windows_iterate_over_objfiles_in_search_order);
 }
 
 static enum gdb_osabi
@@ -235,7 +268,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;
 
This page took 0.025354 seconds and 4 git commands to generate.