public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
@ 2021-07-22  9:37 vries at gcc dot gnu.org
  2021-07-22 12:30 ` [Bug debug/101575] " ebotcazou at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-22  9:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

            Bug ID: 101575
           Summary: [gcc-11, -gdwarf-4] Missing .file <n> directive causes
                    invalid line info
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider test-case defs.adb/defs.ads from a gdb testcase (
https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/testsuite/gdb.ada/formatted_ref
).

If we compile with dwarf 5, we have only one address at defs.adb:20, 0x2a:
...
$ gcc -c -gdwarf-5 -g defs.adb
$ readelf -wL defs.o
Contents of the .debug_line section:

CU: ./defs.adb:
File name                            Line number    Starting address    View   
Stmt
defs.adb                                      18                0x22           
   x
defs.adb                                      20                0x2a           
   x
defs.adb                                      21                0x30           
   x

./defs.adb:[++]
defs.adb                                      16                0x32           
   x
defs.adb                                      25                0x36           
   x
defs.adb                                      27                0x45           
   x
defs.adb                                       -                0x48
...

With dwarf 4, we have two addresses:
...
$ gcc -c -gdwarf-4 -g defs.adb 
$ readelf -wL defs.o          
Contents of the .debug_line section:

CU: ./defs.adb:
File name                            Line number    Starting address    View   
Stmt
defs.adb                                      10                   0           
   x
defs.adb                                      13                 0x1           
   x
defs.adb                                      15                 0x4           
   x
defs.adb                                      16                 0x8           
   x
defs.adb                                      17                 0xb           
   x
defs.adb                                      18                 0xf           
   x
defs.adb                                      19                0x15           
   x
defs.adb                                      20                0x19           
   x
defs.adb                                      21                0x20           
   x
defs.adb                                      23                0x21           
   x
defs.adb                                      18                0x22           
   x
defs.adb                                      20                0x2a           
   x
defs.adb                                      21                0x30           
   x

./defs.ads:[++]
defs.ads                                      16                0x32           
   x
defs.ads                                      25                0x36           
   x
defs.ads                                      27                0x45           
   x
defs.ads                                       -                0x48
...

The additional breakpoint at address 0x19 falls into:
...
0000000000000000 <defs__struct1IP>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   48 89 7d f8             mov    %rdi,-0x8(%rbp)
   8:   89 75 f4                mov    %esi,-0xc(%rbp)
   b:   48 8b 45 f8             mov    -0x8(%rbp),%rax
   f:   c7 00 0d 00 00 00       movl   $0xd,(%rax)
  15:   48 8b 45 f8             mov    -0x8(%rbp),%rax
  19:   c7 40 04 13 00 00 00    movl   $0x13,0x4(%rax)
  20:   5d                      pop    %rbp
  21:   c3                      ret    
...
which is an initialization function corresponding to this code in defs.ads:
...
   type Struct1 is limited record
      X : Integer := 13;
      Y : Integer := 19;
   end record;
...

The dwarf 4 assembly starts like this:
...
$ cat -n defs.s
     1          .file   "defs.adb"
     2          .text
     3  .Ltext0:
     4          .align 2
     5          .globl  defs__struct1IP
     6          .type   defs__struct1IP, @function
     7  defs__struct1IP:
     8  .LFB2:
     9          .cfi_startproc
    10          pushq   %rbp
    11          .cfi_def_cfa_offset 16
    12          .cfi_offset 6, -16
    13          movq    %rsp, %rbp
    14          .cfi_def_cfa_register 6
    15          movq    %rdi, -8(%rbp)
    16          movl    %esi, -12(%rbp)
    17          movq    -8(%rbp), %rax
    18          movl    $13, (%rax)
    19          movq    -8(%rbp), %rax
    20          movl    $19, 4(%rax)
    21          popq    %rbp
    22          .cfi_def_cfa 7, 8
    23          ret
    24          .cfi_endproc
    25  .LFE2:
    26          .size   defs__struct1IP, .-defs__struct1IP
    27          .align 2
    28          .globl  defs__f1
    29          .type   defs__f1, @function
    30  defs__f1:
    31  .LFB3:
    32          .file 1 "defs.adb"
    33          .loc 1 18 4
...
and gas generates line-info for this assembly because:
- we pass --gdwarf-4 to gas
- of the absence of a .file  <n> <file> directive in defs__struct1IP

The dwarf 5 assembly starts like:
...
        .file   "defs.adb"
        .text
.Ltext0:
        .file 0 "/home/vries/gdb_versions/devel" "defs.adb"
        .align 2
        .globl  defs__struct1IP
        .type   defs__struct1IP, @function
defs__struct1IP:
.LFB2:
        .cfi_startproc
        pushq   %rbp
...
and due to the .file 0 directive we hit this in gas/dwarf2dbg.c:
...
  /* A .file directive implies compiler generated debug information is
     being supplied.  Turn off gas generated debug info.  */
  debug_type = DEBUG_NONE;
...
and no line info is generated for the assembly.

AFAIU, this can be fixed by having gcc issue a .file <n> directive in
defs__struct1IP.

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

* [Bug debug/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
@ 2021-07-22 12:30 ` ebotcazou at gcc dot gnu.org
  2021-07-22 12:32 ` vries at gcc dot gnu.org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-07-22 12:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Not going to be fixed, just stick to the default setting (DWARF 5).

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

* [Bug debug/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
  2021-07-22 12:30 ` [Bug debug/101575] " ebotcazou at gcc dot gnu.org
