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 generic_value_print_char Date: Fri, 27 Mar 2020 00:59:42 -0400 [thread overview] Message-ID: <3eec3b05b9ecf5e726c606f0bba916e095dcbe98@gdb-build> (raw) *** TEST RESULTS FOR COMMIT 3eec3b05b9ecf5e726c606f0bba916e095dcbe98 *** commit 3eec3b05b9ecf5e726c606f0bba916e095dcbe98 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 generic_value_print_char This adds generic_value_print_char, a value-based analogue of generic_val_print_char. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * valprint.c (generic_value_print_char): New function (generic_value_print): Use it. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2ca8e66a12..ccf0d1e421 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-03-13 Tom Tromey <tom@tromey.com> + + * valprint.c (generic_value_print_char): New function + (generic_value_print): Use it. + 2020-03-13 Tom Tromey <tom@tromey.com> * valprint.c (generic_value_print_int): New function. diff --git a/gdb/valprint.c b/gdb/valprint.c index c9ad274927..8c2d1aa195 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -883,6 +883,36 @@ generic_val_print_char (struct type *type, struct type *unresolved_type, } } +/* generic_value_print helper for TYPE_CODE_CHAR. */ + +static void +generic_value_print_char (struct value *value, 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 (value, &opts, 0, stream); + } + else + { + struct type *unresolved_type = value_type (value); + struct type *type = check_typedef (unresolved_type); + const gdb_byte *valaddr = value_contents_for_printing (value); + + LONGEST val = unpack_long (type, valaddr); + if (TYPE_UNSIGNED (type)) + fprintf_filtered (stream, "%u", (unsigned int) val); + else + fprintf_filtered (stream, "%d", (int) val); + fputs_filtered (" ", stream); + LA_PRINT_CHAR (val, unresolved_type, stream); + } +} + /* generic_val_print helper for TYPE_CODE_FLT and TYPE_CODE_DECFLOAT. */ static void @@ -1084,7 +1114,6 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, const struct generic_val_print_decorations *decorations) { struct type *type = value_type (val); - struct type *unresolved_type = type; type = check_typedef (type); switch (TYPE_CODE (type)) @@ -1151,8 +1180,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, break; case TYPE_CODE_CHAR: - generic_val_print_char (type, unresolved_type, 0, - stream, val, options); + generic_value_print_char (val, stream, options); break; case TYPE_CODE_FLT:
next reply other threads:[~2020-03-27 4:59 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-27 4:59 gdb-buildbot [this message] 2020-03-27 4:59 ` Failures on Fedora-i686, branch master gdb-buildbot 2020-03-27 5:06 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot 2020-03-27 5:38 ` Failures on Fedora-x86_64-m64, " gdb-buildbot 2020-03-27 5:46 ` Failures on Fedora-x86_64-m32, " gdb-buildbot 2020-03-27 6:17 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot 2020-03-27 6:40 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot 2020-03-30 12:34 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot 2020-03-30 15:36 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot 2020-03-31 4:35 ` Failures on Ubuntu-Aarch64-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=3eec3b05b9ecf5e726c606f0bba916e095dcbe98@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).