General cleanup and simplication of disassembler interface.
* a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c,
hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c,
m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c,
rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove.
* gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files,
had been -pinsn.c files.
* Makefile.in (ALLDEPFILES): Remove removed files.
(a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o,
hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o,
m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o,
rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o):
Remove compile actions.
* arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o,
vax-tdep.o: Add compile actions.
* defs.h (tm_print_insn): New global.
* a29k-tdep.c (gdb_print_insn_a29k): New function.
(_initialize_a29k_tdep): Rename from _initialize_29k,
set tm_print_insn.
* alpha-tdep.c (print_insn): Remove.
(_initialize_alpha_tdep): Set tm_print_insn.
* arm-tdep.c (arm_print_insn): New function, was print_insn
in arm-pinsn.c.
* convex-tdep.c (convex_print_insn): New function, was print_insn
in convex-pinsn.c.
* h8300-tdep.c (print_insn): Remove.
(gdb_print_insn_h8300): New function.
(_initialize_h8300_tdep): New function.
* h8500-tdep.c (print_insn): Remove.
(_initialize_h8500_tdep): New function.
* hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn.
* i386-tdep.c (_initialize_i386_tdep): New function.
* i960-tdep.c (mem, next_insn): New functions, were in
i960-pinsn.c.
(_initialize_i960_tdep): Set tm_print_insn.
* m68k-tdep.c (_initialize_m68k_tdep): New function.
* m88k-tdep.c (_initialize_m88k_tdep): New function.
* mips-tdep.c (gdb_print_insn_mips): New function.
(_initialize_mips_tdep): Set tm_print_insn.
* pyr-tdep.c (pyr_print_insn): New function, was print_insn
in pyr-pinsn.c.
* rs6000-tdep.c (_initialize_rs6000_tdep): New function.
* sh-tdep.c (print_insn): Remove.
(gdb_print_insn_sh): New function.
(_initialize_sh_tdep): Set tm_print_insn.
* sparc-tdep.c (_initialize_sparc_tdep): New function.
* w65-tdep.c (print_insn): Remove.
(_initialize_w65_tdep): New function.
* z8k-tdep.c (print_insn): Remove.
(gdb_print_insn_z8k): New function.
(_initialize_z8k_tdep): Set tm_print_insn.
* printcmd.c (print_insn): New function, generic disassembler.
* config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o.
* defs.h (query_hook, error_hook): Fix prototypes.
1995-01-17 04:36:51 +00:00
|
|
|
|
/* GOULD RISC target-dependent code for GDB, the GNU debugger.
|
* defs.h: Incorporate param.h. All users changed.
* param-no-tm.h: Change users to define TM_FILE_OVERRIDE instead.
* param.h, param-no-tm.h: Removed.
* Update copyrights in all changed files.
* dbxread.c, dwarfread.c, inflow.c, infrun.c, m2-exp.y, putenv.c,
solib.c, symtab.h, tm-umax.h, valprint.c: Lint.
* tm-convex.h, tm-hp300hpux.h, tm-merlin.h, tm-sparc.h,
xm-merlin.h: Avoid host include files in target descriptions.
* getpagesize.h: Removed, libiberty copes now.
1991-11-21 18:42:05 +00:00
|
|
|
|
Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
1991-06-04 07:31:55 +00:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
1991-03-28 16:28:29 +00:00
|
|
|
|
it under the terms of the GNU General Public License as published by
|
1991-06-04 07:31:55 +00:00
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
1991-06-04 07:31:55 +00:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
1991-03-28 16:28:29 +00:00
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
1991-06-04 07:31:55 +00:00
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
1991-03-28 16:28:29 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "frame.h"
|
* defs.h: Incorporate param.h. All users changed.
* param-no-tm.h: Change users to define TM_FILE_OVERRIDE instead.
* param.h, param-no-tm.h: Removed.
* Update copyrights in all changed files.
* dbxread.c, dwarfread.c, inflow.c, infrun.c, m2-exp.y, putenv.c,
solib.c, symtab.h, tm-umax.h, valprint.c: Lint.
* tm-convex.h, tm-hp300hpux.h, tm-merlin.h, tm-sparc.h,
xm-merlin.h: Avoid host include files in target descriptions.
* getpagesize.h: Removed, libiberty copes now.
1991-11-21 18:42:05 +00:00
|
|
|
|
#include "gdbcore.h"
|
1991-03-28 16:28:29 +00:00
|
|
|
|
#if defined GOULD_PN
|
1991-12-27 21:11:37 +00:00
|
|
|
|
#include "opcode/pn.h"
|
1991-03-28 16:28:29 +00:00
|
|
|
|
#else
|
1991-12-27 21:11:37 +00:00
|
|
|
|
#include "opcode/np1.h"
|
1991-03-28 16:28:29 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* GOULD RISC instructions are never longer than this many bytes. */
|
|
|
|
|
#define MAXLEN 4
|
|
|
|
|
|
|
|
|
|
/* Number of elements in the opcode table. */
|
|
|
|
|
#define NOPCODES (sizeof gld_opcodes / sizeof gld_opcodes[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Print the GOULD instruction at address MEMADDR in debugged memory,
|
|
|
|
|
on STREAM. Returns length of the instruction, in bytes. */
|
|
|
|
|
|
|
|
|
|
int
|
General cleanup and simplication of disassembler interface.
* a29k-pinsn.c, arm-pinsn.c, convex-pinsn.c, gould-pinsn.c,
hppa-pinsn.c, i386-pinsn.c, i960-pinsn.c, m68k-pinsn.c,
m88k-pinsn.c, mips-pinsn.c, ns32k-pinsn.c, pyr-pinsn.c,
rs6000-pinsn.c, sparc-pinsn.c, tahoe-pinsn.c, vax-pinsn.c: Remove.
* gould-tdep.c, ns32k-tdep.c, tahoe-tdep.c, vax-tdep.c: New files,
had been -pinsn.c files.
* Makefile.in (ALLDEPFILES): Remove removed files.
(a29k-pinsn.o, arm-pinsn.o, convex-pinsn.o, gould-pinsn.o,
hppa-pinsn.o, i386-pinsn.o, i960-pinsn.o, m68k-pinsn.o,
m88k-pinsn.o, mips-pinsn.o, ns32k-pinsn.o, pyr-pinsn.o,
rs6000-pinsn.o, sparc-pinsn.o, tahoe-pinsn.o, vax-pinsn.o):
Remove compile actions.
* arm-tdep.o, gould-tdep.o, ns32k-tdep.o, tahoe-tdep.o,
vax-tdep.o: Add compile actions.
* defs.h (tm_print_insn): New global.
* a29k-tdep.c (gdb_print_insn_a29k): New function.
(_initialize_a29k_tdep): Rename from _initialize_29k,
set tm_print_insn.
* alpha-tdep.c (print_insn): Remove.
(_initialize_alpha_tdep): Set tm_print_insn.
* arm-tdep.c (arm_print_insn): New function, was print_insn
in arm-pinsn.c.
* convex-tdep.c (convex_print_insn): New function, was print_insn
in convex-pinsn.c.
* h8300-tdep.c (print_insn): Remove.
(gdb_print_insn_h8300): New function.
(_initialize_h8300_tdep): New function.
* h8500-tdep.c (print_insn): Remove.
(_initialize_h8500_tdep): New function.
* hppa-tdep.c (_initialize_hppa_tdep): Set tm_print_insn.
* i386-tdep.c (_initialize_i386_tdep): New function.
* i960-tdep.c (mem, next_insn): New functions, were in
i960-pinsn.c.
(_initialize_i960_tdep): Set tm_print_insn.
* m68k-tdep.c (_initialize_m68k_tdep): New function.
* m88k-tdep.c (_initialize_m88k_tdep): New function.
* mips-tdep.c (gdb_print_insn_mips): New function.
(_initialize_mips_tdep): Set tm_print_insn.
* pyr-tdep.c (pyr_print_insn): New function, was print_insn
in pyr-pinsn.c.
* rs6000-tdep.c (_initialize_rs6000_tdep): New function.
* sh-tdep.c (print_insn): Remove.
(gdb_print_insn_sh): New function.
(_initialize_sh_tdep): Set tm_print_insn.
* sparc-tdep.c (_initialize_sparc_tdep): New function.
* w65-tdep.c (print_insn): Remove.
(_initialize_w65_tdep): New function.
* z8k-tdep.c (print_insn): Remove.
(gdb_print_insn_z8k): New function.
(_initialize_z8k_tdep): Set tm_print_insn.
* printcmd.c (print_insn): New function, generic disassembler.
* config/*/*.mt (TDEPFILES): Remove refs to *-pinsn.o.
* defs.h (query_hook, error_hook): Fix prototypes.
1995-01-17 04:36:51 +00:00
|
|
|
|
gould_print_insn (memaddr, stream)
|
|
|
|
|
CORE_ADDR memaddr;
|
|
|
|
|
FILE *stream;
|
1991-03-28 16:28:29 +00:00
|
|
|
|
{
|
|
|
|
|
unsigned char buffer[MAXLEN];
|
|
|
|
|
register int i;
|
|
|
|
|
register char *d;
|
|
|
|
|
register int bestmask;
|
|
|
|
|
unsigned best;
|
|
|
|
|
int temp, index, bestlen;
|
|
|
|
|
|
|
|
|
|
read_memory (memaddr, buffer, MAXLEN);
|
|
|
|
|
|
|
|
|
|
bestmask = 0;
|
|
|
|
|
index = -1;
|
|
|
|
|
best = 0xffffffff;
|
|
|
|
|
for (i = 0; i < NOPCODES; i++)
|
|
|
|
|
{
|
|
|
|
|
register unsigned int opcode = gld_opcodes[i].opcode;
|
|
|
|
|
register unsigned int mask = gld_opcodes[i].mask;
|
|
|
|
|
register unsigned int len = gld_opcodes[i].length;
|
|
|
|
|
register unsigned int test;
|
|
|
|
|
|
|
|
|
|
/* Get possible opcode bytes into integer */
|
|
|
|
|
test = buffer[0] << 24;
|
|
|
|
|
test |= buffer[1] << 16;
|
|
|
|
|
test |= buffer[2] << 8;
|
|
|
|
|
test |= buffer[3];
|
|
|
|
|
|
|
|
|
|
/* Mask with opcode and see if match */
|
|
|
|
|
if ((opcode & mask) == (test & mask))
|
|
|
|
|
{
|
|
|
|
|
/* See if second or third match */
|
|
|
|
|
if (index >= 0)
|
|
|
|
|
{
|
|
|
|
|
/* Take new one if it looks good */
|
|
|
|
|
if (bestlen == MAXLEN && len == MAXLEN)
|
|
|
|
|
{
|
|
|
|
|
/* See if lower bits matched */
|
|
|
|
|
if (((bestmask & 3) == 0) &&
|
|
|
|
|
((mask & 3) != 0))
|
|
|
|
|
{
|
|
|
|
|
bestmask = mask;
|
|
|
|
|
bestlen = len;
|
|
|
|
|
best = test;
|
|
|
|
|
index = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* First match, save it */
|
|
|
|
|
bestmask = mask;
|
|
|
|
|
bestlen = len;
|
|
|
|
|
best = test;
|
|
|
|
|
index = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Handle undefined instructions. */
|
|
|
|
|
if (index < 0)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stream, "undefined 0%o",(buffer[0]<<8)+buffer[1]);
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print instruction name */
|
|
|
|
|
fprintf (stream, "%-12s", gld_opcodes[index].name);
|
|
|
|
|
|
|
|
|
|
/* Adjust if short instruction */
|
|
|
|
|
if (gld_opcodes[index].length < 4)
|
|
|
|
|
{
|
|
|
|
|
best >>= 16;
|
|
|
|
|
i = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
i = 16;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dump out instruction arguments */
|
|
|
|
|
for (d = gld_opcodes[index].args; *d; ++d)
|
|
|
|
|
{
|
|
|
|
|
switch (*d)
|
|
|
|
|
{
|
|
|
|
|
case 'f':
|
|
|
|
|
fprintf (stream, "%d", (best >> (7 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'r':
|
|
|
|
|
fprintf (stream, "r%d", (best >> (7 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'R':
|
|
|
|
|
fprintf (stream, "r%d", (best >> (4 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'b':
|
|
|
|
|
fprintf (stream, "b%d", (best >> (7 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'B':
|
|
|
|
|
fprintf (stream, "b%d", (best >> (4 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
fprintf (stream, "b%d", (best >> (7 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'V':
|
|
|
|
|
fprintf (stream, "b%d", (best >> (4 + i)) & 7);
|
|
|
|
|
break;
|
|
|
|
|
case 'X':
|
|
|
|
|
temp = (best >> 20) & 7;
|
|
|
|
|
if (temp)
|
|
|
|
|
fprintf (stream, "r%d", temp);
|
|
|
|
|
else
|
|
|
|
|
putc ('0', stream);
|
|
|
|
|
break;
|
|
|
|
|
case 'A':
|
|
|
|
|
temp = (best >> 16) & 7;
|
|
|
|
|
if (temp)
|
|
|
|
|
fprintf (stream, "(b%d)", temp);
|
|
|
|
|
break;
|
|
|
|
|
case 'S':
|
|
|
|
|
fprintf (stream, "#%d", best & 0x1f);
|
|
|
|
|
break;
|
|
|
|
|
case 'I':
|
|
|
|
|
fprintf (stream, "#%x", best & 0xffff);
|
|
|
|
|
break;
|
|
|
|
|
case 'O':
|
|
|
|
|
fprintf (stream, "%x", best & 0xffff);
|
|
|
|
|
break;
|
|
|
|
|
case 'h':
|
|
|
|
|
fprintf (stream, "%d", best & 0xfffe);
|
|
|
|
|
break;
|
|
|
|
|
case 'd':
|
|
|
|
|
fprintf (stream, "%d", best & 0xfffc);
|
|
|
|
|
break;
|
|
|
|
|
case 'T':
|
|
|
|
|
fprintf (stream, "%d", (best >> 8) & 0xff);
|
|
|
|
|
break;
|
|
|
|
|
case 'N':
|
|
|
|
|
fprintf (stream, "%d", best & 0xff);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
putc (*d, stream);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return length of instruction */
|
|
|
|
|
return (gld_opcodes[index].length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Find the number of arguments to a function.
|
|
|
|
|
*/
|
|
|
|
|
findarg(frame)
|
|
|
|
|
struct frame_info *frame;
|
|
|
|
|
{
|
|
|
|
|
register struct symbol *func;
|
|
|
|
|
register unsigned pc;
|
|
|
|
|
|
|
|
|
|
#ifdef notdef
|
|
|
|
|
/* find starting address of frame function */
|
|
|
|
|
pc = get_pc_function_start (frame->pc);
|
|
|
|
|
|
|
|
|
|
/* find function symbol info */
|
|
|
|
|
func = find_pc_function (pc);
|
|
|
|
|
|
|
|
|
|
/* call blockframe code to look for match */
|
|
|
|
|
if (func != NULL)
|
|
|
|
|
return (func->value.block->nsyms / sizeof(int));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* In the case of the NPL, the frame's norminal address is Br2 and the
|
|
|
|
|
* previous routines frame is up the stack X bytes. Finding out what
|
|
|
|
|
* 'X' is can be tricky.
|
|
|
|
|
*
|
|
|
|
|
* 1.) stored in the code function header xA(Br1).
|
|
|
|
|
* 2.) must be careful of recurssion.
|
|
|
|
|
*/
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 01:32:34 +00:00
|
|
|
|
CORE_ADDR
|
1991-03-28 16:28:29 +00:00
|
|
|
|
findframe(thisframe)
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 01:32:34 +00:00
|
|
|
|
struct frame_info *thisframe;
|
1991-03-28 16:28:29 +00:00
|
|
|
|
{
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 01:32:34 +00:00
|
|
|
|
register CORE_ADDR pointer;
|
|
|
|
|
CORE_ADDR framechain();
|
1991-03-28 16:28:29 +00:00
|
|
|
|
#if 0
|
|
|
|
|
struct frame_info *frame;
|
|
|
|
|
|
|
|
|
|
/* Setup toplevel frame structure */
|
|
|
|
|
frame->pc = read_pc();
|
|
|
|
|
frame->next_frame = 0;
|
|
|
|
|
frame->frame = read_register (SP_REGNUM); /* Br2 */
|
|
|
|
|
|
|
|
|
|
/* Search for this frame (start at current Br2) */
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
pointer = framechain(frame);
|
|
|
|
|
frame->next_frame = frame->frame;
|
|
|
|
|
frame->frame = pointer;
|
|
|
|
|
frame->pc = FRAME_SAVED_PC(frame);
|
|
|
|
|
}
|
|
|
|
|
while (frame->next_frame != thisframe);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
pointer = framechain (thisframe);
|
|
|
|
|
|
|
|
|
|
/* stop gap for now, end at __base3 */
|
|
|
|
|
if (thisframe->pc == 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return pointer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Gdb front-end and internal framechain routine.
|
|
|
|
|
* Go back up stack one level. Tricky...
|
|
|
|
|
*/
|
Replace useless FRAME, FRAME_ADDR types with struct frame_info *
and CORE_ADDR, respectively.
* frame.h (FRAME, FRAME_INFO_ID, FRAME_ADDR): Remove.
* blockframe.c (get_frame_info): Remove.
* a29k-tdep.c, alpha-tdep.c, blockframe.c, breakpoint.c,
breakpoint.h, energize.c, findvar.c, gdbtk.c, gould-pinsn.c,
h8300-tdep.c, h8500-tdep.c, hppa-tdep.c, i386-tdep.c, i960-tdep.c,
infcmd.c, inferior.h, infrun.c, m68k-tdep.c, m88k-tdep.c,
mips-tdep.c, nindy-tdep.c, printcmd.c, pyr-tdep.c, rs6000-tdep.c,
sh-tdep.c, sparc-tdep.c, stack.c, valops.c, z8k-tdep.c,
config/a29k/tm-a29k.h, config/alpha/tm-alpha.h,
config/gould/tm-pn.h, config/h8300/tm-h8300.h,
config/h8500/tm-h8500.h, config/mips/tm-mips.h,
config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
config/pyr/tm-pyr.h, config/sparc/tm-sparc.h): Replace FRAME with
struct frame_info * everywhere, replace FRAME_ADDR with CORE_ADDR,
rename variables consistently (using `frame' or `fi'), remove
calls to get_frame_info and FRAME_INFO_ID, remove comments about
FRAME and FRAME_ADDR cruftiness.
1994-11-04 01:32:34 +00:00
|
|
|
|
CORE_ADDR
|
1991-03-28 16:28:29 +00:00
|
|
|
|
framechain(frame)
|
|
|
|
|
register struct frame_info *frame;
|
|
|
|
|
{
|
|
|
|
|
register CORE_ADDR func, prevsp;
|
|
|
|
|
register unsigned value;
|
|
|
|
|
|
|
|
|
|
/* Get real function start address from internal frame address */
|
|
|
|
|
func = get_pc_function_start(frame->pc);
|
|
|
|
|
|
|
|
|
|
/* If no stack given, read register Br1 "(sp)" */
|
|
|
|
|
if (!frame->frame)
|
|
|
|
|
prevsp = read_register (SP_REGNUM);
|
|
|
|
|
else
|
|
|
|
|
prevsp = frame->frame;
|
|
|
|
|
|
|
|
|
|
/* Check function header, case #2 */
|
|
|
|
|
value = read_memory_integer (func, 4);
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
/* 32bit call push value stored in function header */
|
|
|
|
|
prevsp += value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* read half-word from suabr at start of function */
|
|
|
|
|
prevsp += read_memory_integer (func + 10, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (prevsp);
|
|
|
|
|
}
|