public inbox for gdb-testers@sourceware.org help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Subject: [binutils-gdb] Refactor val_print and common_val_print Date: Tue, 24 Mar 2020 00:26:45 -0400 [thread overview] Message-ID: <b0c26e99f50d6926dd628ec51c1e9a037c521ab5@gdb-build> (raw) *** TEST RESULTS FOR COMMIT b0c26e99f50d6926dd628ec51c1e9a037c521ab5 *** commit b0c26e99f50d6926dd628ec51c1e9a037c521ab5 Author: Tom Tromey <tom@tromey.com> AuthorDate: Fri Mar 13 17:39:52 2020 -0600 Commit: Tom Tromey <tom@tromey.com> CommitDate: Fri Mar 13 18:03:39 2020 -0600 Refactor val_print and common_val_print This changes val_print and common_val_print to use a new helper function. A theme in the coming patches is that calls to val_print itself should be removed. This is the first such patch; at the end of the series, we'll remove val_print and simplify do_val_print. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * valprint.c (do_val_print): New function, from val_print. (val_print): Use do_val_print. (common_val_print): Use do_val_print. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 13f186e03b..2a2b29887f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2020-03-13 Tom Tromey <tom@tromey.com> + + * valprint.c (do_val_print): New function, from val_print. + (val_print): Use do_val_print. + (common_val_print): Use do_val_print. + 2020-03-13 Tom Tromey <tom@tromey.com> * valprint.c (value_print): Use scoped_value_mark. diff --git a/gdb/valprint.c b/gdb/valprint.c index 4383915de7..66da0e607b 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1033,31 +1033,17 @@ generic_val_print (struct type *type, } } -/* Print using the given LANGUAGE the data of type TYPE located at - VAL's contents buffer + EMBEDDED_OFFSET (within GDB), which came - from the inferior at address ADDRESS + EMBEDDED_OFFSET, onto - stdio stream STREAM according to OPTIONS. VAL is the whole object - that came from ADDRESS. - - The language printers will pass down an adjusted EMBEDDED_OFFSET to - further helper subroutines as subfields of TYPE are printed. In - such cases, VAL is passed down unadjusted, so - that VAL can be queried for metadata about the contents data being - printed, using EMBEDDED_OFFSET as an offset into VAL's contents - buffer. For example: "has this field been optimized out", or "I'm - printing an object while inspecting a traceframe; has this - particular piece of data been collected?". +/* Helper function for val_print and common_val_print that does the + work. Arguments are as to val_print, but FULL_VALUE, if given, is + the value to be printed. */ - RECURSE indicates the amount of indentation to supply before - continuation lines; this amount is roughly twice the value of - RECURSE. */ - -void -val_print (struct type *type, LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options, - const struct language_defn *language) +static void +do_val_print (struct value *full_value, + struct type *type, LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, int recurse, + struct value *val, + const struct value_print_options *options, + const struct language_defn *language) { int ret = 0; struct value_print_options local_opts = *options; @@ -1117,6 +1103,36 @@ val_print (struct type *type, LONGEST embedded_offset, } } +/* Print using the given LANGUAGE the data of type TYPE located at + VAL's contents buffer + EMBEDDED_OFFSET (within GDB), which came + from the inferior at address ADDRESS + EMBEDDED_OFFSET, onto + stdio stream STREAM according to OPTIONS. VAL is the whole object + that came from ADDRESS. + + The language printers will pass down an adjusted EMBEDDED_OFFSET to + further helper subroutines as subfields of TYPE are printed. In + such cases, VAL is passed down unadjusted, so + that VAL can be queried for metadata about the contents data being + printed, using EMBEDDED_OFFSET as an offset into VAL's contents + buffer. For example: "has this field been optimized out", or "I'm + printing an object while inspecting a traceframe; has this + particular piece of data been collected?". + + RECURSE indicates the amount of indentation to supply before + continuation lines; this amount is roughly twice the value of + RECURSE. */ + +void +val_print (struct type *type, LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, int recurse, + struct value *val, + const struct value_print_options *options, + const struct language_defn *language) +{ + do_val_print (nullptr, type, embedded_offset, address, stream, + recurse, val, options, language); +} + /* See valprint.h. */ bool @@ -1214,10 +1230,10 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse, if (value_lazy (val)) value_fetch_lazy (val); - val_print (value_type (val), - value_embedded_offset (val), value_address (val), - stream, recurse, - val, options, language); + do_val_print (val, value_type (val), + value_embedded_offset (val), value_address (val), + stream, recurse, + val, options, language); } /* Print on stream STREAM the value VAL according to OPTIONS. The value
next reply other threads:[~2020-03-24 4:26 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-24 4:26 gdb-buildbot [this message] 2020-03-24 4:26 ` Failures on Fedora-x86_64-cc-with-index, branch master gdb-buildbot 2020-03-24 4:34 ` Failures on Fedora-i686, " gdb-buildbot 2020-03-24 4:56 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2020-03-24 5:09 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2020-03-24 5:35 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2020-03-24 6:02 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2020-03-27 2:40 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot 2020-03-27 15:55 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=b0c26e99f50d6926dd628ec51c1e9a037c521ab5@gdb-build \ --to=gdb-buildbot@sergiodj.net \ --cc=gdb-testers@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).