diff options
author | Kevin Buettner <kevinb@redhat.com> | 2000-02-24 23:06:48 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2000-02-24 23:06:48 +0000 |
commit | 482ca3f5dc86270c4af53efe9cb5d3e36299d13f (patch) | |
tree | dfa4153972cd2ab4eb7f6d75c85417dc131a01ab | |
parent | 60f036a265ffa98d6618546fe1725af1f79b653b (diff) | |
download | gdb-482ca3f5dc86270c4af53efe9cb5d3e36299d13f.zip gdb-482ca3f5dc86270c4af53efe9cb5d3e36299d13f.tar.gz gdb-482ca3f5dc86270c4af53efe9cb5d3e36299d13f.tar.bz2 |
Shared library, function calling fixes for GNU/Linux PPC port.
-rw-r--r-- | gdb/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/config/powerpc/tm-linux.h | 7 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 34 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 8 |
4 files changed, 59 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 99f0db8..59dd921 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2000-02-24 Kevin Buettner <kevinb@redhat.com> + + * ppc-linux-tdep.c (ppc_sysv_abi_push_arguments): Put address + of return structure in r3 if necessary. + (ppc_linux_memory_remove_breakpoints): New function. + * rs6000-tdep.c (skip_prologue): Make sure that the cases + for storing either cr or lr to the stack only handle those + cases. (I.e, don't let these cases match 0x00000000 which is + found found in the shared library trampoline prior to the + loading of the shared library.) + * config/powerpc/tm-linux.h (ppc_linux_memory_remove_breakpoint): + Declare. + (MEMORY_REMOVE_BREAKPOINT): Define. + Wed Feb 23 23:27:48 2000 Andrew Cagney <cagney@behemoth.cygnus.com> * hppah-nat.c: Include "gdb_wait.h" instead of <wait.h>. diff --git a/gdb/config/powerpc/tm-linux.h b/gdb/config/powerpc/tm-linux.h index 271c302..43fa60f 100644 --- a/gdb/config/powerpc/tm-linux.h +++ b/gdb/config/powerpc/tm-linux.h @@ -93,6 +93,13 @@ CORE_ADDR ppc_sysv_abi_push_arguments PARAMS ((int, struct value **, CORE_ADDR, #define PROLOGUE_FIRSTLINE_OVERLAP #endif +/* Needed to handled the self-modifying code situation due to the dynamic + linker. */ +int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache); +#undef MEMORY_REMOVE_BREAKPOINT +#define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) \ + ppc_linux_memory_remove_breakpoint(addr, contents_cache) + /* N_FUN symbols in shared libaries have 0 for their values and need to be relocated. */ #define SOFUN_ADDRESS_MAYBE_MISSING diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index b7182f9..0716edd 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -522,6 +522,14 @@ ppc_sysv_abi_push_arguments (nargs, args, sp, struct_return, struct_addr) structoffset = argoffset + argstkspace; freg = 1; greg = 3; + /* Fill in r3 with the return structure, if any */ + if (struct_return) + { + char val_buf[4]; + store_address (val_buf, 4, struct_addr); + memcpy (®isters[REGISTER_BYTE (greg)], val_buf, 4); + greg++; + } /* Now fill in the registers and stack... */ for (argno = 0; argno < nargs; argno++) { @@ -606,3 +614,29 @@ ppc_sysv_abi_push_arguments (nargs, args, sp, struct_return, struct_addr) target_store_registers (-1); return sp; } + +/* This version of ppc_linux_memory_remove_breakpoints handles the + case of self modifying code */ +int +ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache) +{ + unsigned char *bp; + int val; + int bplen; + char old_contents[BREAKPOINT_MAX]; + + /* Determine appropriate breakpoint contents and size for this address. */ + bp = BREAKPOINT_FROM_PC (&addr, &bplen); + if (bp == NULL) + error ("Software breakpoints not implemented for this target."); + + val = target_read_memory (addr, old_contents, bplen); + + /* If our breakpoint is no longer at the address, this means that the + program modified the code on us, so it is wrong to put back the + old value */ + if (val == 0 && memcmp (bp, old_contents, bplen) == 0) + val = target_write_memory (addr, contents_cache, bplen); + + return val; +} diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 29ca4ca..ca094c7 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -313,8 +313,8 @@ skip_prologue (pc, fdata) char buf[4]; unsigned long op; long offset = 0; - int lr_reg = 0; - int cr_reg = 0; + int lr_reg = -1; + int cr_reg = -1; int reg; int framep = 0; int minimal_toc_loaded = 0; @@ -391,7 +391,7 @@ skip_prologue (pc, fdata) continue; } - else if ((op & 0xffff0000) == lr_reg) + else if (lr_reg != -1 && (op & 0xffff0000) == lr_reg) { /* st Rx,NUM(r1) where Rx == lr */ fdata->lr_offset = SIGNED_SHORT (op) + offset; @@ -400,7 +400,7 @@ skip_prologue (pc, fdata) continue; } - else if ((op & 0xffff0000) == cr_reg) + else if (cr_reg != -1 && (op & 0xffff0000) == cr_reg) { /* st Rx,NUM(r1) where Rx == cr */ fdata->cr_offset = SIGNED_SHORT (op) + offset; |