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: [RFC] -thread-select double print stack frame


 > 2007-03-19  Denis Pilat  <denis.pilat@st.com>
 > 
 > 	* thread.c (do_captured_thread_select): print_stack_frame use
 > 	LOC_AND_ADDRESS for mi output.
 > 
 > Index: thread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/thread.c,v
 > retrieving revision 1.51
 > diff -u -p -r1.51 thread.c
 > --- thread.c	28 Feb 2007 17:35:01 -0000	1.51
 > +++ thread.c	19 Mar 2007 13:27:53 -0000
 > @@ -700,7 +700,12 @@ do_captured_thread_select (struct ui_out
 >    ui_out_text (uiout, target_tid_to_str (inferior_ptid));
 >    ui_out_text (uiout, ")]");
 >  
 > -  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
 > +  /* For mi, we just print location.  */
 > +  if (ui_out_is_mi_like_p (uiout))
 > +    print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS);
 > +  else
 > +    print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
 > +
 >    return GDB_RC_OK;
 >  }
 >  

While this surely fixes the immediate problem, I'm not sure it's the best way.
For example, we could have:

args.print_what = ui_out_is_mi_like_p (uiout) ? LOC_AND_ADDRESS : print_what

in print_stack_frame, to centralise things and remove the need for the clause
in normal_stop.

Furthermore, I don't understand why file and line details are duplicated in MI,
but not CLI.  It has something to do with uiout->flags not being 0 in MI (from
looking at print_source_lines_base).  The frame printing code is either one big
mess, or I'm not seeing the underlying structure at the moment.  Hopefully it's
the latter.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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