public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/50983] New: [4.7 Regression] incorrect DW_LNS_negate_stmt
@ 2011-11-03 17:39 ravitillo at lbl dot gov
  2011-11-05 11:55 ` [Bug debug/50983] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ravitillo at lbl dot gov @ 2011-11-03 17:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50983

             Bug #: 50983
           Summary: [4.7 Regression] incorrect DW_LNS_negate_stmt
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ravitillo@lbl.gov
                CC: jason@redhat.com


An incorrect DW_LNS_negate_stmt doesn't allow to set breakpoints in some cases,
e.g. given

struct Base {
  Base(bool foo){
    static bool bar;
    if (foo) bar = false; else bar = true;}
};

void fun()
{
  return;
}

int main(int argc, char *argv[])
{
  Base *b = new Base(true);
  fun();
  return 0;
}

and compiling with -g, is_stmt is set to 0 after the end of the first sequence:

  readelf --debug-dump=rawline ./a.out
  ...
  Special opcode 103: advance Address by 7 to 0x40058d and Line by 0 to 4
  Advance PC by 2 to 0x40058f
  Extended opcode 1: End of Sequence

  Set is_stmt to 0
  Extended opcode 2: set Address to 0x400524
  Special opcode 12: advance Address by 0 to 0x400524 and Line by 7 to 8
  ...

making it impossible to set a breakpoint on line 9 for instance. The proposed
fix:


gcc/Changelog:
2011-11-03 Roberto Agostino Vitillo <ravitillo@lbl.gov>
    * dwarf2out.c (set_cur_line_info_table): Restore the last is_stmt value in
the current line table.

Index: gcc/gcc/dwarf2out.c
===================================================================
--- gcc/gcc/dwarf2out.c    (revision 180817)
+++ gcc/gcc/dwarf2out.c    (working copy)
@@ -20363,6 +20363,9 @@
       VEC_safe_push (dw_line_info_table_p, gc, separate_line_info, table);
     }

+  if (DWARF2_ASM_LINE_DEBUG_INFO)
+    table->is_stmt = cur_line_info_table ? cur_line_info_table->is_stmt
+                                         : DWARF_LINE_DEFAULT_IS_STMT_START;
   cur_line_info_table = table;
 }



Tested on x86_64-linux.
r


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

* [Bug debug/50983] [4.7 Regression] incorrect DW_LNS_negate_stmt
  2011-11-03 17:39 [Bug debug/50983] New: [4.7 Regression] incorrect DW_LNS_negate_stmt ravitillo at lbl dot gov
@ 2011-11-05 11:55 ` rguenth at gcc dot gnu.org
  2011-11-10 20:32 ` jason at gcc dot gnu.org
  2011-11-10 20:35 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-05 11:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50983

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-05 11:54:24 UTC ---
Patches should be posted to gcc-patches@gcc.gnu.org


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

* [Bug debug/50983] [4.7 Regression] incorrect DW_LNS_negate_stmt
  2011-11-03 17:39 [Bug debug/50983] New: [4.7 Regression] incorrect DW_LNS_negate_stmt ravitillo at lbl dot gov
  2011-11-05 11:55 ` [Bug debug/50983] " rguenth at gcc dot gnu.org
@ 2011-11-10 20:32 ` jason at gcc dot gnu.org
  2011-11-10 20:35 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-10 20:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50983

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-10 20:28:14 UTC ---
Author: jason
Date: Thu Nov 10 20:28:04 2011
New Revision: 181269

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181269
Log:
    PR debug/50983
    * dwarf2out.c (set_cur_line_info_table): Restore the last is_stmt
    value in the current line table.

Added:
    trunk/gcc/testsuite/gcc.dg/debug/dwarf2/asm-line1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug debug/50983] [4.7 Regression] incorrect DW_LNS_negate_stmt
  2011-11-03 17:39 [Bug debug/50983] New: [4.7 Regression] incorrect DW_LNS_negate_stmt ravitillo at lbl dot gov
  2011-11-05 11:55 ` [Bug debug/50983] " rguenth at gcc dot gnu.org
  2011-11-10 20:32 ` jason at gcc dot gnu.org
@ 2011-11-10 20:35 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-10 20:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50983

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-10 20:33:50 UTC ---
Fixed.


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

end of thread, other threads:[~2011-11-10 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-03 17:39 [Bug debug/50983] New: [4.7 Regression] incorrect DW_LNS_negate_stmt ravitillo at lbl dot gov
2011-11-05 11:55 ` [Bug debug/50983] " rguenth at gcc dot gnu.org
2011-11-10 20:32 ` jason at gcc dot gnu.org
2011-11-10 20:35 ` jason 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).