aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-10-08 03:41:21 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-10-08 03:41:21 +0000
commit16726dd15bd0813ad15462947b1e7eb066c2c31b (patch)
treeacd70797eca9e475ccd58df87fb9a650c5c7c1a7 /gdb
parentecee40270259204d3dfcd3f0d6ae2f780b3856c1 (diff)
downloadgdb-16726dd15bd0813ad15462947b1e7eb066c2c31b.zip
gdb-16726dd15bd0813ad15462947b1e7eb066c2c31b.tar.gz
gdb-16726dd15bd0813ad15462947b1e7eb066c2c31b.tar.bz2
The point of these changes is to avoid reading the frame pointer
and stack pointer during stepping, to speed things up. A. Changes to not select a frame until we need a selected frame: * blockframe.c (flush_cached_frames): Call select_frame (NULL, -1). * infrun.c (wait_for_inferior): Move call to select_frame back to normal_stop. This reverts a change of 13 Apr 94 (it says Jeff Law, but the change was my idea); the only reason for that change was so we could save and restore the selected frame in wait_for_inferior, and now that flush_cached frames clears the selected frame, that should work OK now. B. Changes to not create a current_frame until we need one: * blockframe.c (get_current_frame): If current_frame is NULL, try to create an innermost frame. * sparc-tdep.c (sparc_pop_frame), infcmd.c (run-stack_dummy), infrun.c (wait_for_inferior), thread.c (thread_switch), convex-tdep.c (set_thread_command), a29k-tdep.c (pop_frame), alpha-tdep.c (alpha_pop_frame), convex-xdep.c (core_file_command), h8300-tdep.c (h8300_pop_frame), h8500-tdep.c (h8300_pop_frame), hppa-tdep.c (hppa_pop_frame), i386-tdep.c (i386_pop_frame), i960-tdep.c (pop_frame), m68k-tdep.c (m68k_pop_frame), mips-tdep.c (mips_pop_frame), rs6000-tdep.c (push_dummy_frame, pop_dummy_frame, pop_frame), sh-tdep.c (pop_frame), config/arm/tm-arm.h (POP_FRAME), config/convex/tm-convex.h (POP_FRAME), config/gould/tm-pn.h (POP_FRAME), config/ns32k/tm-merlin.h (POP_FRAME), config/ns32k/tm-umax.h (POP_FRAME), config/tahoe/tm-tahoe.h (POP_FRAME), config/vax/tm-vax.h (POP_FRAME): Don't call create_new_frame. * corelow.c (core_open), altos-xdep.c (core_file_command), arm-xdep.c (core_file_command), gould-xdep.c (core_file_command), m3-nat.c (select_thread), sun386-nat.c (core_file_command), umax-xdep.c (core_file_command): Don't call create_new_frame; do call flush_cached_frames. * blockframe.c (reinit_frame_cache): Don't call create_new_frame or select_frame. C. Changes to get rid of stop_frame_address and instead only fetch the frame pointer when we need it. * breakpoint.c (bpstat_stop_status): Remove argument frame_address; use FRAME_FP (get_current_frame ()). * infrun.c (wait_for_inferior): Don't pass frame pointer to bpstat_stop_status. * infrun.c (wait_for_inferior): Use FRAME_FP (get_current_frame ()) instead of stop_frame_address. * infrun.c (save_inferior_status, restore_inferior_status), inferior.h (struct inferior_status): Don't save and restore stop_frame_address. * inferior.h, infcmd.c, thread.c (thread_switch), m3-nat.c (select_thread): Remove stop_frame_address and uses thereof. D. Same thing for the stack pointer. * infrun.c (wait_for_inferior): Remove stop_sp and replace uses thereof with read_sp (). E. Change to eliminate one nasty little spot where we were wanting to know the frame pointer from before the current step (idea from GDB 3.5, which saved my ass, because my other ideas of how to fix it were very baroque). * infrun.c: Remove prev_frame_address. * infrun.c (wait_for_inferior, step_over_function): Use step_frame_address instead of prev_frame_address. F. Same basic idea for the stack pointer. * inferior.h, infcmd.c: New variable step_sp. * infcmd.c (step_1, until_next_command): Set it. * infrun.c: Remove prev_sp and replace uses by step_sp. * infrun.c (wait_for_inferior): If we get out of the step range, then set step_sp to the current stack pointer before we start going again.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog68
-rw-r--r--gdb/a29k-tdep.c1
-rw-r--r--gdb/alpha-tdep.c2
-rw-r--r--gdb/altos-xdep.c3
-rw-r--r--gdb/arm-xdep.c3
-rw-r--r--gdb/blockframe.c31
-rw-r--r--gdb/breakpoint.c10
-rw-r--r--gdb/config/ns32k/tm-merlin.h2
-rw-r--r--gdb/config/ns32k/tm-umax.h3
-rw-r--r--gdb/config/vax/tm-vax.h3
-rw-r--r--gdb/convex-tdep.c2
-rw-r--r--gdb/convex-xdep.c2
-rw-r--r--gdb/corelow.c3
-rw-r--r--gdb/gould-xdep.c3
-rw-r--r--gdb/h8300-tdep.c2
-rw-r--r--gdb/h8500-tdep.c3
-rw-r--r--gdb/hppa-tdep.c2
-rw-r--r--gdb/i960-tdep.c1
-rw-r--r--gdb/infcmd.c38
-rw-r--r--gdb/m3-nat.c5
-rw-r--r--gdb/rs6000-tdep.c3
-rw-r--r--gdb/sh-tdep.c2
-rw-r--r--gdb/sparc-tdep.c32
-rw-r--r--gdb/sun386-nat.c3
-rw-r--r--gdb/thread.c2
-rw-r--r--gdb/umax-xdep.c3
26 files changed, 130 insertions, 102 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1f9c61d..9a5013e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,71 @@
+Fri Oct 7 08:48:18 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ The point of these changes is to avoid reading the frame pointer
+ and stack pointer during stepping, to speed things up.
+ A. Changes to not select a frame until we need a selected frame:
+ * blockframe.c (flush_cached_frames): Call select_frame (NULL, -1).
+ * infrun.c (wait_for_inferior): Move call to select_frame back to
+ normal_stop. This reverts a change of 13 Apr 94 (it says Jeff
+ Law, but the change was my idea); the only reason for that change
+ was so we could save and restore the selected frame in
+ wait_for_inferior, and now that flush_cached frames clears the
+ selected frame, that should work OK now.
+ B. Changes to not create a current_frame until we need one:
+ * blockframe.c (get_current_frame): If current_frame is NULL, try
+ to create an innermost frame.
+ * sparc-tdep.c (sparc_pop_frame), infcmd.c (run-stack_dummy),
+ infrun.c (wait_for_inferior), thread.c (thread_switch),
+ convex-tdep.c (set_thread_command), a29k-tdep.c (pop_frame),
+ alpha-tdep.c (alpha_pop_frame), convex-xdep.c (core_file_command),
+ h8300-tdep.c (h8300_pop_frame), h8500-tdep.c (h8300_pop_frame),
+ hppa-tdep.c (hppa_pop_frame), i386-tdep.c (i386_pop_frame),
+ i960-tdep.c (pop_frame), m68k-tdep.c
+ (m68k_pop_frame), mips-tdep.c (mips_pop_frame), rs6000-tdep.c
+ (push_dummy_frame, pop_dummy_frame, pop_frame), sh-tdep.c
+ (pop_frame), config/arm/tm-arm.h (POP_FRAME),
+ config/convex/tm-convex.h (POP_FRAME), config/gould/tm-pn.h
+ (POP_FRAME), config/ns32k/tm-merlin.h (POP_FRAME),
+ config/ns32k/tm-umax.h (POP_FRAME), config/tahoe/tm-tahoe.h
+ (POP_FRAME), config/vax/tm-vax.h (POP_FRAME): Don't
+ call create_new_frame.
+ * corelow.c (core_open), altos-xdep.c (core_file_command),
+ arm-xdep.c (core_file_command), gould-xdep.c (core_file_command),
+ m3-nat.c (select_thread), sun386-nat.c (core_file_command),
+ umax-xdep.c (core_file_command): Don't call create_new_frame; do
+ call flush_cached_frames.
+ * blockframe.c (reinit_frame_cache): Don't call create_new_frame
+ or select_frame.
+ C. Changes to get rid of stop_frame_address and instead only
+ fetch the frame pointer when we need it.
+ * breakpoint.c (bpstat_stop_status): Remove argument
+ frame_address; use FRAME_FP (get_current_frame ()).
+ * infrun.c (wait_for_inferior): Don't pass frame pointer to
+ bpstat_stop_status.
+ * infrun.c (wait_for_inferior): Use FRAME_FP (get_current_frame
+ ()) instead of stop_frame_address.
+ * infrun.c (save_inferior_status, restore_inferior_status),
+ inferior.h (struct inferior_status): Don't save and restore
+ stop_frame_address.
+ * inferior.h, infcmd.c, thread.c (thread_switch), m3-nat.c
+ (select_thread): Remove stop_frame_address and uses thereof.
+ D. Same thing for the stack pointer.
+ * infrun.c (wait_for_inferior): Remove stop_sp and replace
+ uses thereof with read_sp ().
+ E. Change to eliminate one nasty little spot where we were
+ wanting to know the frame pointer from before the current step
+ (idea from GDB 3.5, which saved my ass, because my other ideas of
+ how to fix it were very baroque).
+ * infrun.c: Remove prev_frame_address.
+ * infrun.c (wait_for_inferior, step_over_function): Use
+ step_frame_address instead of prev_frame_address.
+ F. Same basic idea for the stack pointer.
+ * inferior.h, infcmd.c: New variable step_sp.
+ * infcmd.c (step_1, until_next_command): Set it.
+ * infrun.c: Remove prev_sp and replace uses by step_sp.
+ * infrun.c (wait_for_inferior): If we get out of the step
+ range, then set step_sp to the current stack pointer before we
+ start going again.
+
Fri Oct 7 12:17:17 1994 Ian Lance Taylor <ian@sanguine.cygnus.com>
* top.c (target_byte_order_auto): New static variable.
diff --git a/gdb/a29k-tdep.c b/gdb/a29k-tdep.c
index 04d1fd2..17f1e09 100644
--- a/gdb/a29k-tdep.c
+++ b/gdb/a29k-tdep.c
@@ -795,7 +795,6 @@ pop_frame ()
}
}
flush_cached_frames ();
- set_current_frame (create_new_frame (0, read_pc()));
}
/* Push an empty stack frame, to record the current PC, etc. */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index dd531be..bf08237 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -869,8 +869,6 @@ alpha_pop_frame()
}
write_register (SP_REGNUM, new_sp);
flush_cached_frames ();
- /* We let init_extra_frame_info figure out the frame pointer */
- set_current_frame (create_new_frame (0, read_pc ()));
if (proc_desc && PROC_DESC_IS_DUMMY(proc_desc))
{
diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c
index 4284860..effb49f 100644
--- a/gdb/altos-xdep.c
+++ b/gdb/altos-xdep.c
@@ -155,8 +155,7 @@ core_file_command (filename, from_tty)
corefile = concat (current_directory, "/", filename, NULL);
}
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
validate_files ();
}
diff --git a/gdb/arm-xdep.c b/gdb/arm-xdep.c
index 695e9cc..bc47b72 100644
--- a/gdb/arm-xdep.c
+++ b/gdb/arm-xdep.c
@@ -267,8 +267,7 @@ core_file_command (filename, from_tty)
corefile = concat (current_directory, "/", filename, NULL);
}
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
validate_files ();
}
diff --git a/gdb/blockframe.c b/gdb/blockframe.c
index 6b0b667..8a47bb1 100644
--- a/gdb/blockframe.c
+++ b/gdb/blockframe.c
@@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "value.h" /* for read_register */
#include "target.h" /* for target_has_stack */
#include "inferior.h" /* for read_pc */
+#include "annotate.h"
/* Is ADDR inside the startup file? Note that if your machine
has a way to detect the bottom of the stack, there is no need
@@ -117,9 +118,13 @@ struct obstack frame_cache_obstack;
FRAME
get_current_frame ()
{
- /* We assume its address is kept in a general register;
- param.h says which register. */
-
+ if (current_frame == NULL)
+ {
+ if (target_has_stack)
+ current_frame = create_new_frame (read_fp (), read_pc ());
+ else
+ error ("No stack.");
+ }
return current_frame;
}
@@ -130,6 +135,9 @@ set_current_frame (frame)
current_frame = frame;
}
+/* Create an arbitrary (i.e. address specified by user) or innermost frame.
+ Always returns a non-NULL value. */
+
FRAME
create_new_frame (addr, pc)
FRAME_ADDR addr;
@@ -192,19 +200,21 @@ flush_cached_frames ()
obstack_init (&frame_cache_obstack);
current_frame = (struct frame_info *) 0; /* Invalidate cache */
- if (annotation_level > 1)
- {
- target_terminal_ours ();
- printf_unfiltered ("\n\032\032frames-invalid\n");
- }
+ select_frame ((FRAME) 0, -1);
+ annotate_frames_invalid ();
}
/* Flush the frame cache, and start a new one if necessary. */
+
void
reinit_frame_cache ()
{
flush_cached_frames ();
- if (target_has_stack)
+#if 0
+ /* The inferior_pid test is wrong if there is a corefile. But I don't
+ think this code is needed at all, now that get_current_frame will
+ create the frame if it is needed. */
+ if (inferior_pid != 0)
{
set_current_frame (create_new_frame (read_fp (), read_pc ()));
select_frame (get_current_frame (), 0);
@@ -214,6 +224,7 @@ reinit_frame_cache ()
set_current_frame (0);
select_frame ((FRAME) 0, -1);
}
+#endif
}
/* Return a structure containing various interesting information
@@ -819,7 +830,7 @@ find_frame_addr_in_frame_chain (frame_addr)
{
FRAME frame = NULL;
- if (frame_addr == NULL)
+ if (frame_addr == (CORE_ADDR)0)
return NULL;
while (1)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 9a1aba5..45c3df3 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -320,6 +320,7 @@ condition_command (arg, from_tty)
if (*arg)
error ("Junk at end of expression");
}
+ breakpoints_changed ();
return;
}
@@ -1214,9 +1215,8 @@ print_it_noop (bs)
*/
bpstat
-bpstat_stop_status (pc, frame_address, not_a_breakpoint)
+bpstat_stop_status (pc, not_a_breakpoint)
CORE_ADDR *pc;
- FRAME_ADDR frame_address;
int not_a_breakpoint;
{
register struct breakpoint *b;
@@ -1357,7 +1357,7 @@ bpstat_stop_status (pc, frame_address, not_a_breakpoint)
real_breakpoint = 1;
#endif
- if (b->frame && b->frame != frame_address)
+ if (b->frame && b->frame != FRAME_FP (get_current_frame ()))
bs->stop = 0;
else
{
@@ -1779,8 +1779,8 @@ breakpoint_1 (bnum, allflag)
{
/* FIXME should make an annotation for this */
- printf_filtered ("\tbreakpoint already hit %d times\n",
- b->hit_count);
+ printf_filtered ("\tbreakpoint already hit %d time%s\n",
+ b->hit_count, (b->hit_count == 1 ? "" : "s"));
}
if (b->ignore_count)
diff --git a/gdb/config/ns32k/tm-merlin.h b/gdb/config/ns32k/tm-merlin.h
index 6603c22..ae43ee8 100644
--- a/gdb/config/ns32k/tm-merlin.h
+++ b/gdb/config/ns32k/tm-merlin.h
@@ -289,8 +289,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
write_register (SP_REGNUM, fp + 8); \
flush_cached_frames (); \
- set_current_frame (create_new_frame (read_register (FP_REGNUM),\
- read_pc ())); \
}
/* This sequence of words is the instructions
diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h
index a515d39..d6193d7 100644
--- a/gdb/config/ns32k/tm-umax.h
+++ b/gdb/config/ns32k/tm-umax.h
@@ -344,8 +344,7 @@ extern CORE_ADDR ns32k_get_enter_addr ();
write_register (PC_REGNUM, read_memory_integer (fp + 4, 4)); \
write_register (SP_REGNUM, fp + 8); \
flush_cached_frames (); \
- set_current_frame (create_new_frame (read_register (FP_REGNUM),\
- read_pc ())); }
+}
/* This sequence of words is the instructions
enter 0xff,0 82 ff 00
diff --git a/gdb/config/vax/tm-vax.h b/gdb/config/vax/tm-vax.h
index 9f2b1e4..33b28d0 100644
--- a/gdb/config/vax/tm-vax.h
+++ b/gdb/config/vax/tm-vax.h
@@ -309,8 +309,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
fp += (regnum + 1) * 4; } \
write_register (SP_REGNUM, fp); \
flush_cached_frames (); \
- set_current_frame (create_new_frame (read_register (FP_REGNUM),\
- read_pc ())); }
+}
/* This sequence of words is the instructions
calls #69, @#32323232
diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c
index 9fa1611..b0f799f 100644
--- a/gdb/convex-tdep.c
+++ b/gdb/convex-tdep.c
@@ -719,8 +719,6 @@ set_thread_command (arg)
stop_pc = read_pc ();
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
select_frame (get_current_frame (), 0);
print_stack_frame (selected_frame, selected_frame_level, -1);
}
diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c
index 813f6b6..6426c6e 100644
--- a/gdb/convex-xdep.c
+++ b/gdb/convex-xdep.c
@@ -956,8 +956,6 @@ core_file_command (filename, from_tty)
core_aouthdr.a_magic = 0;
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
select_frame (get_current_frame (), 0);
validate_files ();
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 4b0a7c3..7059358 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -209,8 +209,7 @@ core_open (filename, from_tty)
#endif
/* Now, set up the frame cache, and print the top of stack */
- set_current_frame (create_new_frame (read_fp (),
- read_pc ()));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
print_stack_frame (selected_frame, selected_frame_level, 1);
} else {
diff --git a/gdb/gould-xdep.c b/gdb/gould-xdep.c
index e167f72..8b0060b 100644
--- a/gdb/gould-xdep.c
+++ b/gdb/gould-xdep.c
@@ -121,8 +121,7 @@ core_file_command (filename, from_tty)
corefile = concat (current_directory, "/", filename, NULL);
}
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
validate_files ();
}
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index 11dfc57..02f50a7 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -388,8 +388,6 @@ h8300_pop_frame ()
}
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
}
}
diff --git a/gdb/h8500-tdep.c b/gdb/h8500-tdep.c
index 3e8006e..8a32d98 100644
--- a/gdb/h8500-tdep.c
+++ b/gdb/h8500-tdep.c
@@ -208,9 +208,6 @@ h8300_pop_frame ()
}
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
-
}
}
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 2ae92da..76cd64f 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1181,8 +1181,6 @@ hppa_pop_frame ()
write_register (SP_REGNUM, fp);
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
}
/*
diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c
index e0360b5..e58a6fc 100644
--- a/gdb/i960-tdep.c
+++ b/gdb/i960-tdep.c
@@ -568,7 +568,6 @@ pop_frame ()
and make it the current frame. */
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM), read_pc ()));
}
/* Given a 960 stop code (fault or trace), return the signal which
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ff97d3a..1867b9a 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -134,10 +134,6 @@ enum target_signal stop_signal;
CORE_ADDR stop_pc;
-/* Stack frame when program stopped. */
-
-FRAME_ADDR stop_frame_address;
-
/* Chain containing status of breakpoint(s) that we have stopped at. */
bpstat stop_bpstat;
@@ -173,6 +169,10 @@ CORE_ADDR step_range_end; /* Exclusive */
FRAME_ADDR step_frame_address;
+/* Our notion of the current stack pointer. */
+
+CORE_ADDR step_sp;
+
/* 1 means step over all subroutine calls.
0 means don't step over calls (used by stepi).
-1 means step over calls to undebuggable functions. */
@@ -212,7 +212,6 @@ run_command (args, from_tty)
dont_repeat ();
- /* Shouldn't this be target_has_execution? FIXME. */
if (inferior_pid)
{
if (
@@ -369,6 +368,7 @@ step_1 (skip_subroutines, single_inst, count_string)
if (!fr) /* Avoid coredump here. Why tho? */
error ("No current frame");
step_frame_address = FRAME_FP (fr);
+ step_sp = read_sp ();
if (! single_inst)
{
@@ -587,7 +587,6 @@ run_stack_dummy (addr, buffer)
frame in case there is only one copy of the dummy (e.g.
CALL_DUMMY_LOCATION == AFTER_TEXT_END). */
flush_cached_frames ();
- set_current_frame (create_new_frame (read_fp (), sal.pc));
/* If defined, CALL_DUMMY_BREAKPOINT_OFFSET is where we need to put
a breakpoint instruction. If not, the call dummy already has the
@@ -670,7 +669,8 @@ until_next_command (from_tty)
step_over_calls = 1;
step_frame_address = FRAME_FP (frame);
-
+ step_sp = read_sp ();
+
step_multi = 0; /* Only one call to proceed */
proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 1);
@@ -976,15 +976,18 @@ const char * const reg_names[] = REGISTER_NAMES;
to provide that format. */
#if !defined (DO_REGISTERS_INFO)
+
#define DO_REGISTERS_INFO(regnum, fp) do_registers_info(regnum, fp)
+
static void
do_registers_info (regnum, fpregs)
int regnum;
int fpregs;
{
register int i;
+ int numregs = ARCH_NUM_REGS;
- for (i = 0; i < NUM_REGS; i++)
+ for (i = 0; i < numregs; i++)
{
char raw_buffer[MAX_REGISTER_RAW_SIZE];
char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
@@ -1021,13 +1024,17 @@ do_registers_info (regnum, fpregs)
REGISTER_VIRTUAL_SIZE (i));
/* If virtual format is floating, print it that way, and in raw hex. */
- if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT
- && ! INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
+ if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT)
{
register int j;
- val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0,
- gdb_stdout, 0, 1, 0, Val_pretty_default);
+#ifdef INVALID_FLOAT
+ if (INVALID_FLOAT (virtual_buffer, REGISTER_VIRTUAL_SIZE (i)))
+ printf_filtered ("<invalid float>");
+ else
+#endif
+ val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0,
+ gdb_stdout, 0, 1, 0, Val_pretty_default);
printf_filtered ("\t(raw 0x");
for (j = 0; j < REGISTER_RAW_SIZE (i); j++)
@@ -1072,7 +1079,7 @@ registers_info (addr_exp, fpregs)
char *addr_exp;
int fpregs;
{
- int regnum;
+ int regnum, numregs;
register char *end;
if (!target_has_registers)
@@ -1091,13 +1098,14 @@ registers_info (addr_exp, fpregs)
end = addr_exp;
while (*end != '\0' && *end != ' ' && *end != '\t')
++end;
- for (regnum = 0; regnum < NUM_REGS; regnum++)
+ numregs = ARCH_NUM_REGS;
+ for (regnum = 0; regnum < numregs; regnum++)
if (!strncmp (addr_exp, reg_names[regnum], end - addr_exp)
&& strlen (reg_names[regnum]) == end - addr_exp)
goto found;
if (*addr_exp >= '0' && *addr_exp <= '9')
regnum = atoi (addr_exp); /* Take a number */
- if (regnum >= NUM_REGS) /* Bad name, or bad number */
+ if (regnum >= numregs) /* Bad name, or bad number */
error ("%.*s: invalid register", end - addr_exp, addr_exp);
found:
diff --git a/gdb/m3-nat.c b/gdb/m3-nat.c
index b01854e..179c981 100644
--- a/gdb/m3-nat.c
+++ b/gdb/m3-nat.c
@@ -1102,12 +1102,9 @@ select_thread (task, thread_id, flag)
CHK ("Could not abort system calls when selecting a thread", ret);
stop_pc = read_pc();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- stop_pc));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
-
- stop_frame_address = FRAME_FP (get_current_frame ());
}
return KERN_SUCCESS;
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 552a484..b5df530 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -358,7 +358,6 @@ push_dummy_frame ()
otherwise things like do_registers_info() wouldn't work properly! */
flush_cached_frames ();
- set_current_frame (create_new_frame (sp-DUMMY_FRAME_SIZE, pc));
/* save program counter in link register's space. */
write_memory (sp+8, pc_targ, 4);
@@ -444,7 +443,6 @@ pop_dummy_frame ()
target_store_registers (-1);
pc = read_pc ();
flush_cached_frames ();
- set_current_frame (create_new_frame (sp, pc));
}
@@ -500,7 +498,6 @@ pop_frame ()
write_register (SP_REGNUM, prev_sp);
target_store_registers (-1);
flush_cached_frames ();
- set_current_frame (create_new_frame (prev_sp, lr));
}
/* fixup the call sequence of a dummy function, with the real function address.
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 4973d8f..9fcb8c0 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -276,8 +276,6 @@ pop_frame ()
write_register (PC_REGNUM, fi->return_pc);
write_register (SP_REGNUM, fp + 4);
flush_cached_frames ();
- set_current_frame (create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
}
/* Print the registers in a form similar to the E7000 */
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 060d29a..e67fae7 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -25,9 +25,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "value.h"
-#include "symfile.h" /* for objfiles.h */
-#include "objfiles.h" /* for find_pc_section */
-
#ifdef USE_PROC_FS
#include <sys/procfs.h>
#endif
@@ -432,7 +429,8 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr)
frame = fi->bottom ?
fi->bottom : read_register (SP_REGNUM);
for (regnum = L0_REGNUM; regnum < L0_REGNUM+16; regnum++)
- saved_regs_addr->regs[regnum] = frame + (regnum-L0_REGNUM) * 4;
+ saved_regs_addr->regs[regnum] =
+ frame + (regnum - L0_REGNUM) * REGISTER_RAW_SIZE (L0_REGNUM);
}
if (fi->next)
{
@@ -442,7 +440,8 @@ sparc_frame_find_saved_regs (fi, saved_regs_addr)
fi->next->bottom :
read_register (SP_REGNUM));
for (regnum = O0_REGNUM; regnum < O0_REGNUM+8; regnum++)
- saved_regs_addr->regs[regnum] = next_next_frame + regnum * 4;
+ saved_regs_addr->regs[regnum] =
+ next_next_frame + regnum * REGISTER_RAW_SIZE (O0_REGNUM);
}
/* Otherwise, whatever we would get from ptrace(GETREGS) is accurate */
saved_regs_addr->regs[SP_REGNUM] = FRAME_FP (fi);
@@ -578,8 +577,6 @@ sparc_pop_frame ()
write_register (NPC_REGNUM, pc + 4);
}
flush_cached_frames ();
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
}
/* On the Sun 4 under SunOS, the compile will leave a fake insn which
@@ -782,24 +779,3 @@ get_longjmp_target(pc)
return 1;
}
#endif /* GET_LONGJMP_TARGET */
-
-/* So far used only for sparc solaris. In sparc solaris, we recognize
- a trampoline by it's section name. That is, if the pc is in a
- section named ".plt" then we are in a trampline. */
-
-int
-in_solib_trampoline(pc, name)
- CORE_ADDR pc;
- char *name;
-{
- struct obj_section *s;
- int retval = 0;
-
- s = find_pc_section(pc);
-
- retval = (s != NULL
- && s->the_bfd_section->name != NULL
- && STREQ (s->the_bfd_section->name, ".plt"));
- return(retval);
-}
-
diff --git a/gdb/sun386-nat.c b/gdb/sun386-nat.c
index 63f6752..767fe75 100644
--- a/gdb/sun386-nat.c
+++ b/gdb/sun386-nat.c
@@ -130,8 +130,7 @@ core_file_command (filename, from_tty)
corefile = concat (current_directory, "/", filename, NULL);
}
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
validate_files ();
diff --git a/gdb/thread.c b/gdb/thread.c
index c3d52c3..db0bbbf 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -207,8 +207,6 @@ thread_switch (pid)
flush_cached_frames ();
registers_changed ();
stop_pc = read_pc();
- set_current_frame (create_new_frame (read_fp (), stop_pc));
- stop_frame_address = FRAME_FP (get_current_frame ());
select_frame (get_current_frame (), 0);
}
diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c
index 8c5a295..800e8c0 100644
--- a/gdb/umax-xdep.c
+++ b/gdb/umax-xdep.c
@@ -124,8 +124,7 @@ core_file_command (filename, from_tty)
corefile = concat (current_directory, "/", filename, NULL);
}
- set_current_frame ( create_new_frame (read_register (FP_REGNUM),
- read_pc ()));
+ flush_cached_frames ();
select_frame (get_current_frame (), 0);
validate_files ();
}