[pushed] Rename some frame unwind function parameters

Message ID 20180721022146.14896-1-simon.marchi@polymtl.ca
State New
Headers show
Series
  • [pushed] Rename some frame unwind function parameters
Related show

Commit Message

Simon Marchi July 21, 2018, 2:21 a.m.
I am currently working with these functions, and though this renaming
could help to reason about the code.  Some functions take a frame and
will return the value associated to that frame, others will return the
value associated to the previous frame.  Those usually conveniently
contain "unwind" in their name, but naming the variable next_frame
instead of frame helps remembering which frame we are dealing with.

I also included a little typo fix at the top of frame.h.

gdb/ChangeLog:

	* frame.c (frame_register_unwind): Change parameter name.
	(frame_unwind_register): Likewise.
	(frame_unwind_register_value): Likewise.
	(frame_unwind_register_signed): Likewise.
	(frame_unwind_register_unsigned): Likewise.
	* frame.h (frame_register_unwind): Likewise.
	(frame_unwind_register): Likewise.
	(frame_unwind_register_value): Likewise.
	(frame_unwind_register_signed): Likewise.
	(frame_unwind_register_unsigned): Likewise.
	(frame_unwind_arch): Likewise.
---
 gdb/ChangeLog | 14 ++++++++++++++
 gdb/frame.c   | 36 +++++++++++++++++++-----------------
 gdb/frame.h   | 16 ++++++++--------
 3 files changed, 41 insertions(+), 25 deletions(-)

-- 
2.18.0

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cada9471ce36..68c3bb35b5eb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@ 
+2018-07-20  Simon Marchi  <simon.marchi@polymtl.ca>
+
+	* frame.c (frame_register_unwind): Change parameter name.
+	(frame_unwind_register): Likewise.
+	(frame_unwind_register_value): Likewise.
+	(frame_unwind_register_signed): Likewise.
+	(frame_unwind_register_unsigned): Likewise.
+	* frame.h (frame_register_unwind): Likewise.
+	(frame_unwind_register): Likewise.
+	(frame_unwind_register_value): Likewise.
+	(frame_unwind_register_signed): Likewise.
+	(frame_unwind_register_unsigned): Likewise.
+	(frame_unwind_arch): Likewise.
+
 2018-07-20  Maciej W. Rozycki  <macro@mips.com>
 
 	* MAINTAINERS: Update my e-mail address, downgrade to MIPS I-IV
diff --git a/gdb/frame.c b/gdb/frame.c
index 1fe882cd0145..0dc2cb7e7160 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1091,7 +1091,7 @@  frame_pop (struct frame_info *this_frame)
 }
 
 void
