• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂c36205f0ccc36ac47b0191c02ceb5c06459ebea3 (tree)
時間2019-07-02 04:19:04
作者Pedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

Document the gdb-specific formatters

Change Summary

差異

--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -189,8 +189,54 @@ class ui_out
189189
190190 void spaces (int numspaces);
191191 void text (const char *string);
192+
193+ /* Output a printf-style formatted string. In addition to the usual
194+ printf format specs, this supports a few GDB-specific
195+ formatters:
196+
197+ - '%pF' - output a field.
198+
199+ The argument is a field, wrapped in any of the base_field_s
200+ subclasses. int_field for integer fields, styled_field for
201+ string fields. This is preferred over separate
202+ uiout->field_int(), uiout_>field_string() etc. calls when the
203+ formatted message is translatable. E.g.:
204+
205+ uiout->message (_("\nWatchpoint %pF deleted because the program has "
206+ "left the block in\n"
207+ "which its expression is valid.\n"),
208+ int_field ("wpnum", b->number));
209+
210+ - '%p[' - output the following text in a specified style.
211+ '%p]' - output the following text in the default style.
212+
213+ The argument to '%p[' is a ui_file_style pointer. The argument
214+ to '%p]' must be nullptr.
215+
216+ This is useful when you want to output some portion of a string
217+ literal in some style. E.g.:
218+
219+ uiout->message (_(" %p[<repeats %u times>%p]"),
220+ metadata_style.style ().ptr (),
221+ reps, repeats, nullptr);
222+
223+ - '%ps' - output a styled string.
224+
225+ The argument is the result of a call to styled_string. This is
226+ useful when you want to output some runtime-generated string in
227+ some style. E.g.:
228+
229+ uiout->message (_("this is a target address %ps.\n"),
230+ styled_string (address_style.style (),
231+ paddress (gdbarch, pc)));
232+
233+ Note that these all "abuse" the %p printf format spec, in order
234+ to be compatible with GCC's printf format checking. This is OK
235+ because code in GDB that wants to print a host address should use
236+ host_address_to_string instead of %p. */
192237 void message (const char *format, ...) ATTRIBUTE_PRINTF (2, 3);
193238 void vmessage (const char *format, va_list args) ATTRIBUTE_PRINTF (2, 0);
239+
194240 void wrap_hint (const char *identstring);
195241
196242 void flush ();
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -349,7 +349,10 @@ extern struct ui_file *gdb_stdtargin;
349349 extern void set_screen_width_and_height (int width, int height);
350350
351351 /* More generic printf like operations. Filtered versions may return
352- non-locally on error. */
352+ non-locally on error. As an extension over plain printf, these
353+ support some GDB-specific format specifiers. Particularly useful
354+ here are the styling formatters: '%p[', '%p]' and '%ps'. See
355+ ui_out::message for details. */
353356
354357 extern void fputs_filtered (const char *, struct ui_file *);
355358