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] Introduce c_value_print_int Date: Fri, 27 Mar 2020 11:14:27 -0400 [thread overview] Message-ID: <2faac269d59e57a49cd9f9209e1d39e03e2744bc@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 2faac269d59e57a49cd9f9209e1d39e03e2744bc *** commit 2faac269d59e57a49cd9f9209e1d39e03e2744bc 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:41 2020 -0600 Introduce c_value_print_int This adds c_value_print_int, a value-based analogue of c_val_print_int. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * c-valprint.c (c_value_print_int): New function. (c_value_print_inner): Use it. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 98223d4dfb..b5d41ae130 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-03-13 Tom Tromey <tom@tromey.com> + + * c-valprint.c (c_value_print_int): New function. + (c_value_print_inner): Use it. + 2020-03-13 Tom Tromey <tom@tromey.com> * c-valprint.c (c_value_print_ptr): New function. diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 6cac9e0b57..80ba5d7195 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -502,6 +502,37 @@ c_val_print_int (struct type *type, struct type *unresolved_type, } } +/* c_value_print helper for TYPE_CODE_INT. */ + +static void +c_value_print_int (struct value *val, struct ui_file *stream, + const struct value_print_options *options) +{ + if (options->format || options->output_format) + { + struct value_print_options opts = *options; + + opts.format = (options->format ? options->format + : options->output_format); + value_print_scalar_formatted (val, &opts, 0, stream); + } + else + { + value_print_scalar_formatted (val, options, 0, stream); + /* C and C++ has no single byte int type, char is used + instead. Since we don't know whether the value is really + intended to be used as an integer or a character, print + the character equivalent as well. */ + struct type *type = value_type (val); + const gdb_byte *valaddr = value_contents_for_printing (val); + if (c_textual_element_type (type, options->format)) + { + fputs_filtered (" ", stream); + LA_PRINT_CHAR (unpack_long (type, valaddr), type, stream); + } + } +} + /* c_val_print helper for TYPE_CODE_MEMBERPTR. */ static void @@ -602,7 +633,6 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options) { struct type *type = value_type (val); - struct type *unresolved_type = type; CORE_ADDR address = value_address (val); const gdb_byte *valaddr = value_contents_for_printing (val); @@ -633,8 +663,7 @@ c_value_print_inner (struct value *val, struct ui_file *stream, int recurse, break; case TYPE_CODE_INT: - c_val_print_int (type, unresolved_type, valaddr, 0, stream, - val, options); + c_value_print_int (val, stream, options); break; case TYPE_CODE_MEMBERPTR:
next reply other threads:[~2020-03-27 15:14 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-27 15:14 gdb-buildbot [this message] 2020-03-27 15:14 ` Failures on Fedora-i686, branch master gdb-buildbot 2020-03-27 15:36 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2020-03-27 15:45 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2020-03-27 16:24 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2020-03-27 16:25 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2020-03-27 17:22 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2020-03-30 23:59 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot 2020-03-31 1:53 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot 2020-03-31 16:16 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot 2020-03-31 18:04 ` Failures on Ubuntu-Aarch64-native-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=2faac269d59e57a49cd9f9209e1d39e03e2744bc@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).