instead of printing "Thread" here.
* linux-tdep.c: Include inferior.h.
(linux_core_pid_to_str): New.
(linux_init_abi): New.
* linux-tdep.h (linux_init_abi): Declare.
* alpha-linux-tdep.c: Include linux-tdep.h.
(alpha_linux_init_abi): Call linux_init_abi.
* amd64-linux-tdep.c (amd64_linux_init_abi): Call linux_init_abi.
* arm-linux-tdep.c (arm_linux_init_abi): Call linux_init_abi.
* frv-linux-tdep.c: Include linux-tdep.h
(frv_linux_init_abi): Call linux_init_abi.
* hppa-linux-tdep.c: Include linux-tdep.h
(hppa_linux_init_abi): Call linux_init_abi.
* i386-linux-tdep.c (i386_linux_init_abi): Call linux_init_abi.
* ia64-linux-tdep.c: Include linux-tdep.h.
(ia64_linux_init_abi): Call linux_init_abi.
* m32r-linux-tdep.c: Include linux-tdep.h.
(m32r_linux_init_abi): Call linux_init_abi.
* m68klinux-tdep.c: Include linux-tdep.h.
(m68k_linux_init_abi): Call linux_init_abi.
* microblaze-linux-tdep.c: Include linux-tdep.h.
(microblaze_linux_init_abi): Call linux_init_abi.
* mips-linux-tdep.c: Include linux-tdep.h.
(mips_linux_init_abi): Call linux_init_abi.
* mn10300-linux-tdep.c: Include linux-tdep.h.
(am33_linux_init_osabi): Call linux_init_abi. Rename the
'gdbinfo' parameter to 'info'.
* ppc-linux-tdep.c: Include linux-tdep.h.
(ppc_linux_init_abi): Call linux_init_abi.
* sh-linux-tdep.c: Include linux-tdep.h.
(sh_linux_init_abi): Call linux_init_abi.
* sparc-linux-tdep.c: Include linux-tdep.h.
(sparc32_linux_init_abi): Call linux_init_abi.
* sparc64-linux-tdep.c: Include linux-tdep.h.
(sparc64_linux_init_abi): Call linux_init_abi.
* xtensa-linux-tdep.c: Include linux-tdep.h.
(xtensa_linux_init_abi): Call linux_init_abi.
* i386-cygwin-tdep.c (i386_windows_core_pid_to_str): New.
(i386_cygwin_init_abi): Install it as gdbarch_core_pid_to_str
callback.
+2010-08-04 Pedro Alves <pedro@codesourcery.com>
+
+ * corelow.c (core_pid_to_str): Default to using normal_pid_to_str
+ instead of printing "Thread" here.
+ * linux-tdep.c: Include inferior.h.
+ (linux_core_pid_to_str): New.
+ (linux_init_abi): New.
+ * linux-tdep.h (linux_init_abi): Declare.
+ * alpha-linux-tdep.c: Include linux-tdep.h.
+ (alpha_linux_init_abi): Call linux_init_abi.
+ * amd64-linux-tdep.c (amd64_linux_init_abi): Call linux_init_abi.
+ * arm-linux-tdep.c (arm_linux_init_abi): Call linux_init_abi.
+ * frv-linux-tdep.c: Include linux-tdep.h
+ (frv_linux_init_abi): Call linux_init_abi.
+ * hppa-linux-tdep.c: Include linux-tdep.h
+ (hppa_linux_init_abi): Call linux_init_abi.
+ * i386-linux-tdep.c (i386_linux_init_abi): Call linux_init_abi.
+ * ia64-linux-tdep.c: Include linux-tdep.h.
+ (ia64_linux_init_abi): Call linux_init_abi.
+ * m32r-linux-tdep.c: Include linux-tdep.h.
+ (m32r_linux_init_abi): Call linux_init_abi.
+ * m68klinux-tdep.c: Include linux-tdep.h.
+ (m68k_linux_init_abi): Call linux_init_abi.
+ * microblaze-linux-tdep.c: Include linux-tdep.h.
+ (microblaze_linux_init_abi): Call linux_init_abi.
+ * mips-linux-tdep.c: Include linux-tdep.h.
+ (mips_linux_init_abi): Call linux_init_abi.
+ * mn10300-linux-tdep.c: Include linux-tdep.h.
+ (am33_linux_init_osabi): Call linux_init_abi. Rename the
+ 'gdbinfo' parameter to 'info'.
+ * ppc-linux-tdep.c: Include linux-tdep.h.
+ (ppc_linux_init_abi): Call linux_init_abi.
+ * sh-linux-tdep.c: Include linux-tdep.h.
+ (sh_linux_init_abi): Call linux_init_abi.
+ * sparc-linux-tdep.c: Include linux-tdep.h.
+ (sparc32_linux_init_abi): Call linux_init_abi.
+ * sparc64-linux-tdep.c: Include linux-tdep.h.
+ (sparc64_linux_init_abi): Call linux_init_abi.
+ * xtensa-linux-tdep.c: Include linux-tdep.h.
+ (xtensa_linux_init_abi): Call linux_init_abi.
+ * i386-cygwin-tdep.c (i386_windows_core_pid_to_str): New.
+ (i386_cygwin_init_abi): Install it as gdbarch_core_pid_to_str
+ callback.
+
2010-08-03 Doug Evans <dje@google.com>
* breakpoint.c (bpdisp_text): Constify bpdisps.
#include "symtab.h"
#include "regset.h"
#include "regcache.h"
-
+#include "linux-tdep.h"
#include "alpha-tdep.h"
/* Under GNU/Linux, signal handler invocations can be identified by
{
struct gdbarch_tdep *tdep;
+ linux_init_abi (info, gdbarch);
+
/* Hook into the DWARF CFI frame unwinder. */
alpha_dwarf2_init_abi (info, gdbarch);
gdb_assert (tdesc_data);
+ linux_init_abi (info, gdbarch);
+
tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset;
tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
tdep->sizeof_gregset = 27 * 8;
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
tdep->lowest_pc = 0x8000;
if (info.byte_order == BFD_ENDIAN_BIG)
{
core_pid_to_str (struct target_ops *ops, ptid_t ptid)
{
static char buf[64];
+ int pid;
+ /* The preferred way is to have a gdbarch/OS specific
+ implementation. */
if (core_gdbarch
&& gdbarch_core_pid_to_str_p (core_gdbarch))
- {
- char *ret = gdbarch_core_pid_to_str (core_gdbarch, ptid);
+ return gdbarch_core_pid_to_str (core_gdbarch, ptid);
- if (ret != NULL)
- return ret;
- }
+ /* Otherwise, if we don't have one, we'll just fallback to
+ "process", with normal_pid_to_str. */
- if (ptid_get_lwp (ptid) == 0)
- xsnprintf (buf, sizeof buf, "<main task>");
- else
- xsnprintf (buf, sizeof buf, "Thread %ld", ptid_get_lwp (ptid));
+ /* Try the LWPID field first. */
+ pid = ptid_get_lwp (ptid);
+ if (pid != 0)
+ return normal_pid_to_str (pid_to_ptid (pid));
+
+ /* Otherwise, this isn't a "threaded" core -- use the PID field, but
+ only if it isn't a fake PID. */
+ if (!core_has_fake_pid)
+ return normal_pid_to_str (ptid);
+ /* No luck. We simply don't have a valid PID to print. */
+ xsnprintf (buf, sizeof buf, "<main task>");
return buf;
}
#include "frame-unwind.h"
#include "regset.h"
#include "gdb_string.h"
+#include "linux-tdep.h"
/* Define the size (in bytes) of an FR-V instruction. */
static const int frv_instr_size = 4;
static void
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ linux_init_abi (info, gdbarch);
+
/* Set the sigtramp frame sniffer. */
frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
+
set_gdbarch_regset_from_core_section (gdbarch,
frv_linux_regset_from_core_section);
}
#include "regset.h"
#include "regcache.h"
#include "hppa-tdep.h"
-
+#include "linux-tdep.h"
#include "elf/common.h"
/* Map DWARF DBX register numbers to GDB register numbers. */
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
/* GNU/Linux is always ELF. */
tdep->is_elf = 1;
#include "gdbcore.h"
#include "solib.h"
#include "solib-target.h"
+#include "inferior.h"
/* Core file support. */
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)
{
(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);
gdb_assert (tdesc_data);
+ linux_init_abi (info, gdbarch);
+
/* GNU/Linux uses ELF. */
i386_elf_init_abi (info, gdbarch);
#include "osabi.h"
#include "solib-svr4.h"
#include "symtab.h"
+#include "linux-tdep.h"
/* The sigtramp code is in a non-readable (executable-only) region
of memory called the ``gate page''. The addresses in question
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
/* Set the method of obtaining the sigcontext addresses at which
registers are saved. */
tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address;
#include "auxv.h"
#include "target.h"
#include "elf/common.h"
+#include "inferior.h"
/* This function is suitable for architectures that don't
extend/override the standard siginfo structure. */
return target_is_uclinux;
}
+
+/* This is how we want PTIDs from core files to be printed. */
+
+static char *
+linux_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid)
+{
+ static char buf[80];
+
+ if (ptid_get_lwp (ptid) != 0)
+ {
+ snprintf (buf, sizeof (buf), "LWP %ld", ptid_get_lwp (ptid));
+ return buf;
+ }
+
+ return normal_pid_to_str (ptid);
+}
+
+/* To be called from the various GDB_OSABI_LINUX handlers for the
+ various GNU/Linux architectures and machine types. */
+
+void
+linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ set_gdbarch_core_pid_to_str (gdbarch, linux_core_pid_to_str);
+}
struct type *linux_get_siginfo_type (struct gdbarch *);
+extern void linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
+
#endif /* linux-tdep.h */
#include "frame-unwind.h"
#include "m32r-tdep.h"
+#include "linux-tdep.h"
+
\f
/* Recognizing signal handler frames. */
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
/* Since EVB register is not available for native debug, we reduce
the number of registers. */
set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1);
#include "auxv.h"
#include "observer.h"
#include "elf/common.h"
+#include "linux-tdep.h"
\f
/* Offsets (in target ints) into jmp_buf. */
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
tdep->jb_pc = M68K_LINUX_JB_PC;
tdep->jb_elt_size = M68K_LINUX_JB_ELEMENT_SIZE;
#include "trad-frame.h"
#include "frame-unwind.h"
#include "tramp-frame.h"
-
+#include "linux-tdep.h"
static int
microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
set_gdbarch_memory_remove_breakpoint (gdbarch,
microblaze_linux_memory_remove_breakpoint);
#include "target-descriptions.h"
#include "mips-linux-tdep.h"
#include "glibc-tdep.h"
+#include "linux-tdep.h"
static struct target_so_ops mips_svr4_so_ops;
enum mips_abi abi = mips_abi (gdbarch);
struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ linux_init_abi (info, gdbarch);
+
switch (abi)
{
case MIPS_ABI_O32:
#include "frame.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "linux-tdep.h"
#include <stdlib.h>
Now's our chance to register our corefile handling. */
static void
-am33_linux_init_osabi (struct gdbarch_info gdbinfo, struct gdbarch *gdbarch)
+am33_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ linux_init_abi (info, gdbarch);
+
set_gdbarch_regset_from_core_section (gdbarch,
am33_regset_from_core_section);
set_solib_svr4_fetch_link_map_offsets
#include "arch-utils.h"
#include "spu-tdep.h"
#include "xml-syscall.h"
+#include "linux-tdep.h"
#include "features/rs6000/powerpc-32l.c"
#include "features/rs6000/powerpc-altivec32l.c"
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
struct tdesc_arch_data *tdesc_data = (void *) info.tdep_info;
+ linux_init_abi (info, gdbarch);
+
/* PPC GNU/Linux uses either 64-bit or 128-bit long doubles; where
128-bit, they are IBM long double, not IEEE quad long double as
in the System V ABI PowerPC Processor Supplement. We can safely
#include "glibc-tdep.h"
#include "sh-tdep.h"
+#include "linux-tdep.h"
#define REGSx16(base) \
{(base), 0}, \
static void
sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ linux_init_abi (info, gdbarch);
+
/* GNU/Linux uses SVR4-style shared libraries. */
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
set_solib_svr4_fetch_link_map_offsets
#include "trad-frame.h"
#include "tramp-frame.h"
#include "xml-syscall.h"
+#include "linux-tdep.h"
/* The syscall's XML filename for sparc 32-bit. */
#define XML_SYSCALL_FILENAME_SPARC32 "syscalls/sparc-linux.xml"
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
tdep->gregset = regset_alloc (gdbarch, sparc32_linux_supply_core_gregset,
sparc32_linux_collect_core_gregset);
tdep->sizeof_gregset = 152;
#include "trad-frame.h"
#include "tramp-frame.h"
#include "xml-syscall.h"
+#include "linux-tdep.h"
/* The syscall's XML filename for sparc 64-bit. */
#define XML_SYSCALL_FILENAME_SPARC64 "syscalls/sparc64-linux.xml"
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ linux_init_abi (info, gdbarch);
+
tdep->gregset = regset_alloc (gdbarch, sparc64_linux_supply_core_gregset,
sparc64_linux_collect_core_gregset);
tdep->sizeof_gregset = 288;
#include "defs.h"
#include "osabi.h"
-
+#include "linux-tdep.h"
#include "solib-svr4.h"
#include "symtab.h"
static void
xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ linux_init_abi (info, gdbarch);
+
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
}