public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/25666] New: segv when printing symbols for gdb.ada/access_to_packed_array/foo
@ 2020-03-13  8:34 vries at gcc dot gnu.org
  2020-03-13  8:41 ` [Bug ada/25666] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-03-13  8:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25666

            Bug ID: 25666
           Summary: segv when printing symbols for
                    gdb.ada/access_to_packed_array/foo
           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: ---

When running the gdb testsuite with target board
unix/-flto/-O0/-flto-partition=none, I run into:
...
Running src/gdb/testsuite/gdb.ada/access_to_packed_array.exp ...
PASS: gdb.ada/access_to_packed_array.exp: compilation foo.adb
PASS: gdb.ada/access_to_packed_array.exp: maint expand-symtabs
PASS: gdb.ada/access_to_packed_array.exp: set logging file
PASS: gdb.ada/access_to_packed_array.exp: set logging redirect on
PASS: gdb.ada/access_to_packed_array.exp: set logging on
ERROR: GDB process no longer exists
UNRESOLVED: gdb.ada/access_to_packed_array.exp: maint print symbols
...

This can be manually reproduced using:
...
$ gdb gdb.ada/access_to_packed_array/foo -ex 'set pagination off' -ex 'maint
expand-symtabs' -ex 'maint print symbols'
Reading symbols from
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_to_packed_array/foo...

Symtab for file init.c
Compilation directory is /home/abuild/rpmbuild/BUILD/glibc-2.26/csu
Read from object file
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_to_packed_array/foo
(0x2600ad0)
Language: c

Blockvector:

block #000, object at 0x2eb1a10, 1 syms/buckets in 0x0..0x0
 const int _IO_stdin_used; static at 0x40dca0 section .rodata
  block #001, object at 0x2eb1960 under 0x2eb1a10, 2 syms/buckets in 0x0..0x0
   typedef short unsigned int short unsigned int; 
   typedef signed char signed char; 
   typedef int int; 
   typedef long int long int; 
   typedef char char; 
   typedef unsigned char unsigned char; 
   typedef unsigned int unsigned int; 
   typedef long unsigned int long unsigned int; 
   typedef short int short int; 


Symtab for file <artificial>
Compilation directory is
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_to_packed_array
Read from object file
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_to_packed_array/foo
(0x2600ad0)
Language: ada

Blockvector:

block #000, object at 0x2eb0950, 2 syms/buckets in 0x401dc8..0x401f98
 procedure ada_main.adafinal; block object 0x2f99b80, 0x401dc8..0x401ded
 procedure ada_main.adainit; block object 0x2f99d10, 0x401dee..0x401f19
 function main (a1: integer; a2: access void; a3: access void) return integer;
block object 0x2f9a5c0, 0x401f1a..0x401f7d
 procedure pack.do_nothing (a1: pack.array_access); block object 0x2eb0540,
0x401f7e..0x401f88
 procedure foo; block object 0x2eb07c0, 0x401f88..0x401f98
  block #001, object at 0x2eb0820 under 0x2eb0950, 17 syms/buckets in
0x401dc8..0x401f98
   typedef character: <character>; 
   ada_main.u00001: <4-byte integer>; static at 0x40dcd4 section .rodata
   ada_main.u00012: <4-byte integer>; static at 0x40dd00 section .rodata
   ada_main.u00023: <4-byte integer>; static at 0x40dd2c section .rodata
   ada_main.u00034: <4-byte integer>; static at 0x40dd58 section .rodata
   ada_main.u00045: <4-byte integer>; static at 0x40dd84 section .rodata
   ada_main.u00002: <4-byte integer>; static at 0x40dcd8 section .rodata
   ada_main.u00013: <4-byte integer>; static at 0x40dd04 section .rodata
   ada_main.u00024: <4-byte integer>; static at 0x40dd30 section .rodata
   ada_main.u00035: <4-byte integer>; static at 0x40dd5c section .rodata
   ada_main.u00046: <4-byte integer>; static at 0x40dd88 section .rodata
   pack.aa: access warning: could not find bounds information on packed array
array (<undecipherable array type>; static at 0x40ddb0 section .rodata
   ada_main.u00003: <4-byte integer>; static at 0x40dcdc section .rodata
   ada_main.u00014: <4-byte integer>; static at 0x40dd08 section .rodata
   ada_main.u00025: <4-byte integer>; static at 0x40dd34 section .rodata
   ada_main.u00036: <4-byte integer>; static at 0x40dd60 section .rodata
   ada_main.u00047: <4-byte integer>; static at 0x40dd8c section .rodata
   typedef boolean: (false, true); 
   pack.a: warning: could not find bounds information on packed array
array (<undecipherable array type>; static at 0x614290 section .data
   typedef ada_main.version_32: <4-byte integer>; 
   typedef ada_main.version_32: <4-byte integer>; 
   ada_main.u00004: <4-byte integer>; static at 0x40dce0 section .rodata
   ada_main.u00015: <4-byte integer>; static at 0x40dd0c section .rodata
   ada_main.u00026: <4-byte integer>; static at 0x40dd38 section .rodata
   ada_main.u00037: <4-byte integer>; static at 0x40dd64 section .rodata
   ada_main.u00048: <4-byte integer>; static at 0x40dd90 section .rodata
   ada_main.u00005: <4-byte integer>; static at 0x40dce4 section .rodata
   ada_main.u00016: <4-byte integer>; static at 0x40dd10 section .rodata
   ada_main.u00027: <4-byte integer>; static at 0x40dd3c section .rodata
   ada_main.u00038: <4-byte integer>; static at 0x40dd68 section .rodata
   ada_main.u00049: <4-byte integer>; static at 0x40dd94 section .rodata
   array (1 .. 0) of character;

   ada_main.u00006: <4-byte integer>; static at 0x40dce8 section .rodata
   ada_main.u00017: <4-byte integer>; static at 0x40dd14 section .rodata
   ada_main.u00028: <4-byte integer>; static at 0x40dd40 section .rodata
   ada_main.u00039: <4-byte integer>; static at 0x40dd6c section .rodata
   ada_main.local_priority_specific_dispatching: array (1 .. 0) of character;
static at 0x40dda8 section .rodata
   array (1 .. 0) of character;

   ada_main.ada_main_program_name: array (1 .. 9) of character; static at
0x40dcc8 section .rodata
   ada_main.u00007: <4-byte integer>; static at 0x40dcec section .rodata
   ada_main.u00018: <4-byte integer>; static at 0x40dd18 section .rodata
   ada_main.u00029: <4-byte integer>; static at 0x40dd44 section .rodata
   ada_main.local_interrupt_states: array (1 .. 0) of character; static at
0x40dda9 section .rodata
   ada_main.is_elaborated: (false, true); static at 0x6145ca section .bss
   typedef system.address: <8-byte integer>; 
   typedef system.address: <8-byte integer>; 
   typedef pack.small: mod 256; 
   typedef pack.small: mod 256; 
   typedef <pack__small: <1-byte integer>; 
   ada_main.u00008: <4-byte integer>; static at 0x40dcf0 section .rodata
   ada_main.u00019: <4-byte integer>; static at 0x40dd1c section .rodata
   typedef ada_main.no_param_proc: access procedure; 
   ada_main.u00009: <4-byte integer>; static at 0x40dcf4 section .rodata
   typedef <long unsigned int>: <8-byte integer>; 
   record
       LB0: int;
       UB0: int;
   end record;

   record
       LB0: int;
       UB0: int;
   end record;

Aborted (core dumped)
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ada/25666] segv when printing symbols for gdb.ada/access_to_packed_array/foo
  2020-03-13  8:34 [Bug ada/25666] New: segv when printing symbols for gdb.ada/access_to_packed_array/foo vries at gcc dot gnu.org
@ 2020-03-13  8:41 ` vries at gcc dot gnu.org
  2020-04-19  6:12 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-03-13  8:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25666

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brobecker at adacore dot com,
                   |                            |tromey at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Doing a backtrace at the point of the segv:
...
(gdb) bt
#0  0x00000000006628e7 in make_qualified_type (
    type=<error reading variable: Cannot access memory at address
0x7fffff7feff8>, 
    new_flags=<error reading variable: Cannot access memory at address
0x7fffff7feff4>, 
    storage=<error reading variable: Cannot access memory at address
0x7fffff7fefe8>)
    at /data/gdb_versions/devel/src/gdb/gdbtypes.c:621
#1  0x000000000066742f in check_typedef (type=0x1ca3370) at
/data/gdb_versions/devel/src/gdb/gdbtypes.c:2642
#2  0x000000000042ee78 in ada_check_typedef (type=0x1ca3370) at
/data/gdb_versions/devel/src/gdb/ada-lang.c:9063
#3  0x000000000041eb8c in desc_base_type (type=0x1ca3370) at
/data/gdb_versions/devel/src/gdb/ada-lang.c:1532
#4  0x000000000041ec0a in is_thin_pntr (type=0x1ca3370) at
/data/gdb_versions/devel/src/gdb/ada-lang.c:1550
#5  0x000000000041f13e in desc_data_target_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:1721
#6  0x000000000041f61f in ada_is_array_descriptor_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:1885
#7  0x000000000041fca5 in ada_is_constrained_packed_array_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:2075
#8  0x000000000042c775 in find_parallel_type_by_descriptive_type
(type=0x1ca3370, 
    name=0x7fffff7ff210 "pack__Tarray_typeB___XP6___XUT___XVE")
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:7957
#9  0x000000000042c7db in ada_find_parallel_type_with_name (type=0x1ca3370, 
    name=0x7fffff7ff210 "pack__Tarray_typeB___XP6___XUT___XVE")
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:7973
#10 0x000000000042c8ca in ada_find_parallel_type (type=0x1ca3370,
suffix=0xb38568 "___XVE")
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:8000
#11 0x000000000041ecbc in thin_descriptor_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:1567
--Type <RET> for more, q to quit, c to continue without paging--
#12 0x000000000041f153 in desc_data_target_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:1722
#13 0x000000000041f61f in ada_is_array_descriptor_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:1885
#14 0x000000000041fca5 in ada_is_constrained_packed_array_type (type=0x1ca3370)
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:2075
#15 0x000000000042c775 in find_parallel_type_by_descriptive_type
(type=0x1ca3370, 
    name=0x7fffff7ff3c0 "pack__Tarray_typeB___XP6___XUT___XVE")
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:7957
#16 0x000000000042c7db in ada_find_parallel_type_with_name (type=0x1ca3370, 
    name=0x7fffff7ff3c0 "pack__Tarray_typeB___XP6___XUT___XVE")
    at /data/gdb_versions/devel/src/gdb/ada-lang.c:7973