-frame_register_unwind (struct frame_info *frame, int regnum,
+frame_register_unwind (frame_info *next_frame, int regnum,
 		       int *optimizedp, int *unavailablep,
 		       enum lval_type *lvalp, CORE_ADDR *addrp,
 		       int *realnump, gdb_byte *bufferp)
@@ -1106,7 +1106,7 @@  frame_register_unwind (struct frame_info *frame, int regnum,
   gdb_assert (realnump != NULL);
   /* gdb_assert (bufferp != NULL); */
 
-  value = frame_unwind_register_value (frame, regnum);
+  value = frame_unwind_register_value (next_frame, regnum);
 
   gdb_assert (value != NULL);
 
@@ -1154,7 +1154,7 @@  frame_register (struct frame_info *frame, int regnum,
 }
 
 void
-frame_unwind_register (struct frame_info *frame, int regnum, gdb_byte *buf)
+frame_unwind_register (frame_info *next_frame, int regnum, gdb_byte *buf)
 {
   int optimized;
   int unavailable;
@@ -1162,7 +1162,7 @@  frame_unwind_register (struct frame_info *frame, int regnum, gdb_byte *buf)
   int realnum;
   enum lval_type lval;
 
-  frame_register_unwind (frame, regnum, &optimized, &unavailable,
+  frame_register_unwind (next_frame, regnum, &optimized, &unavailable,
 			 &lval, &addr, &realnum, buf);
 
   if (optimized)
@@ -1181,29 +1181,31 @@  get_frame_register (struct frame_info *frame,
 }
 
 struct value *
-frame_unwind_register_value (struct frame_info *frame, int regnum)
+frame_unwind_register_value (frame_info *next_frame, int regnum)
 {
   struct gdbarch *gdbarch;
   struct value *value;
 
-  gdb_assert (frame != NULL);
-  gdbarch = frame_unwind_arch (frame);
+  gdb_assert (next_frame != NULL);
+  gdbarch = frame_unwind_arch (next_frame);
 
   if (frame_debug)
     {
       fprintf_unfiltered (gdb_stdlog,
 			  "{ frame_unwind_register_value "
 			  "(frame=%d,regnum=%d(%s),...) ",
-			  frame->level, regnum,
+			  next_frame->level, regnum,
 			  user_reg_map_regnum_to_name (gdbarch, regnum));
     }
 
   /* Find the unwinder.  */
-  if (frame->unwind == NULL)
-    frame_unwind_find_by_frame (frame, &frame->prologue_cache);
+  if (next_frame->unwind == NULL)
+    frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache);
 
   /* Ask this frame to unwind its register.  */
-  value = frame->unwind->prev_register (frame, &frame->prologue_cache, regnum);
+  value = next_frame->unwind->prev_register (next_frame,
+					     &next_frame->prologue_cache,
+					     regnum);
 
   if (frame_debug)
     {
@@ -1253,12 +1255,12 @@  get_frame_register_value (struct frame_info *frame, int regnum)
 }
 
 LONGEST
-frame_unwind_register_signed (struct frame_info *frame, int regnum)
+frame_unwind_register_signed (frame_info *next_frame, int regnum)
 {
-  struct gdbarch *gdbarch = frame_unwind_arch (frame);
+  struct gdbarch *gdbarch = frame_unwind_arch (next_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int size = register_size (gdbarch, regnum);
-  struct value *value = frame_unwind_register_value (frame, regnum);
+  struct value *value = frame_unwind_register_value (next_frame, regnum);
 
   gdb_assert (value != NULL);
 
@@ -1287,12 +1289,12 @@  get_frame_register_signed (struct frame_info *frame, int regnum)
 }
 
 ULONGEST
-frame_unwind_register_unsigned (struct frame_info *frame, int regnum)
+frame_unwind_register_unsigned (frame_info *next_frame, int regnum)
 {
-  struct gdbarch *gdbarch = frame_unwind_arch (frame);
+  struct gdbarch *gdbarch = frame_unwind_arch (next_frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int size = register_size (gdbarch, regnum);
-  struct value *value = frame_unwind_register_value (frame, regnum);
+  struct value *value = frame_unwind_register_value (next_frame, regnum);
 
   gdb_assert (value != NULL);
 
diff --git a/gdb/frame.h b/gdb/frame.h
index a6f7fd8947d6..2793204e5683 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -26,7 +26,7 @@ 
 
    Prefixes:
 
-   get_frame_WHAT...(): Get WHAT from the THIS frame (functionaly
+   get_frame_WHAT...(): Get WHAT from the THIS frame (functionally
    equivalent to THIS->next->unwind->what)
 
    frame_unwind_WHAT...(): Unwind THIS frame's WHAT from the NEXT
@@ -559,7 +559,7 @@  const char *frame_stop_reason_string (struct frame_info *);
    (up, older) frame is returned.  If VALUEP is NULL, don't
    fetch/compute the value.  Instead just return the location of the
    value.  */
-extern void frame_register_unwind (struct frame_info *frame, int regnum,
+extern void frame_register_unwind (frame_info *frame, int regnum,
 				   int *optimizedp, int *unavailablep,
 				   enum lval_type *lvalp,
 				   CORE_ADDR *addrp, int *realnump,
@@ -571,22 +571,22 @@  extern void frame_register_unwind (struct frame_info *frame, int regnum,
    fetch fails.  The value methods never return NULL, but usually
    do return a lazy value.  */
 
-extern void frame_unwind_register (struct frame_info *frame,
+extern void frame_unwind_register (frame_info *next_frame,
 				   int regnum, gdb_byte *buf);
 extern void get_frame_register (struct frame_info *frame,
 				int regnum, gdb_byte *buf);
 
-struct value *frame_unwind_register_value (struct frame_info *frame,
+struct value *frame_unwind_register_value (frame_info *next_frame,
 					   int regnum);
 struct value *get_frame_register_value (struct frame_info *frame,
 					int regnum);
 
-extern LONGEST frame_unwind_register_signed (struct frame_info *frame,
+extern LONGEST frame_unwind_register_signed (frame_info *next_frame,
 					     int regnum);
 extern LONGEST get_frame_register_signed (struct frame_info *frame,
 					  int regnum);
-extern ULONGEST frame_unwind_register_unsigned (struct frame_info *frame,
-					       int regnum);
+extern ULONGEST frame_unwind_register_unsigned (frame_info *frame,
+						int regnum);
 extern ULONGEST get_frame_register_unsigned (struct frame_info *frame,
 					     int regnum);
 
@@ -669,7 +669,7 @@  extern int safe_frame_unwind_memory (struct frame_info *this_frame,
 extern struct gdbarch *get_frame_arch (struct frame_info *this_frame);
 
 /* Return the previous frame's architecture.  */
-extern struct gdbarch *frame_unwind_arch (struct frame_info *frame);
+extern struct gdbarch *frame_unwind_arch (frame_info *next_frame);
 
 /* Return the previous frame's architecture, skipping inline functions.  */
 extern struct gdbarch *frame_unwind_caller_arch (struct frame_info *frame);