This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 3/4] Deprecate frame_stop_reason_string.


On 29/05/2014 10:00 AM, Pedro Alves wrote:
> On 05/29/2014 12:26 AM, Andrew Burgess wrote:
>> On 28/05/2014 6:26 PM, Pedro Alves wrote:
>>> On 04/30/2014 11:55 AM, Andrew Burgess wrote:
> 
>>> IMO, the real problem with its signature is the "frame_" in its name.
>>> The function converts an 'enum unwind_stop_reason' value to a string,
>>> so like other similar cases in the tree, how about renaming the function
>>> to match?  E.g.:
>>>
>>> -const char *frame_stop_reason_string (enum unwind_stop_reason);
>>> +const char *unwind_stop_reason_to_string (enum unwind_stop_reason);
>>
>> I've gone with this suggestion, updated patch below.  Is this OK to apply?
> 
> Not yet, sorry.
> 
>> 	* frame.c (frame_stop_reason_string): Rename to ...
>> 	(unwind_frame_stop_reason_string): this.
> 
> This still has "frame" in the name, and misses the "to".  Any reason for that?

No, just me being special :)

I think this attempt should do it,
  frame_stop_reason_string -> unwind_stop_reason_to_string

OK?

Thanks,
Andrew

---

This function is confusingly named, the "frame_" in the name implies it
somehow is frame dependent, when in reality the function just converts an
'enum unwind_stop_reason' value to a string.

gdb/ChangeLog:

	* frame.c (frame_stop_reason_string): Rename to ...
	(unwind_stop_reason_to_string): this.
	* frame.h (frame_stop_reason_string): Rename to ...
	(unwind_stop_reason_to_string): this.
	* stack.c (frame_info): Update call to frame_stop_reason_string.
	(backtrace_command_1): Likewise.
	* guile/scm-frame.c (gdbscm_unwind_stop_reason_string): Likewise.
	* python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise.
---
 gdb/frame.c           | 2 +-
 gdb/frame.h           | 2 +-
 gdb/guile/scm-frame.c | 2 +-
 gdb/python/py-frame.c | 2 +-
 gdb/stack.c           | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/frame.c b/gdb/frame.c
index cbff25f..f44cf50 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2561,7 +2561,7 @@ get_frame_unwind_stop_reason (struct frame_info *frame)
 /* Return a string explaining REASON.  */
 
 const char *
-frame_stop_reason_string (enum unwind_stop_reason reason)
+unwind_stop_reason_to_string (enum unwind_stop_reason reason)
 {
   switch (reason)
     {
diff --git a/gdb/frame.h b/gdb/frame.h
index ad03a0b..79881521d 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -503,7 +503,7 @@ enum unwind_stop_reason get_frame_unwind_stop_reason (struct frame_info *);
 
 /* Translate a reason code to an informative string.  */
 
-const char *frame_stop_reason_string (enum unwind_stop_reason);
+const char *unwind_stop_reason_to_string (enum unwind_stop_reason);
 
 /* Unwind the stack frame so that the value of REGNUM, in the previous
    (up, older) frame is returned.  If VALUEP is NULL, don't
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index 8800923..9c0b00d 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -933,7 +933,7 @@ gdbscm_unwind_stop_reason_string (SCM reason_scm)
   if (reason < UNWIND_FIRST || reason > UNWIND_LAST)
     scm_out_of_range (FUNC_NAME, reason_scm);
 
-  str = frame_stop_reason_string (reason);
+  str = unwind_stop_reason_to_string (reason);
   return gdbscm_scm_from_c_string (str);
 }
 
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 8c80d39..77077d3 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -588,7 +588,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args)
       return NULL;
     }
 
-  str = frame_stop_reason_string (reason);
+  str = unwind_stop_reason_to_string (reason);
   return PyUnicode_Decode (str, strlen (str), host_charset (), NULL);
 }
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 297ba32..630a363 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1529,7 +1529,7 @@ frame_info (char *addr_exp, int from_tty)
       reason = get_frame_unwind_stop_reason (fi);
       if (reason != UNWIND_NO_REASON)
 	printf_filtered (_(" Outermost frame: %s\n"),
-			 frame_stop_reason_string (reason));
+			 unwind_stop_reason_to_string (reason));
     }
   else if (get_frame_type (fi) == TAILCALL_FRAME)
     puts_filtered (" tail call frame");
@@ -1848,7 +1848,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
 	  reason = get_frame_unwind_stop_reason (trailing);
 	  if (reason >= UNWIND_FIRST_ERROR)
 	    printf_filtered (_("Backtrace stopped: %s\n"),
-			     frame_stop_reason_string (reason));
+			     unwind_stop_reason_to_string (reason));
 	}
     }
 }
-- 
1.8.1.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]