public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/14022] New: asm() should start a new line table entry
@ 2004-02-04 23:53 gcc-bugzilla at gcc dot gnu dot org
  2004-12-06  5:24 ` [Bug debug/14022] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-02-04 23:53 UTC (permalink / raw)
  To: gcc-bugs


Gcc is not causing a dwarf line table entry break at an asm(), which
causes the contents of an asm() outside a function to be subsumed into
the previous function, at least as far as the line table information
is concerned.

Environment:
System: Linux fred.ninemoons.com 2.4.22-1.2149.nptl #1 Wed Jan 7 12:57:33 EST 2004 i686 athlon i386 GNU/Linux
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: sh-unknown-elf
configured with: /src/sourceware/gcc/gcc/configure -v --prefix=/usr/local/sourceware --with-newlib --with-gnu-as --with-gnu-ld --target=sh-elf --enable-languages=c,c++

How-To-Repeat:

Given the following test case:

    void sub (void);

    main()
    {
            sub();
    }
	
    asm(".text\n _sub:\n rts\n");

sh-elf-gcc is emitting line number info that makes the asm() appear to be
part of main().  Here is the relevant output of "readelf --debug-dump" on
the object file:

    Line Number Statements:
     Extended opcode 2: set Address to 0x0
     Special opcode 8: advance Address by 0 to 0x0 and Line by 3 to 4
     Special opcode 48: advance Address by 6 to 0x6 and Line by 1 to 5
     Special opcode 48: advance Address by 6 to 0xc and Line by 1 to 6
     Advance PC by 18 to 1e
     Extended opcode 1: End of Sequence
  
As an alternate view of the line table, this is what dwarfdump generates:

    line number info
    <source>	[row,column]	<pc>	//<new statement or basic block
    b2.c:	[  4,-1]	0	// new statement
    b2.c:	[  5,-1]	0x6	// new statement
    b2.c:	[  6,-1]	0xc	// new statement
    b2.c:	[  6,-1]	0x1e	// new statement	// end of text sequence

Here is a disassembly of the generated object file with "--- comment ---"
lines to show the start of where gcc assigns each line, assuming I'm
interpreting the table correctly:

    b2.o:     file format elf32-sh
    
    Disassembly of section .text:
    
    00000000 <_main>:
-- start line 4 ---
       0:	2f e6       	mov.l	r14,@-r15
       2:	4f 22       	sts.l	pr,@-r15
       4:	6e f3       	mov	r15,r14
-- start line 5 --
       6:	d1 04       	mov.l	18 <_main+0x18>,r1	! 0x1c
       8:	41 0b       	jsr	@r1
       a:	00 09       	nop	
-- start line 6 --
       c:	6f e3       	mov	r14,r15
       e:	4f 26       	lds.l	@r15+,pr
      10:	6e f6       	mov.l	@r15+,r14
      12:	00 0b       	rts	
      14:	00 09       	nop	
      16:	00 09       	nop	
      18:	00 00       	.word 0x0000
      1a:	00 1c       	mov.b	@(r0,r1),r0
    
    0000001c <_sub>:
      1c:	00 0b       	rts	
-- end line 6 --
      1e:	00 09       	nop	

Encountering the end of a function should probably force a new line number
entry when any code is found after the last instruction in the function.
I.E.  something like:

    line number info
    <source>	[row,column]	<pc>	//<new statement or basic block
    b2.c:	[  4,-1]	0	// new statement
    b2.c:	[  5,-1]	0x6	// new statement
    b2.c:	[  6,-1]	0xc	// new statement
    b2.c:	[  8,-1]	0x1c	// new statement
    b2.c:	[  8,-1]	0x1e	// new statement	// end of text sequence

This is the cause of the current gdb failure for the gdb test "gdb1291.exp".

-- 
           Summary: asm() should start a new line table entry
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fnf at redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sh-unknown-elf


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


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

* [Bug debug/14022] asm() should start a new line table entry
  2004-02-04 23:53 [Bug debug/14022] New: asm() should start a new line table entry gcc-bugzilla at gcc dot gnu dot org
@ 2004-12-06  5:24 ` pinskia at gcc dot gnu dot org
  2004-12-09 15:36 ` drow at gcc dot gnu dot org
  2005-01-15  6:07 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-06  5:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-06 05:24 -------
Add your own debuging info for asm outside a function, there is no way for gcc to know not to do that, 
anyways this is standard practice as usually you want the asm to recorded as some line and not none.

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


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


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

* [Bug debug/14022] asm() should start a new line table entry
  2004-02-04 23:53 [Bug debug/14022] New: asm() should start a new line table entry gcc-bugzilla at gcc dot gnu dot org
  2004-12-06  5:24 ` [Bug debug/14022] " pinskia at gcc dot gnu dot org
@ 2004-12-09 15:36 ` drow at gcc dot gnu dot org
  2005-01-15  6:07 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: drow at gcc dot gnu dot org @ 2004-12-09 15:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From drow at gcc dot gnu dot org  2004-12-09 15:36 -------
Fred's request makes perfect sense to me.

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


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


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

* [Bug debug/14022] asm() should start a new line table entry
  2004-02-04 23:53 [Bug debug/14022] New: asm() should start a new line table entry gcc-bugzilla at gcc dot gnu dot org
  2004-12-06  5:24 ` [Bug debug/14022] " pinskia at gcc dot gnu dot org
  2004-12-09 15:36 ` drow at gcc dot gnu dot org
@ 2005-01-15  6:07 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-15  6:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-15 06:07 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-15 06:07:42
               date|                            |


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


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

end of thread, other threads:[~2005-01-15  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-04 23:53 [Bug debug/14022] New: asm() should start a new line table entry gcc-bugzilla at gcc dot gnu dot org
2004-12-06  5:24 ` [Bug debug/14022] " pinskia at gcc dot gnu dot org
2004-12-09 15:36 ` drow at gcc dot gnu dot org
2005-01-15  6:07 ` pinskia at gcc dot gnu dot 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).