* [PATCH v4] Align natural-format register values to the same column
@ 2018-02-03 11:42 Ruslan Kabatsayev
2018-02-04 21:59 ` Simon Marchi
2018-06-05 18:20 ` [PATCH] Fix "info registers" regexes in gdb.base/jit-reader.exp Simon Marchi
0 siblings, 2 replies; 5+ messages in thread
From: Ruslan Kabatsayev @ 2018-02-03 11:42 UTC (permalink / raw)
To: gdb-patches; +Cc: Ruslan Kabatsayev
Currently, commands such as "info reg", "info all-reg", as well as register
window in the TUI print badly aligned columns, like here:
eax 0x1 1
ecx 0xffffd3e0 -11296
edx 0xffffd404 -11260
ebx 0xf7fa5ff4 -134586380
esp 0xffffd390 0xffffd390
ebp 0xffffd3c8 0xffffd3c8
esi 0x0 0
edi 0x0 0
eip 0x8048b60 0x8048b60 <main+16>
eflags 0x286 [ PF SF IF ]
cs 0x23 35
ss 0x2b 43
ds 0x2b 43
es 0x2b 43
fs 0x0 0
gs 0x63 99
After this patch, these commands print the third column values consistently
aligned one under another, provided the second column is not too long.
Originally, the third column was (attempted to be) aligned using a simple tab
character. This patch changes the alignment to spaces only. The tests checking
the output and expecting the single tab have been fixed in a previous patch, so
this change doesn't break any.
gdb/ChangeLog:
* infcmd.c (default_print_one_register_info): Align natural-format
column values consistently one under another.
(pad_to_column): New function.
---
gdb/infcmd.c | 40 ++++++++++++++++++++++++++++++----------
1 file changed, 30 insertions(+), 10 deletions(-)
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index ccf08bd..3879df3 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2283,6 +2283,16 @@ path_command (const char *dirname, int from_tty)
}
\f
+static void
+pad_to_column (string_file &stream, int col)
+{
+ /* At least one space must be printed to separate columns. */
+ stream.putc (' ');
+ const int size = stream.size ();
+ if (size < col)
+ stream.puts (n_spaces (col - size));
+}
+
/* Print out the register NAME with value VAL, to FILE, in the default
fashion. */
@@ -2293,9 +2303,17 @@ default_print_one_register_info (struct ui_file *file,
{
struct type *regtype = value_type (val);
int print_raw_format;
+ string_file format_stream;
+ enum tab_stops
+ {
+ value_column_1 = 15,
+ /* Give enough room for "0x", 16 hex digits and two spaces in
+ preceding column. */
+ value_column_2 = value_column_1 + 2 + 16 + 2,
+ };
- fputs_filtered (name, file);
- print_spaces_filtered (15 - strlen (name), file);
+ format_stream.puts (name);
+ pad_to_column (format_stream, value_column_1);
print_raw_format = (value_entirely_available (val)
&& !value_optimized_out (val));
@@ -2314,14 +2332,15 @@ default_print_one_register_info (struct ui_file *file,
val_print (regtype,
value_embedded_offset (val), 0,
- file, 0, val, &opts, current_language);
+ &format_stream, 0, val, &opts, current_language);
if (print_raw_format)
{
- fprintf_filtered (file, "\t(raw ");
- print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order,
- true);
- fprintf_filtered (file, ")");
+ pad_to_column (format_stream, value_column_2);
+ format_stream.puts ("(raw ");
+ print_hex_chars (&format_stream, valaddr, TYPE_LENGTH (regtype),
+ byte_order, true);
+ format_stream.putc (')');
}
}
else
@@ -2333,20 +2352,21 @@ default_print_one_register_info (struct ui_file *file,
opts.deref_ref = 1;
val_print (regtype,
value_embedded_offset (val), 0,
- file, 0, val, &opts, current_language);
+ &format_stream, 0, val, &opts, current_language);
/* If not a vector register, print it also according to its
natural format. */
if (print_raw_format && TYPE_VECTOR (regtype) == 0)
{
+ pad_to_column (format_stream, value_column_2);
get_user_print_options (&opts);
opts.deref_ref = 1;
- fprintf_filtered (file, "\t");
val_print (regtype,
value_embedded_offset (val), 0,
- file, 0, val, &opts, current_language);
+ &format_stream, 0, val, &opts, current_language);
}
}
+ fputs_filtered (format_stream.c_str (), file);
fprintf_filtered (file, "\n");
}
--
1.7.10.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] Align natural-format register values to the same column
2018-02-03 11:42 [PATCH v4] Align natural-format register values to the same column Ruslan Kabatsayev
@ 2018-02-04 21:59 ` Simon Marchi
2018-02-05 8:34 ` Ruslan Kabatsayev
2018-06-05 18:20 ` [PATCH] Fix "info registers" regexes in gdb.base/jit-reader.exp Simon Marchi
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2018-02-04 21:59 UTC (permalink / raw)
To: Ruslan Kabatsayev, gdb-patches
On 2018-02-03 06:42 AM, Ruslan Kabatsayev wrote:
> Currently, commands such as "info reg", "info all-reg", as well as register
> window in the TUI print badly aligned columns, like here:
>
> eax 0x1 1
> ecx 0xffffd3e0 -11296
> edx 0xffffd404 -11260
> ebx 0xf7fa5ff4 -134586380
> esp 0xffffd390 0xffffd390
> ebp 0xffffd3c8 0xffffd3c8
> esi 0x0 0
> edi 0x0 0
> eip 0x8048b60 0x8048b60 <main+16>
> eflags 0x286 [ PF SF IF ]
> cs 0x23 35
> ss 0x2b 43
> ds 0x2b 43
> es 0x2b 43
> fs 0x0 0
> gs 0x63 99
>
> After this patch, these commands print the third column values consistently
> aligned one under another, provided the second column is not too long.
> Originally, the third column was (attempted to be) aligned using a simple tab
> character. This patch changes the alignment to spaces only. The tests checking
> the output and expecting the single tab have been fixed in a previous patch, so
> this change doesn't break any.
Thanks, this version LGTM, please push.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4] Align natural-format register values to the same column
2018-02-04 21:59 ` Simon Marchi
@ 2018-02-05 8:34 ` Ruslan Kabatsayev
0 siblings, 0 replies; 5+ messages in thread
From: Ruslan Kabatsayev @ 2018-02-05 8:34 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
On 5 February 2018 at 00:59, Simon Marchi <simark@simark.ca> wrote:
> On 2018-02-03 06:42 AM, Ruslan Kabatsayev wrote:
>> Currently, commands such as "info reg", "info all-reg", as well as register
>> window in the TUI print badly aligned columns, like here:
>>
>> eax 0x1 1
>> ecx 0xffffd3e0 -11296
>> edx 0xffffd404 -11260
>> ebx 0xf7fa5ff4 -134586380
>> esp 0xffffd390 0xffffd390
>> ebp 0xffffd3c8 0xffffd3c8
>> esi 0x0 0
>> edi 0x0 0
>> eip 0x8048b60 0x8048b60 <main+16>
>> eflags 0x286 [ PF SF IF ]
>> cs 0x23 35
>> ss 0x2b 43
>> ds 0x2b 43
>> es 0x2b 43
>> fs 0x0 0
>> gs 0x63 99
>>
>> After this patch, these commands print the third column values consistently
>> aligned one under another, provided the second column is not too long.
>> Originally, the third column was (attempted to be) aligned using a simple tab
>> character. This patch changes the alignment to spaces only. The tests checking
>> the output and expecting the single tab have been fixed in a previous patch, so
>> this change doesn't break any.
>
> Thanks, this version LGTM, please push.
Pushed.
>
> Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Fix "info registers" regexes in gdb.base/jit-reader.exp
2018-02-03 11:42 [PATCH v4] Align natural-format register values to the same column Ruslan Kabatsayev
2018-02-04 21:59 ` Simon Marchi
@ 2018-06-05 18:20 ` Simon Marchi
2018-06-22 17:43 ` Simon Marchi
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2018-06-05 18:20 UTC (permalink / raw)
To: gdb-patches; +Cc: b7.10110111, Simon Marchi
Commit
e813d34 ("Align natural-format register values to the same column")
changed the output of "info registers" (tabs to spaces), but didn't
update gdb.base/jit-reader.exp. Update the regexes to expect spaces
instead.
For some reason, this test is skipped by the buildbot (even in the
native x86-64 configuration), so we missed it. We will need to
investigate why...
gdb/testsuite/ChangeLog:
* gdb.base/jit-reader.exp (jit_reader_test): Expect spaces in
"info registers" output.
---
gdb/testsuite/gdb.base/jit-reader.exp | 54 +++++++++++++++++------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
index 7a1e287..2ed7410 100644
--- a/gdb/testsuite/gdb.base/jit-reader.exp
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -67,30 +67,30 @@ proc info_registers_current_frame {sp} {
gdb_test "info registers" \
[multi_line \
- "rax $hex $decimal" \
- "rbx $hex $decimal" \
- "rcx $hex $decimal" \
- "rdx $hex $decimal" \
- "rsi $hex $decimal" \
- "rdi $hex $decimal" \
- "rbp $hex $hex" \
- "rsp $sp $sp" \
- "r8 $hex $decimal" \
- "r9 $hex $decimal" \
- "r10 $hex $decimal" \
- "r11 $hex $decimal" \
- "r12 $hex $decimal" \
- "r13 $hex $decimal" \
- "r14 $hex $decimal" \
- "r15 $hex $decimal" \
- "rip $hex $hex$any" \
- "eflags $hex \\\[$any\\\]" \
- "cs $hex $decimal" \
- "ss $hex $decimal" \
- "ds $hex $decimal" \
- "es $hex $decimal" \
- "fs $hex $decimal" \
- "gs $hex $decimal" \
+ "rax $hex +$decimal" \
+ "rbx $hex +$decimal" \
+ "rcx $hex +$decimal" \
+ "rdx $hex +$decimal" \
+ "rsi $hex +$decimal" \
+ "rdi $hex +$decimal" \
+ "rbp $hex +$hex" \
+ "rsp $sp +$sp" \
+ "r8 $hex +$decimal" \
+ "r9 $hex +$decimal" \
+ "r10 $hex +$decimal" \
+ "r11 $hex +$decimal" \
+ "r12 $hex +$decimal" \
+ "r13 $hex +$decimal" \
+ "r14 $hex +$decimal" \
+ "r15 $hex +$decimal" \
+ "rip $hex +$hex$any" \
+ "eflags $hex +\\\[$any\\\]" \
+ "cs $hex +$decimal" \
+ "ss $hex +$decimal" \
+ "ds $hex +$decimal" \
+ "es $hex +$decimal" \
+ "fs $hex +$decimal" \
+ "gs $hex +$decimal" \
]
}
@@ -177,8 +177,8 @@ proc jit_reader_test {} {
"rdx <not saved>" \
"rsi <not saved>" \
"rdi <not saved>" \
- "rbp $hex $hex" \
- "rsp $caller_sp $caller_sp" \
+ "rbp $hex +$hex" \
+ "rsp $caller_sp +$caller_sp" \
"r8 <not saved>" \
"r9 <not saved>" \
"r10 <not saved>" \
@@ -187,7 +187,7 @@ proc jit_reader_test {} {
"r13 <not saved>" \
"r14 <not saved>" \
"r15 <not saved>" \
- "rip $hex $hex $any" \
+ "rip $hex +$hex $any" \
"eflags <not saved>" \
"cs <not saved>" \
"ss <not saved>" \
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix "info registers" regexes in gdb.base/jit-reader.exp
2018-06-05 18:20 ` [PATCH] Fix "info registers" regexes in gdb.base/jit-reader.exp Simon Marchi
@ 2018-06-22 17:43 ` Simon Marchi
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2018-06-22 17:43 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches, b7.10110111
On 2018-06-05 14:19, Simon Marchi wrote:
> Commit
>
> e813d34 ("Align natural-format register values to the same column")
>
> changed the output of "info registers" (tabs to spaces), but didn't
> update gdb.base/jit-reader.exp. Update the regexes to expect spaces
> instead.
>
> For some reason, this test is skipped by the buildbot (even in the
> native x86-64 configuration), so we missed it. We will need to
> investigate why...
I pushed this.
In the end, the x86-64 builder had a problem causing gcc to fail to
compile all the test cases, leading to all of them being skipped. It
looks fine now.
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-22 17:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-03 11:42 [PATCH v4] Align natural-format register values to the same column Ruslan Kabatsayev
2018-02-04 21:59 ` Simon Marchi
2018-02-05 8:34 ` Ruslan Kabatsayev
2018-06-05 18:20 ` [PATCH] Fix "info registers" regexes in gdb.base/jit-reader.exp Simon Marchi
2018-06-22 17:43 ` Simon Marchi
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).