#17 0x000000000042c8ca in ada_find_parallel_type (type=0x1ca3370,
suffix=0xb38568 "___XVE")
...

We find repetition in the call stack, f.i. this frame:
...
 0x000000000042c8ca in ada_find_parallel_type (type=0x1ca3370, suffix=0xb38568
"___XVE")
...
occurs twice, at #10 and #17.

This works, so we probably segv because of running out of stack:
...
(gdb) up 100000
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ada/25666] segv when printing symbols for gdb.ada/access_to_packed_array/foo
  2020-03-13  8:34 [Bug ada/25666] New: segv when printing symbols for gdb.ada/access_to_packed_array/foo vries at gcc dot gnu.org
  2020-03-13  8:41 ` [Bug ada/25666] " vries at gcc dot gnu.org
@ 2020-04-19  6:12 ` vries at gcc dot gnu.org
  2022-08-04 15:15 ` tromey at sourceware dot org
  2023-08-06 12:07 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-04-19  6:12 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25666

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
I bisected this to commit 1c33af7764 '[gdb] Fix segv in "maint print symbols"
for ada exec', but as it turns out, that's just related to the change in the
test, the segv reproduces before, if we use the updated test.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ada/25666] segv when printing symbols for gdb.ada/access_to_packed_array/foo
  2020-03-13  8:34 [Bug ada/25666] New: segv when printing symbols for gdb.ada/access_to_packed_array/foo vries at gcc dot gnu.org
  2020-03-13  8:41 ` [Bug ada/25666] " vries at gcc dot gnu.org
  2020-04-19  6:12 ` vries at gcc dot gnu.org
@ 2022-08-04 15:15 ` tromey at sourceware dot org
  2023-08-06 12:07 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-08-04 15:15 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25666

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
FWIW this works fine for me with Fedora 34 system gcc and with
a git master gcc (13.0.0):

murgatroyd. runtest --target_board=unix/-flto/-O0/-flto-partition=none
gdb.ada/access_to_packed_array.exp
[...]
                === gdb Summary ===

# of expected passes            11

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug ada/25666] segv when printing symbols for gdb.ada/access_to_packed_array/foo
  2020-03-13  8:34 [Bug ada/25666] New: segv when printing symbols for gdb.ada/access_to_packed_array/foo vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-08-04 15:15 ` tromey at sourceware dot org
@ 2023-08-06 12:07 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-06 12:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=25666

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15041
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15041&action=edit
Reproducer foo.gz (stripped using --only-keep-debug)

$ gdb -q -batch foo -ex "maint expand-symtabs" -ex "maint print symbols"

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-06 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13  8:34 [Bug ada/25666] New: segv when printing symbols for gdb.ada/access_to_packed_array/foo vries at gcc dot gnu.org
2020-03-13  8:41 ` [Bug ada/25666] " vries at gcc dot gnu.org
2020-04-19  6:12 ` vries at gcc dot gnu.org
2022-08-04 15:15 ` tromey at sourceware dot org
2023-08-06 12:07 ` 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).