Bug 30327 - Objdump: Assertion failed in dwarf.c: `debug_info_p->num_loc_views <= num' failed
Summary: Objdump: Assertion failed in dwarf.c: `debug_info_p->num_loc_views <= num' fa...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-07 14:24 UTC by Ziqiao Kong
Modified: 2023-04-11 16:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Contains both the obj file and full logs (1.66 KB, application/x-xz)
2023-04-07 14:24 UTC, Ziqiao Kong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ziqiao Kong 2023-04-07 14:24:04 UTC
Created attachment 14809 [details]
Contains both the obj file and full logs

Git commit hash: 929a05081ec2ca6448927b96f673b0cd9633a342

Steps to reproduce:

```
./configure
make -j
./binutils/objdump -g /path/to/obj
```

Logs:

```
...
<Some output>
...
 <0><59>: Abbrev Number: 1 (DW_TAG_variable)
    <5a>   DW_AT_name        : i
    <5c>   DW_AT_decl_file   : 1
    <5c>   DW_AT_decl_line   : 2
    <5d>   DW_AT_type        : <0x96>./binutils/objdump: Warning: Unable to find entry for abbreviation 4

    <61>   DW_AT_location    : 0x10 (location list)
    <65>   DW_AT_GNU_locviews: 0xc
 <0><69>: Abbrev Number: 1 (DW_TAG_variable)
    <6a>   DW_AT_name        : j
    <6c>   DW_AT_decl_file   : 1
    <6c>   DW_AT_decl_line   : 3
    <6d>   DW_AT_type        : <0x96>./binutils/objdump: Warning: Unable to find entry for abbreviation 4

    <71>   DW_AT_location    : 0x22 (location list)
    <75>   DW_AT_GNU_locviews: 0x34
 <0><79>: Abbrev Number: 5 (DW_TAG_variable)
    <7a>   DW_AT_name        : k
    <7c>   DW_AT_decl_file   : 1
    <7c>   DW_AT_decl_line   : 6
    <7d>   DW_AT_type        : <0x96>./binutils/objdump: Warning: Unable to find entry for abbreviation 4

    <81>   DW_AT_GNU_locviews: 0x38
    <85>   Unknown AT value: 8:./binutils/objdump: Warning: Unrecognized form: 0x3a
    <86>   DW_AT_is_optional : 0x6000000
    <8a>   DW_AT_decl_line   : 108
    <8b>   DW_AT_type        : <0x960600>
objdump: ./dwarf.c:2930: read_and_display_attr_value: Assertion `debug_info_p->num_loc_views <= num' failed.
Aborted (core dumped)
```

System environment:

```
[afl++ amdsuplus3] /binutils (master) # gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[afl++ amdsuplus3] /binutils (master) # g++ --version
g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[afl++ amdsuplus3] /binutils (master) # cat /etc/issue
Ubuntu 22.04.2 LTS \n \l

[afl++ amdsuplus3] /binutils (master) # uname -a
Linux amdsuplus3.inf.ethz.ch 5.4.0-144-generic #161-Ubuntu SMP Fri Feb 3 14:49:04 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[afl++ amdsuplus3] /binutils (master) #
```

See attached for the obj file and full logs.
Comment 1 Sourceware Commits 2023-04-11 16:24:46 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7bb9e56c6a69c99866d8827cda8fd7ace2298b47

commit 7bb9e56c6a69c99866d8827cda8fd7ace2298b47
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Apr 11 17:24:09 2023 +0100

    Replace an assertion in the dwarf code with a warning message.
    
      PR 30327
      * dwarf.c (read_and_display_attr_value): Warn if the number of views is greater than the number of locations.
Comment 2 Nick Clifton 2023-04-11 16:25:44 UTC
Hi Ziqiao Kong,

  Thanks for reporting this bug.  I have checked in a small patch to replace
  the assertion with a warning message.

Cheers
  Nick