diff options
author | Tom Tromey <tromey@adacore.com> | 2022-02-16 12:33:45 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-03-07 08:27:38 -0700 |
commit | aacf24b4db3422632d6b62d473faf71f4e737072 (patch) | |
tree | e9eb89f6b38799c82634bd6d664eb0c6fa1b7202 /gdb/ada-valprint.c | |
parent | 63fc2437deda87a566059444630ccc402945ae99 (diff) | |
download | gdb-aacf24b4db3422632d6b62d473faf71f4e737072.zip gdb-aacf24b4db3422632d6b62d473faf71f4e737072.tar.gz gdb-aacf24b4db3422632d6b62d473faf71f4e737072.tar.bz2 |
Fix bug in ada_print_floating
ada_print_floating rewrites a floating-point string representation to
conform to Ada syntax. However, if you managed to get a floating
point error, you might see:
(gdb) print whatever
$2 = <invalid float valu.0e>
What's happening here is that ada_print_floating doesn't recognize
this error case, and proceeds to modify the error text.
This patch fixes this problem.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r-- | gdb/ada-valprint.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index bf95719..e113088 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -314,6 +314,13 @@ ada_print_floating (const gdb_byte *valaddr, struct type *type, std::string s = tmp_stream.release (); size_t skip_count = 0; + /* Don't try to modify a result representing an error. */ + if (s[0] == '<') + { + fputs_filtered (s.c_str (), stream); + return; + } + /* Modify for Ada rules. */ size_t pos = s.find ("inf"); |