public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type
@ 2021-09-09 14:10 vries at gcc dot gnu.org
2021-09-09 14:33 ` [Bug ada/28323] " vries at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-09 14:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28323
Bug ID: 28323
Summary: segfault in ada_is_unconstrained_packed_array_type
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: ada
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
With test-case rtf=gdb.ada/mi_dyn_arr.exp I run into a segfault on openSUSE
Leap 42.3 with gcc-4.8:
...
(gdb) ^M
Expecting: ^(-var-create bt \* bt[^M
]+)?(\^done,name="bt",numchild="3",.*[^M
]+[(]gdb[)] ^M
[ ]*)
-var-create bt * bt^M
ERROR: Process no longer exists
UNRESOLVED: gdb.ada/mi_dyn_arr.exp: create bt varobj
ERROR: Couldn't send -var-update 1 * to GDB.
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug ada/28323] segfault in ada_is_unconstrained_packed_array_type
2021-09-09 14:10 [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type vries at gcc dot gnu.org
@ 2021-09-09 14:33 ` vries at gcc dot gnu.org
2021-09-09 14:53 ` vries at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-09 14:33 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28323
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Reproduce:
...
$ cat gdb.in
interpreter-exec mi "100-gdb-set height 0"
interpreter-exec mi "101-gdb-set width 0"
show mi-async
interpreter-exec mi "104-environment-directory -r"
interpreter-exec mi "105-environment-directory
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.ada"
interpreter-exec mi "105-file-exec-and-symbols
/home/vries/gdb_versions/devel/foo"
interpreter-exec mi "200-break-insert --qualified -t main"
interpreter-exec mi "220-exec-run"
interpreter-exec mi "-break-insert -t foo.adb:22"
interpreter-exec mi "-exec-continue"
interpreter-exec mi "-var-create bt * bt"
interpreter-exec mi "-var-update 1 *"
$ gdb.sh -q -batch -x gdb.in
...
[ note: with foo copied out of build tree, not relevant to reproducing though ]
Problem is here:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x0000000000450861 in ada_is_unconstrained_packed_array_type (type=0x25163f0)
at /home/vries/gdb_versions/devel/src/gdb/ada-lang.c:1978
1978 return TYPE_FIELD_BITSIZE (type, 0) > 0;
(gdb) p *type
$2 = {pointer_type = 0x2ae4e20, reference_type = 0x0, rvalue_reference_type =
0x0,
chain = 0x25163f0, align_log2 = 0, m_instance_flags = 0, length = 0,
main_type = 0x2ae4900}
(gdb) p type.main_type->flds_bnds.fields
$4 = (field *) 0x0
...
Type in more detail:
...
(gdb) p *type.main_type
$3 = {code = TYPE_CODE_TYPEDEF, m_flag_unsigned = 0, m_flag_nosign = 0,
m_flag_stub = 0,
m_flag_target_stub = 1, m_flag_prototyped = 0, m_flag_varargs = 0,
m_flag_vector = 0,
m_flag_stub_supported = 0, m_flag_gnu_ifunc = 0, m_flag_fixed_instance = 0,
m_flag_objfile_owned = 1, m_flag_endianity_not_default = 0,
m_flag_declared_class = 0,
m_flag_flag_enum = 0, type_specific_field = TYPE_SPECIFIC_GNAT_STUFF, nfields
= 0,
name = 0x7fffec9733a2 "pck__bounded___XUA", m_owner = {objfile = 0x1b4e6f0,
gdbarch =
0x1b4e6f0}, target_type = 0x2ae4b80, flds_bnds = {fields = 0x0, bounds =
0x0,
complex_type = 0x0}, type_specific = {cplus_stuff = 0xf2e9c8
<gnat_aux_default>,
gnat_stuff = 0xf2e9c8 <gnat_aux_default>, floatformat = 0xf2e9c8
<gnat_aux_default>,
func_stuff = 0xf2e9c8 <gnat_aux_default>, self_type = 0xf2e9c8
<gnat_aux_default>,
fixed_point_info = 0xf2e9c8 <gnat_aux_default>, int_stuff = {bit_size =
59848,
bit_offset = 242}}, dyn_prop_list = 0x0}
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug ada/28323] segfault in ada_is_unconstrained_packed_array_type
2021-09-09 14:10 [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type vries at gcc dot gnu.org
2021-09-09 14:33 ` [Bug ada/28323] " vries at gcc dot gnu.org
@ 2021-09-09 14:53 ` vries at gcc dot gnu.org
2021-09-09 14:59 ` vries at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-09 14:53 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28323
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
This seems to fix it:
...
$ git diff
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 6680a4fd657..b1ed66c12c4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -1974,6 +1974,8 @@ ada_is_unconstrained_packed_array_type (struct type
*type)
/* The structure's first field is a pointer to an array, so this
fetches the array type. */
type = TYPE_TARGET_TYPE (type->field (0).type ());
+ if (type->code () == TYPE_CODE_TYPEDEF)
+ type = ada_typedef_target_type (type);
/* Now we can see if the array elements are packed. */
return TYPE_FIELD_BITSIZE (type, 0) > 0;
}
...
But I have no idea whether the fix is correct.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug ada/28323] segfault in ada_is_unconstrained_packed_array_type
2021-09-09 14:10 [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type vries at gcc dot gnu.org
2021-09-09 14:33 ` [Bug ada/28323] " vries at gcc dot gnu.org
2021-09-09 14:53 ` vries at gcc dot gnu.org
@ 2021-09-09 14:59 ` vries at gcc dot gnu.org
2021-12-06 12:14 ` vries at gcc dot gnu.org
2021-12-07 6:36 ` vries at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-09-09 14:59 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28323
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |brobecke at sourceware dot org,
| |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug ada/28323] segfault in ada_is_unconstrained_packed_array_type
2021-09-09 14:10 [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type vries at gcc dot gnu.org
` (2 preceding siblings ...)
2021-09-09 14:59 ` vries at gcc dot gnu.org
@ 2021-12-06 12:14 ` vries at gcc dot gnu.org
2021-12-07 6:36 ` vries at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-12-06 12:14 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28323
--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-December/184241.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug ada/28323] segfault in ada_is_unconstrained_packed_array_type
2021-09-09 14:10 [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type vries at gcc dot gnu.org
` (3 preceding siblings ...)
2021-12-06 12:14 ` vries at gcc dot gnu.org
@ 2021-12-07 6:36 ` vries at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-12-07 6:36 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=28323
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
Target Milestone|--- |12.1
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=af5300fe24bf2f4e032d639a5396a16c1762b77b
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-07 6:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 14:10 [Bug ada/28323] New: segfault in ada_is_unconstrained_packed_array_type vries at gcc dot gnu.org
2021-09-09 14:33 ` [Bug ada/28323] " vries at gcc dot gnu.org
2021-09-09 14:53 ` vries at gcc dot gnu.org
2021-09-09 14:59 ` vries at gcc dot gnu.org
2021-12-06 12:14 ` vries at gcc dot gnu.org
2021-12-07 6:36 ` vries at gcc dot gnu.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).