public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/19521] New: omitted stab for gcov initialization function
@ 2005-01-19  0:37 stuart at apple dot com
  2005-01-19  0:40 ` [Bug debug/19521] " stuart at apple dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: stuart at apple dot com @ 2005-01-19  0:37 UTC (permalink / raw)
  To: gcc-bugs

gcov support entails an initialization function named "__GLOBAL__I_0_noop".
GCC omits function-begin stab for this function.

Here is the commandline:


[morris:/Volumes/sandbox/stuart] hasting2%
\/Volumes/sandbox/stuart/gcc.fsf.obj/gcc/xgcc -B
\/Volumes/sandbox/stuart/gcc.fsf.obj/gcc -g gcov.c -fprofile-arcs \
-ftest-coverage  -S

Given the .s file from the above, here is a check of the output:

[morris:/Volumes/sandbox/stuart] hasting2% egrep 'noop|main' gcov.s
        .globl _noop
_noop:
        .stabs  "noop:F(0,1)=(0,1)",36,0,7,_noop
        .stabs  "",36,0,0,Lscope0-_noop
        .globl _main
_main:
        bl _noop
        .stabs  "main:F(0,2)=r(0,2);-2147483648;2147483647;",36,0,11,_main
        .stabn  192,0,0,_main
        .stabs  "",36,0,0,Lscope1-_main
__GLOBAL__I_0_noop:
        .stabs  "",36,0,0,Lscope2-__GLOBAL__I_0_noop
        .long   __GLOBAL__I_0_noop
        .long   __GLOBAL__I_0_noop
[morris:/Volumes/sandbox/stuart] hasting2%

The 'stabs "",36' record seems to signify the end-of-the __GLOBAL__I_0_noop
function.  The matching start-function record is missing; compare with the noop
and main functions.

The testcase is from the GCC testsuite: gcc/testsuite/gcc.misc-tests/gcov-1.c gcov.c

Since it's short, here is the testcase:

/* Test Gcov basics.  */

/* { dg-options "-fprofile-arcs -ftest-coverage" } */
/* { dg-do run { target native } } */

void noop ()
{
}

int main ()
{
  int i;

  for (i = 0; i < 10; i++)      /* count(11) */
    noop ();                    /* count(10) */

  return 0;                     /* count(1) */
}

/* { dg-final { run-gcov gcov-1.c } } */

-- 
           Summary: omitted stab for gcov initialization function
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: stuart at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin
  GCC host triplet: powerpc-apple-darwin
GCC target triplet: powerpc-apple-darwin


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


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

* [Bug debug/19521] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
@ 2005-01-19  0:40 ` stuart at apple dot com
  2005-01-19  0:49 ` stuart at apple dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: stuart at apple dot com @ 2005-01-19  0:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stuart at apple dot com  2005-01-19 00:40 -------
Created an attachment (id=7986)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7986&action=view)
gcov-1.c testcase

Attaching the testcase for convenience.

-- 


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


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

* [Bug debug/19521] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
  2005-01-19  0:40 ` [Bug debug/19521] " stuart at apple dot com