@ 2021-07-22 12:32 ` vries at gcc dot gnu.org
  2021-07-22 12:54 ` [Bug ada/101575] " ebotcazou at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-22 12:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Eric Botcazou from comment #1)
> Not going to be fixed,

Because ?

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
  2021-07-22 12:30 ` [Bug debug/101575] " ebotcazou at gcc dot gnu.org
  2021-07-22 12:32 ` vries at gcc dot gnu.org
@ 2021-07-22 12:54 ` ebotcazou at gcc dot gnu.org
  2021-07-22 13:32 ` bernd.edlinger at hotmail dot de
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-07-22 12:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|debug                       |ada

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Because ?

No straightforward solution in DWARF < 5 and, therefore, not worth the hassle.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-07-22 12:54 ` [Bug ada/101575] " ebotcazou at gcc dot gnu.org
@ 2021-07-22 13:32 ` bernd.edlinger at hotmail dot de
  2021-07-22 15:57 ` vries at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2021-07-22 13:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Hi,

I think my commit e69ac020372 ("Add line debug info for virtual thunks")
has a mitigating effect on this test case:
due to such functions have DECL_IGNORED_P
they are excluded from the debug_range info,
and therfore gdb should ignore the bogus line tables.

However, I applied this only in the trunk, not the gcc-11 branch.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-07-22 13:32 ` bernd.edlinger at hotmail dot de
@ 2021-07-22 15:57 ` vries at gcc dot gnu.org
  2021-07-22 16:00 ` vries at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-22 15:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Bernd Edlinger from comment #4)
> Hi,
> 
> I think my commit e69ac020372 ("Add line debug info for virtual thunks")
> has a mitigating effect on this test case:
> due to such functions have DECL_IGNORED_P
> they are excluded from the debug_range info,
> and therfore gdb should ignore the bogus line tables.
> 
> However, I applied this only in the trunk, not the gcc-11 branch.

Thanks for mentioning this, that's very helpful.

I've:
- build gcc-11-branch
- reproduced the problem
- applied the patch (it applied cleanly)
- observed that the problem is gone.

More specifically, it's gone because we have:
...
$ more defs.s
        .file   "defs.adb"
        .text
.Ltext0:
        .align 2
        .globl  defs__struct1IP
        .type   defs__struct1IP, @function
defs__struct1IP:
.LFB2:
        .cfi_startproc
        .file 1 "defs.ads"
        .loc 1 18 9
