public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/17320] New: printing of array in structures with "set print array on" is odd
@ 2014-08-27 19:53 dje at google dot com
2020-04-29 10:58 ` [Bug gdb/17320] " cvs-commit at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dje at google dot com @ 2014-08-27 19:53 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17320
Bug ID: 17320
Summary: printing of array in structures with "set print array
on" is odd
Product: gdb
Version: HEAD
Status: NEW
Severity: minor
Priority: P3
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: dje at google dot com
The printing of an array in a structure if oddly formatted if "set print array
on" is set.
---array.c---
int foo[3] = { 1, 2, 3 };
struct s
{
int a[3];
};
struct s bar = { { 1, 2, 3 } };
int
main ()
{
return 0;
}
---
bash$ ./gdb -D ./data-directory -nx
(gdb) file array.x64
(gdb) start
(gdb) p bar
$1 = {a = {1, 2, 3}}
(gdb) set print pretty on
(gdb) p bar
$2 = {
a = {1, 2, 3}
}
(gdb) set print array on
(gdb) p bar
$3 = {
a = {1,
2,
3}
}
(gdb) set print array-indexes on
(gdb) p bar
$4 = {
a = {[0] = 1,
[1] = 2,
[2] = 3}
}
(gdb) set print pretty off
(gdb) p bar
$5 = {a = {[0] = 1,
[1] = 2,
[2] = 3}}
(gdb) set print array-indexes off
(gdb) p bar
$6 = {a = {1,
2,
3}}
(gdb)
The output for $3,4,5,6 is oddly formatted.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/17320] printing of array in structures with "set print array on" is odd
2014-08-27 19:53 [Bug gdb/17320] New: printing of array in structures with "set print array on" is odd dje at google dot com
@ 2020-04-29 10:58 ` cvs-commit at gcc dot gnu.org
2020-04-29 11:01 ` ssbssa at sourceware dot org
2024-01-03 14:48 ` ssbssa at sourceware dot org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-29 10:58 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17320
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Hannes Domani <ssbssa@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d642b6920b1a697da2e8fa2326cb773612a87f3f
commit d642b6920b1a697da2e8fa2326cb773612a87f3f
Author: Hannes Domani <ssbssa@yahoo.de>
Date: Sun Apr 26 15:28:46 2020 +0200
Fix array pretty formatter
Currently, printing with array pretty formatting makes the output actually
less readable than without:
(gdb) p -array on -- {{1,2,3},{4,5,6}}
$1 = { {1,
2,
3},
{4,
5,
6}}
(gdb) p -array on -array-indexes on -- {{1,2,3},{4,5,6}}
$2 = {[0] = {[0] = 1,
[1] = 2,
[2] = 3},
[1] = {[0] = 4,
[1] = 5,
[2] = 6}}
These changes now also put the first element and the array end bracket on a
new
line, similar to the structure pretty formatter:
(gdb) p -array on -- {{1,2,3},{4,5,6}}
$1 = {
{
1,
2,
3
},
{
4,
5,
6
}
}
(gdb) p -array on -array-indexes on -- {{1,2,3},{4,5,6}}
$2 = {
[0] = {
[0] = 1,
[1] = 2,
[2] = 3
},
[1] = {
[0] = 4,
[1] = 5,
[2] = 6
}
}
gdb/ChangeLog:
2020-04-29 Hannes Domani <ssbssa@yahoo.de>
PR gdb/17320
* ada-valprint.c (val_print_packed_array_elements): Move array
end bracket to new line.
(ada_val_print_string): Remove extra spaces before first array
element.
* c-valprint.c (c_value_print_array): Likewise.
* m2-valprint.c (m2_print_array_contents): Likewise.
(m2_value_print_inner): Likewise.
* p-valprint.c (pascal_value_print_inner): Likewise.
* valprint.c (generic_val_print_array): Likewise.
(value_print_array_elements): Move first array element and array
end bracket to new line.
gdb/testsuite/ChangeLog:
2020-04-29 Hannes Domani <ssbssa@yahoo.de>
PR gdb/17320
* gdb.base/pretty-array.c: New test.
* gdb.base/pretty-array.exp: New file.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/17320] printing of array in structures with "set print array on" is odd
2014-08-27 19:53 [Bug gdb/17320] New: printing of array in structures with "set print array on" is odd dje at google dot com
2020-04-29 10:58 ` [Bug gdb/17320] " cvs-commit at gcc dot gnu.org
@ 2020-04-29 11:01 ` ssbssa at sourceware dot org
2024-01-03 14:48 ` ssbssa at sourceware dot org
2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2020-04-29 11:01 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17320
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |10.1
CC| |ssbssa at sourceware dot org
--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
Fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug gdb/17320] printing of array in structures with "set print array on" is odd
2014-08-27 19:53 [Bug gdb/17320] New: printing of array in structures with "set print array on" is odd dje at google dot com
2020-04-29 10:58 ` [Bug gdb/17320] " cvs-commit at gcc dot gnu.org
2020-04-29 11:01 ` ssbssa at sourceware dot org
@ 2024-01-03 14:48 ` ssbssa at sourceware dot org
2 siblings, 0 replies; 4+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-03 14:48 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17320
--- Comment #3 from Hannes Domani <ssbssa at sourceware dot org> ---
*** Bug 19888 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-03 14:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-27 19:53 [Bug gdb/17320] New: printing of array in structures with "set print array on" is odd dje at google dot com
2020-04-29 10:58 ` [Bug gdb/17320] " cvs-commit at gcc dot gnu.org
2020-04-29 11:01 ` ssbssa at sourceware dot org
2024-01-03 14:48 ` ssbssa 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).