@ 2005-01-19  0:49 ` stuart at apple dot com
  2005-01-19  1:06 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: stuart at apple dot com @ 2005-01-19  0:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stuart at apple dot com  2005-01-19 00:49 -------
This is a regression from 3.3; I think the cause is this line in cgraphunit.c
(cgraph_build_static_cdtor): (approximately line 1847)

  DECL_IGNORED_P (decl) = 1;

Deleting this line "fixes" the symptom, but I believe the right fix lies in
dbxout.c.

The start-function stab comes from dbxout.c(dbxout_symbol), near line 2346:

  /* Ignore nameless syms, but don't ignore type tags.  */

  if ((DECL_NAME (decl) == 0 && TREE_CODE (decl) != TYPE_DECL)
      || DECL_IGNORED_P (decl))
    DBXOUT_DECR_NESTING_AND_RETURN (0);

This check causes the omission of the start-function stab.  The corresponding
end-function stab comes from dbxout.c (dbxout_function_end), near line 465:

#ifdef DBX_OUTPUT_NFUN
  DBX_OUTPUT_NFUN (asm_out_file, lscope_label_name, current_function_decl);
#else
=>fprintf (asm_out_file, "%s\"\",%d,0,0,", ASM_STABS_OP, N_FUN);
  assemble_name (asm_out_file, lscope_label_name);
  putc ('-', asm_out_file);
  assemble_name (asm_out_file, XSTR (XEXP (DECL_RTL (current_function_decl), 0),
0));
  fprintf (asm_out_file, "\n");
#endif



-- 


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


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

* [Bug debug/19521] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
  2005-01-19  0:40 ` [Bug debug/19521] " stuart at apple dot com
  2005-01-19  0:49 ` stuart at apple dot com
@ 2005-01-19  1:06 ` pinskia at gcc dot gnu dot org
  2005-01-19  1:16 ` [Bug debug/19521] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-19  1:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-19 01:06 -------
Does -gfull make this work?

-- 


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (2 preceding siblings ...)
  2005-01-19  1:06 ` pinskia at gcc dot gnu dot org
@ 2005-01-19  1:16 ` pinskia at gcc dot gnu dot org
  2005-01-19  2:35 ` rth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-19  1:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-19 01:16 -------
(In reply to comment #2)
> This is a regression from 3.3; I think the cause is this line in cgraphunit.c
> (cgraph_build_static_cdtor): (approximately line 1847)
> 
>   DECL_IGNORED_P (decl) = 1;

DECL_IGNORED_P was added with:
2004-07-01  Richard Henderson  <rth@redhat.com>

        * cgraph.h (cgraph_build_static_cdtor): Declare.
        * cgraphunit.c (cgraph_build_static_cdtor): New.
        * c-objc-common.c (build_cdtor): Use it.
        * coverage.c (create_coverage): Likewise.
        * libfuncs.h (LTI_gcov_init, gcov_init_libfunc): Remove.
        * optabs.c (init_optabs): Don't set gcov_init_libfunc.

I don't think IGNORED should be set on this decl as it was not set before the patch above


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|powerpc-apple-darwin        |
   GCC host triplet|powerpc-apple-darwin        |
           Keywords|                            |wrong-debug
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-19 01:16:15
               date|                            |
            Summary|omitted stab for gcov       |[4.0 Regression] omitted
                   |initialization function     |stab for gcov initialization
                   |                            |function
   Target Milestone|---                         |4.0.0


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (3 preceding siblings ...)
  2005-01-19  1:16 ` [Bug debug/19521] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-01-19  2:35 ` rth at gcc dot gnu dot org
  2005-01-19 17:08 ` stuart at apple dot com
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-01-19  2:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-01-19 02:35 -------
So the bug is the end stab without the start stab?  Or do you think that this
bit of code that corresponds not at all to any user code should have full stabs?
If the later, why?

-- 


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (4 preceding siblings ...)
  2005-01-19  2:35 ` rth at gcc dot gnu dot org
@ 2005-01-19 17:08 ` stuart at apple dot com
  2005-02-14 19:03 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: stuart at apple dot com @ 2005-01-19 17:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From stuart at apple dot com  2005-01-19 17:08 -------
> So the bug is the end stab without the start stab?

Yes.

> Or do you think that this
> bit of code that corresponds not at all to any user code should have full stabs?

My personal preference is a mild "yes."  But I can forsee that others will
disagree, and I recognize the validity of that position.

> If the later, why?

When I'm grubbing through a broken binary, it's helpful when the debugger tells
me that this function body didn't come from the user's sourcecode.  In general,
"more information is better."

I suppose the counterargument would be that most users don't look at the
assembly code, don't want to know about these functions, and would prefer
smaller debug information for faster linking and development.

I assume that most GCC users are unlike me, this I infer their argument wins.  I
can live with that; this is not a big deal either way.

If the debugger already knows the name of this function, and the stabs are not
adding any useful information, then I agree they're a waste and should be
omitted.  The big deal is that the begin/end stabs should match, both emitted or
both omitted.

-- 


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (5 preceding siblings ...)
  2005-01-19 17:08 ` stuart at apple dot com
@ 2005-02-14 19:03 ` steven at gcc dot gnu dot org
  2005-02-16 22:39 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-02-14 19:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-02-14 13:59 -------
Stuart, ping! rth attached a patch 10 days ago and asked for feedback.


-- 


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (6 preceding siblings ...)
  2005-02-14 19:03 ` steven at gcc dot gnu dot org
@ 2005-02-16 22:39 ` cvs-commit at gcc dot gnu dot org
  2005-02-17  3:33 ` rth at gcc dot gnu dot org
  2005-02-17 14:00 ` danglin at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-02-16 22:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-02-16 19:01 -------
Subject: Bug 19521

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2005-02-16 19:01:29

Modified files:
	gcc            : ChangeLog dbxout.c 

Log message:
	PR debug/19521
	* dbxout.c (dbxout_function_end): Take decl parameter; update callers.
	Do nothing if debug info suppressed for this function.
	(dbxout_begin_function): Early exit if debug info suppressed for
	this function.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7494&r2=2.7495
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dbxout.c.diff?cvsroot=gcc&r1=1.219&r2=1.220



-- 


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (7 preceding siblings ...)
  2005-02-16 22:39 ` cvs-commit at gcc dot gnu dot org
@ 2005-02-17  3:33 ` rth at gcc dot gnu dot org
  2005-02-17 14:00 ` danglin at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: rth at gcc dot gnu dot org @ 2005-02-17  3:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rth at gcc dot gnu dot org  2005-02-16 20:28 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug debug/19521] [4.0 Regression] omitted stab for gcov initialization function
  2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
                   ` (8 preceding siblings ...)
  2005-02-17  3:33 ` rth at gcc dot gnu dot org
