From 927c4e355e307698d58e6cad17f866bf5515f16e Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Sat, 8 May 2021 15:43:56 +0100 Subject: gdb: replace fprint_frame_id Replace fprint_frame_id with a member function frame_id::to_string that returns a std::string. Convert all of the previous users of fprint_frame_id to use the new member function. This means that instead of writing things like this: fprintf_unfiltered (file, " id="); fprint_frame_id (file, s->id.id); We can write this: fprintf_unfiltered (file, " id=%s", s->id.id.to_string ().c_str ()); There should be no user visible changes after this commit. gdb/ChangeLog: * dummy-frame.c (fprint_dummy_frames): Convert use of fprint_frame_id to use frame_id::to_string. * frame.c (fprint_field): Delete. (fprint_frame_id): Moved to... (frame_id::to_string): ...this, rewritten to return a string. (fprint_frame): Convert use of fprint_frame_id to use frame_id::to_string. (compute_frame_id): Likewise. (frame_id_p): Likewise. (frame_id_eq): Likewise. (frame_id_inner): Likewise. * frame.h (struct frame_id) : New member function. (fprint_frame_id): Delete declaration. * guile/scm-frame.c (frscm_print_frame_smob): Convert use of fprint_frame_id to use frame_id::to_string. * python/py-frame.c (frame_object_to_frame_info): Likewise. * python/py-unwind.c (unwind_infopy_str): Likewise. (pyuw_this_id): Likewise. --- gdb/python/py-frame.c | 6 ++---- gdb/python/py-unwind.c | 10 +++------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 8e32ba5..c8eab52 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -79,10 +79,8 @@ frame_object_to_frame_info (PyObject *obj) static PyObject * frapy_str (PyObject *self) { - string_file strfile; - - fprint_frame_id (&strfile, ((frame_object *) self)->frame_id); - return PyString_FromString (strfile.c_str ()); + const frame_id &fid = ((frame_object *) self)->frame_id; + return PyString_FromString (fid.to_string ().c_str ()); } /* Implementation of gdb.Frame.is_valid (self) -> Boolean. diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index 4b25c48..c82fa3d 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -163,8 +163,7 @@ unwind_infopy_str (PyObject *self) unwind_info_object *unwind_info = (unwind_info_object *) self; string_file stb; - stb.puts ("Frame ID: "); - fprint_frame_id (&stb, unwind_info->frame_id); + stb.printf ("Frame ID: %s", unwind_info->frame_id.to_string ().c_str ()); { const char *sep = ""; struct value_print_options opts; @@ -433,11 +432,8 @@ pyuw_this_id (struct frame_info *this_frame, void **cache_ptr, { *this_id = ((cached_frame_info *) *cache_ptr)->frame_id; if (pyuw_debug >= 1) - { - fprintf_unfiltered (gdb_stdlog, "%s: frame_id: ", __FUNCTION__); - fprint_frame_id (gdb_stdlog, *this_id); - fprintf_unfiltered (gdb_stdlog, "\n"); - } + fprintf_unfiltered (gdb_stdlog, "%s: frame_id: %s\n", __FUNCTION__, + this_id->to_string ().c_str ()); } /* frame_unwind.prev_register. */ -- cgit v1.1