...

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-07-22 15:57 ` vries at gcc dot gnu.org
@ 2021-07-22 16:00 ` vries at gcc dot gnu.org
  2021-07-22 16:53 ` ebotcazou at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-22 16:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Eric Botcazou from comment #3)
> > Because ?
> 
> No straightforward solution in DWARF < 5 and, therefore, not worth the
> hassle.

How about backporting the commit to gcc-11-branch?  WDYT?

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-07-22 16:00 ` vries at gcc dot gnu.org
@ 2021-07-22 16:53 ` ebotcazou at gcc dot gnu.org
  2021-07-23 12:22 ` bernd.edlinger at hotmail dot de
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-07-22 16:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
(> More specifically, it's gone because we have:
> ...
> $ more defs.s
>         .file   "defs.adb"
>         .text
> .Ltext0:
>         .align 2
>         .globl  defs__struct1IP
>         .type   defs__struct1IP, @function
> defs__struct1IP:
> .LFB2:
>         .cfi_startproc
>         .file 1 "defs.ads"
>         .loc 1 18 9
> ...

Ugh, we do *not* want to have .loc directives for defs__struct1IP so something
is even more broken here.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-07-22 16:53 ` ebotcazou at gcc dot gnu.org
@ 2021-07-23 12:22 ` bernd.edlinger at hotmail dot de
  2021-07-23 12:36 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2021-07-23 12:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #8 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
I can of course make the .loc go away. If you really want that.

It is basically the DECL_SOURCE_LOCATION of an
otherwise ignored decl.  If the DECL_SOURCE_LOCATION
is UNKNOWN_LOCATION the function should have no line info,
and gdb should be able not to step into this function.

However the location does not look really wrong to me.
In create_subprog_decl it is taken over from input_location.
I could imagine that this is sometimes a misleading location.
But then in gnat_pushdecl we have
Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (decl));
and it is again the same location.

In the test case the location points here:

        +---------------------------- column location
        v
   type Struct1 is limited record  <- line location
      X : Integer := 13;
      Y : Integer := 19;
   end record;

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2021-07-23 12:22 ` bernd.edlinger at hotmail dot de
@ 2021-07-23 12:36 ` vries at gcc dot gnu.org
  2021-07-23 15:14 ` ebotcazou at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-23 12:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Eric Botcazou from comment #7)
> (> More specifically, it's gone because we have:
> > ...
> > $ more defs.s
> >         .file   "defs.adb"
> >         .text
> > .Ltext0:
> >         .align 2
> >         .globl  defs__struct1IP
> >         .type   defs__struct1IP, @function
> > defs__struct1IP:
> > .LFB2:
> >         .cfi_startproc
> >         .file 1 "defs.ads"
> >         .loc 1 18 9
> > ...
> 
> Ugh, we do *not* want to have .loc directives for defs__struct1IP so
> something is even more broken here.

Filed as PR101598 - [debug, ada] .loc generated for defs__struct1IP.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2021-07-23 12:36 ` vries at gcc dot gnu.org
@ 2021-07-23 15:14 ` ebotcazou at gcc dot gnu.org
  2021-07-24  7:43 ` bernd.edlinger at hotmail dot de
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-07-23 15:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> I can of course make the .loc go away. If you really want that.
> 
> It is basically the DECL_SOURCE_LOCATION of an
> otherwise ignored decl.  If the DECL_SOURCE_LOCATION
> is UNKNOWN_LOCATION the function should have no line info,
> and gdb should be able not to step into this function.