@ 2005-02-17 14:00 ` danglin at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: danglin at gcc dot gnu dot org @ 2005-02-17 14:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From danglin at gcc dot gnu dot org  2005-02-17 03:57 -------
stage1/xgcc -Bstage1/ -B/opt/gnu/gcc/gcc-4.0.0/hppa2.0w-hp-hpux11.11/bin/   -g -
O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Werror -fn
o-common   -DHAVE_CONFIG_H -DGENERATOR_FILE  -o build/genmodes \
 build/genmodes.o build/errors.o ../build-hppa2.0w-hp-hpux11.11/libiberty/libibe
rty.a
/usr/ccs/bin/ld: Unsatisfied symbols:
   L$scope0000 (first referenced in build/genmodes.o) (data)
collect2: ld returned 1 exit status

        .stabn  224,0,0,L$scope0000-new_mode
        .stabn  224,0,0,L$scope0000-make_complex_modes

etc.


-- 


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


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

end of thread, other threads:[~2005-02-17  3:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-19  0:37 [Bug debug/19521] New: omitted stab for gcov initialization function stuart at apple dot com
2005-01-19  0:40 ` [Bug debug/19521] " stuart at apple dot com
2005-01-19  0:49 ` stuart at apple dot com
2005-01-19  1:06 ` pinskia at gcc dot gnu dot org
2005-01-19  1:16 ` [Bug debug/19521] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-01-19  2:35 ` rth at gcc dot gnu dot org
2005-01-19 17:08 ` stuart at apple dot com
2005-02-14 19:03 ` steven at gcc dot gnu dot org
2005-02-16 22:39 ` cvs-commit at gcc dot gnu dot org
2005-02-17  3:33 ` rth at gcc dot gnu dot org
2005-02-17 14:00 ` danglin 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).