public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/27340] New: Output does not respect set width value in some cases.
@ 2021-02-03 20:53 abidh at codesourcery dot com
2021-12-27 6:38 ` [Bug gdb/27340] " tromey at sourceware dot org
2022-01-04 11:22 ` abidh at sourceware dot org
0 siblings, 2 replies; 3+ messages in thread
From: abidh at codesourcery dot com @ 2021-02-03 20:53 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27340
Bug ID: 27340
Summary: Output does not respect set width value in some cases.
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: abidh at codesourcery dot com
Target Milestone: ---
I was investigating test failure of gdb.base/style.exp and noticed a problem
that can be seen in the following example session below.
(gdb) frame
#0 main (argc=1, argv=0x7fffffffdf08) at
/home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:45
45 return some_called_function (); /* break here */
(gdb) set width 20
(gdb) frame
#0 main (argc=1,
argv=0x7fffffffdf08)
at /home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:45
45 return some_called_function (); /* break here */
(gdb) set width 24
(gdb) frame
#0 main (argc=1,
argv=0x7fffffffdf08) at
/home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:45
45 return some_called_function (); /* break here */
(gdb)
Note that:
Filename is printed on the next line with width == 20
Filename is printed on the same line when width == 24
Here 24 is significant. Problem only manifests itself when number of digits in
the argv are (width - 12). The gdb.base/style.exp checks with width of 20 and
30. As it happens, the 'argv' parameter had 8 digit for aarch64-none-elf target
so the test failed on this platform for me.
I stepped through code a bit. When 'fputs_maybe_filtered' is printing stuff and
output is about to cross width, it will set 'chars_printed' to 0 but as
'wrap_column' is 0, it will not add a newline in the output. Now if we end up
calling 'wrap_here' before printing any more character then 'wrap_column' will
stay 0 as 'chars_printed' is still 0.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug gdb/27340] Output does not respect set width value in some cases.
2021-02-03 20:53 [Bug gdb/27340] New: Output does not respect set width value in some cases abidh at codesourcery dot com
@ 2021-12-27 6:38 ` tromey at sourceware dot org
2022-01-04 11:22 ` abidh at sourceware dot org
1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2021-12-27 6:38 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27340
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Does this still happen?
I wonder if it's possible to update the test to show the failure.
Or copy it and write a new test.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug gdb/27340] Output does not respect set width value in some cases.
2021-02-03 20:53 [Bug gdb/27340] New: Output does not respect set width value in some cases abidh at codesourcery dot com
2021-12-27 6:38 ` [Bug gdb/27340] " tromey at sourceware dot org
@ 2022-01-04 11:22 ` abidh at sourceware dot org
1 sibling, 0 replies; 3+ messages in thread
From: abidh at sourceware dot org @ 2022-01-04 11:22 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27340
--- Comment #2 from Hafiz Abid Qadeer <abidh at sourceware dot org> ---
I think problem is still there. Here is the small session that shows it. Note
that file is printed on same line only for width=24 and not for 23 or 25.
Following patch can make the style.exp fail on my x86_64 ubuntu 20.04 machine.
diff --git a/gdb/testsuite/gdb.base/style.exp
b/gdb/testsuite/gdb.base/style.exp
index 2cd155d2cf2..4c89bfb55bc 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -131,7 +131,7 @@ proc run_style_tests { } {
# Regression test for a bug where line-wrapping would occur at
# the wrong spot with styling. There were different bugs at
# different widths, so try two.
- foreach width {20 30} {
+ foreach width {24 30} {
set argv_len [string length $argv]
if { $argv_len == 0 } {
continue
@@ -159,7 +159,7 @@ proc run_style_tests { } {
# - closing parenthesis
set line_len [expr 4 + $argv_len + 1]
- if { $line_len > $width } {
+ if { $line_len >= $width } {
# At on the next line.
set re_styled $re1_styled
} else {
gdb gdb/testsuite/outputs/gdb.base/style/style
GNU gdb (GDB) 12.0.50.20220104-git
...
Reading symbols from gdb/testsuite/outputs/gdb.base/style/style...
(gdb) start
Temporary breakpoint 1 at 0x65b: file
/home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c, line 52.
Starting program:
/mnt/work/obj/gdb/upstream/native/obj/gdb/testsuite/outputs/gdb.base/style/style
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdef8) at
/home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:52
52 return some_called_function (); /* break here */
(gdb) set width 23
(gdb) frame
#0 main (argc=1,
argv=0x7fffffffdef8)
at /home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:52
52 return some_called_function (); /* break here */
(gdb) set width 24
(gdb) frame
#0 main (argc=1,
argv=0x7fffffffdef8) at
/home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:52
52 return some_called_function (); /* break here */
(gdb) set width 25
(gdb) frame
#0 main (argc=1,
argv=0x7fffffffdef8)
at /home/abidh/work/gdb/src/upstream/gdb/testsuite/gdb.base/style.c:52
52 return some_called_function (); /* break here */
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-04 11:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 20:53 [Bug gdb/27340] New: Output does not respect set width value in some cases abidh at codesourcery dot com
2021-12-27 6:38 ` [Bug gdb/27340] " tromey at sourceware dot org
2022-01-04 11:22 ` abidh at sourceware dot org
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).