From 60e86a677efb1cab3983ef936b8530907b6f06a0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 11 Oct 1994 21:08:57 +0000 Subject: [PATCH] * lynx-nat.c (child_wait): Correct handling of byte reversed SPARC Lynx wait status. (fetch_core_registers): Don't try to fetch a register if regmap maps it to -1. * sparc-tdep.c (sparc_frame_find_saved_regs): Use FRAME_SAVED_I0 and FRAME_SAVED_L0 when setting saved_regs_addr. SPARC Lynx stores the registers in a weird order. These patches make SPARC Lynx gdb usable, though it still has problems. --- gdb/ChangeLog | 10 ++++++++++ gdb/lynx-nat.c | 33 +++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2ff7b19767c..0afa1279327 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Tue Oct 11 15:51:01 1994 Ian Lance Taylor + + * lynx-nat.c (child_wait): Correct handling of byte reversed SPARC + Lynx wait status. + (fetch_core_registers): Don't try to fetch a register if + regmap maps it to -1. + * sparc-tdep.c (sparc_frame_find_saved_regs): Use FRAME_SAVED_I0 + and FRAME_SAVED_L0 when setting saved_regs_addr. SPARC Lynx + stores the registers in a weird order. + Sat Oct 8 20:59:13 1994 Jim Kingdon (kingdon@lioth.cygnus.com) * blockframe.c (reinit_frame_cache): Reinstate select_frame call diff --git a/gdb/lynx-nat.c b/gdb/lynx-nat.c index ea224f07e54..0a622299870 100644 --- a/gdb/lynx-nat.c +++ b/gdb/lynx-nat.c @@ -606,10 +606,6 @@ child_wait (pid, ourstatus) set_sigint_trap(); /* Causes SIGINT to be passed on to the attached process. */ pid = wait (&status); -#ifdef SPARC -/* Swap halves of status so that the rest of GDB can understand it */ - status.w_status = ((unsigned)status.w_status << 16) | ((unsigned)status.w_status >> 16); -#endif save_errno = errno; @@ -662,7 +658,31 @@ child_wait (pid, ourstatus) } } +#ifdef SPARC + /* SPARC Lynx uses an byte reversed wait status; we must use the + host macros to access it. These lines just a copy of + store_waitstatus. We can't use CHILD_SPECIAL_WAITSTATUS + because target.c can't include the Lynx . */ + if (WIFEXITED (status)) + { + ourstatus->kind = TARGET_WAITKIND_EXITED; + ourstatus->value.integer = WEXITSTATUS (status); + } + else if (!WIFSTOPPED (status)) + { + ourstatus->kind = TARGET_WAITKIND_SIGNALLED; + ourstatus->value.sig = + target_signal_from_host (WTERMSIG (status)); + } + else + { + ourstatus->kind = TARGET_WAITKIND_STOPPED; + ourstatus->value.sig = + target_signal_from_host (WSTOPSIG (status)); + } +#else store_waitstatus (ourstatus, status.w_status); +#endif return pid; } @@ -744,8 +764,9 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) unsigned int regno; for (regno = 0; regno < NUM_REGS; regno++) - supply_register (regno, core_reg_sect + offsetof (st_t, ec) - + regmap[regno]); + if (regmap[regno] != -1) + supply_register (regno, core_reg_sect + offsetof (st_t, ec) + + regmap[regno]); #ifdef SPARC /* Fetching this register causes all of the I & L regs to be read from the -- 2.30.2