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) <to_string>: 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.
This commit is contained in:
Andrew Burgess
2021-05-08 15:43:56 +01:00
parent 4821e618ad
commit 927c4e355e
7 changed files with 68 additions and 75 deletions

View File

@@ -156,14 +156,9 @@ frscm_print_frame_smob (SCM self, SCM port, scm_print_state *pstate)
{
frame_smob *f_smob = (frame_smob *) SCM_SMOB_DATA (self);
gdbscm_printf (port, "#<%s ", frame_smob_name);
string_file strfile;
fprint_frame_id (&strfile, f_smob->frame_id);
gdbscm_printf (port, "%s", strfile.c_str ());
scm_puts (">", port);
gdbscm_printf (port, "#<%s %s>",
frame_smob_name,
f_smob->frame_id.to_string ().c_str ());
scm_remember_upto_here_1 (self);
/* Non-zero means success. */