But that's not the original design, which is that a DECL_IGNORED_P function
does not have .loc directives, like any other debugging information.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-07-23 15:14 ` ebotcazou at gcc dot gnu.org
@ 2021-07-24  7:43 ` bernd.edlinger at hotmail dot de
  2021-07-24 11:21 ` bernd.edlinger at hotmail dot de
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2021-07-24  7:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #11 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Eric Botcazou from comment #10)
> > I can of course make the .loc go away. If you really want that.
> > 
> > It is basically the DECL_SOURCE_LOCATION of an
> > otherwise ignored decl.  If the DECL_SOURCE_LOCATION
> > is UNKNOWN_LOCATION the function should have no line info,
> > and gdb should be able not to step into this function.
> 
> But that's not the original design, which is that a DECL_IGNORED_P function
> does not have .loc directives, like any other debugging information.

Yes, indeed.

DECL_IGNORED_P functions do also not have a block-structure and
many other sophisticated features like variable locations.
That does not change.

The intended change is just that if a DECL_SOURCE_LOCATION
is available it is shown in the debugger, and if there is no
DECL_SOURCE_LOCATION, really no line number shall be shown.

The motivation for this patch is the following:
Unfortunately some non-DECL_IGNORED_P functions decay
to DECL_IGNORED_P as shown in PR97937. While the test case
there is written in "C", it is certainly also an issue for Ada.

All that is left over from the original debug info is the
DECL_SOURCE_LOCATION.  Therefore the desire to at least show
this source location, because previously a completely wrong
line info from the preceding function was shown.

And on the other hand, we have DECL_IGNORED_P functions that
do not have any DECL_SOURCE_LOCATION right from the beginning.

Therefore the patch does a lot to prevent line number info
from the previous functions to extend to the following function
where it will be misleading.

But it will need some adjustments to also address DECL_IGNORED_P
functions directly at the beginning of the CU, when dwarf-4 is
used as in this PR.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2021-07-24  7:43 ` bernd.edlinger at hotmail dot de
@ 2021-07-24 11:21 ` bernd.edlinger at hotmail dot de
  2021-07-24 12:24 ` ebotcazou at gcc dot gnu.org
  2021-08-04 14:19 ` cvs-commit at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2021-07-24 11:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #12 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Eric Botcazou from comment #1)
> Not going to be fixed, just stick to the default setting (DWARF 5).

one minor remark, while working on a patch, I became aware,
that probably the same will happen when using -gdwarf-5 
with old binutils, since we have this code in dwarf2out.c:

#if defined(HAVE_AS_GDWARF_5_DEBUG_FLAG) &&
defined(HAVE_AS_WORKING_DWARF_N_FLAG)
  if (output_asm_line_debug_info () && dwarf_version >= 5)
    {
      /* When gas outputs DWARF5 .debug_line[_str] then we have to
         tell it the comp_dir and main file name for the zero entry
         line table.  */
      const char *comp_dir, *filename0;

      comp_dir = comp_dir_string ();
      if (comp_dir == NULL)
        comp_dir = "";

      filename0 = get_AT_string (comp_unit_die (), DW_AT_name);
      if (filename0 == NULL)
        filename0 = "";

      fprintf (asm_out_file, "\t.file 0 ");
      output_quoted_string (asm_out_file, remap_debug_filename (comp_dir));
      fputc (' ', asm_out_file);
      output_quoted_string (asm_out_file, remap_debug_filename (filename0));
      fputc ('\n', asm_out_file);
    }
#endif

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2021-07-24 11:21 ` bernd.edlinger at hotmail dot de
@ 2021-07-24 12:24 ` ebotcazou at gcc dot gnu.org
  2021-08-04 14:19 ` cvs-commit at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2021-07-24 12:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #13 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> one minor remark, while working on a patch, I became aware,
> that probably the same will happen when using -gdwarf-5 
> with old binutils, since we have this code in dwarf2out.c:

People should stick to the default -g, we cannot realistically support multiple
combinations of compiler versions, binutils versions and DWARF versions.

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

* [Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info
  2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2021-07-24 12:24 ` ebotcazou at gcc dot gnu.org
@ 2021-08-04 14:19 ` cvs-commit at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-04 14:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101575

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bernd Edlinger <edlinger@gcc.gnu.org>:

https://gcc.gnu.org/g:96c82a16b2076891a9974d0f0e96a0b85fbc2df4

commit r12-2735-g96c82a16b2076891a9974d0f0e96a0b85fbc2df4
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date:   Sat Jul 24 12:53:39 2021 +0200

    Fix debug info for ignored decls at start of assembly

    Ignored functions decls that are compiled at the start of
    the assembly have bogus line numbers until the first .file
    directive, as reported in PR101575.

    The corresponding binutils bug report is
    https://sourceware.org/bugzilla/show_bug.cgi?id=28149

    The work around for this issue is to emit a dummy .file
    directive before the first function is compiled, unless
    another .file directive was already emitted previously.

    2021-08-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

            PR ada/101575
            * dwarf2out.c (dwarf2out_assembly_start): Emit a dummy
            .file statement when needed.

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

end of thread, other threads:[~2021-08-04 14:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22  9:37 [Bug debug/101575] New: [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info vries at gcc dot gnu.org
2021-07-22 12:30 ` [Bug debug/101575] " ebotcazou at gcc dot gnu.org
2021-07-22 12:32 ` vries at gcc dot gnu.org
2021-07-22 12:54 ` [Bug ada/101575] " ebotcazou at gcc dot gnu.org
2021-07-22 13:32 ` bernd.edlinger at hotmail dot de
2021-07-22 15:57 ` vries at gcc dot gnu.org
2021-07-22 16:00 ` vries at gcc dot gnu.org
2021-07-22 16:53 ` ebotcazou at gcc dot gnu.org
2021-07-23 12:22 ` bernd.edlinger at hotmail dot de
2021-07-23 12:36 ` vries at gcc dot gnu.org
2021-07-23 15:14 ` ebotcazou at gcc dot gnu.org
2021-07-24  7:43 ` bernd.edlinger at hotmail dot de
2021-07-24 11:21 ` bernd.edlinger at hotmail dot de
2021-07-24 12:24 ` ebotcazou at gcc dot gnu.org
2021-08-04 14:19 ` cvs-commit 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).