[commit] Add error-message parameter to get_selected_frame

Andrew Cagney cagney@gnu.org
Fri Oct 29 20:30:00 GMT 2004


This adds a message parameter to get_selected_frame vis:

struct frame_info *get_selected_frame (const char *message);

When the attempt to get a selected frame fails, and there's a non-NULL 
message, that message instead of an error is printed as the fail reason.

This finally lets us clean up things like:

-  if (!deprecated_selected_frame)
-    error ("No frame selected.");
-  print_frame_local_vars (deprecated_selected_frame, 0, gdb_stdout);
+  print_frame_local_vars (get_selected_frame ("No frame selected."),
+                         0, gdb_stdout);


-  if (target_has_stack == 0 || deprecated_selected_frame == 0)
-    error ("No stack.");
-  print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame ("No stack."), 1, SRC_AND_LOC);

A follow-on patch will clean up more cases.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20041029/7ff25a1f/attachment.ksh>

More information about the Gdb-patches mailing list