🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #2221

Re: RFE: more than 16-bit line numbers

#2221
From: Michael Snyder
Date: Fri, 03 May 2002 18:49
74 lines
4105 bytes
Scott McPeak wrote:
> 
> I'm working on a project in which some very long (millions of lines) C
> source files get generated.  Since GNU 'as' and 'gdb' cannot store more
> than 16 bits of line number information, debugging programs using these
> files is tedious.
> 
> The reason for the 16-bit limit is the n_desc field of the stabs symbol is
> 16 bits (see http://www.kashpureff.org/nic/linux/texinfo/stabs_6.html).
> 
> As a stopgap, I've hacked 'as' and 'gdb' to put bits 16-23 into the
> n_other field, which I understand is usually zero anyway (but
> gdb-5.2/include/bout.h suggests that sometimes it's not, at least on some
> architectures).  Below are patches to each package (binutils-2.12 and
> gdb-5.2) which accomplish the hack.

Have you tried using -gdwarf-2?


> 
> -Scott
> 
> ------------------------------------- 8< -------------------------
> --- binutils-2.12/gas/stabs.c.orig      Thu May  2 23:36:03 2002
> +++ binutils-2.12/gas/stabs.c   Fri May  3 00:03:57 2002
> @@ -251,6 +251,20 @@
>        input_line_pointer++;
>        SKIP_WHITESPACE ();
>      }
> +
> +  /* handle descriptions (line numbers!) which are >0xFFFF */
> +  if (desc > 0xFFFF)
> +    {
> +      if (desc > 0xFFFFFF)
> +       as_warn(_("desc is too large to encode in 24 bits: %d"), desc);
> +      else if (other != 0)
> +       as_warn(_("I want to use 'other', but it is not zero: %d"), other);
> +      else
> +       /* stick the extra bits in 'other' because it is typically unused;
> +        * of course, downstream tools (like gdb) need to be modified to
> +        * use this information */
> +       other = desc >> 16;
> +    }
> 
>  #ifdef TC_PPC
>  #ifdef OBJ_ELF
> --- gdb-5.2/gdb/dbxread.c.orig  Thu May  2 23:21:09 2002
> +++ gdb-5.2/gdb/dbxread.c       Thu May  2 23:31:43 2002
> @@ -970,6 +970,7 @@
>        (intern).n_value = bfd_h_get_signed_32 (abfd, (extern)->e_value);        \
>      else                                                               \
>        (intern).n_value = bfd_h_get_32 (abfd, (extern)->e_value);       \
> +    (intern).n_other = bfd_h_get_8 (abfd, (extern)->e_other);          \
>    }
> 
>  /* Invariant: The symbol pointed to by symbuf_idx is the first one
> @@ -2599,8 +2600,10 @@
> 
>        if (type & N_STAB)
>         {
> -         process_one_symbol (type, nlist.n_desc, nlist.n_value,
> -                             namestring, section_offsets, objfile);
> +         /* to handle line numbers larger than 0xFFFF, add the 'other'
> +          * field to n_desc (after shifting by 16 bits) */
> +         process_one_symbol (type, nlist.n_desc + (nlist.n_other << 16),
> +                             nlist.n_value, namestring, section_offsets, objfile);
>         }
>        /* We skip checking for a new .o or -l file; that should never
>           happen in this routine. */
> 
> _______________________________________________
> Bug-gdb mailing list
> Bug-gdb@gnu.org
> http://mail.gnu.org/mailman/listinfo/bug-gdb
Technical Details
Message-ID: <3CD2DBAA.70D8033F@redhat.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!ra.nrl.navy.mil!dca6-feed2.news.algx.net!allegiance!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
References: <Pine.LNX.4.33.0205022344130.811-100000@seamonkey.pasture.cow>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,eebaf94dcee3f771
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-05-03 12:02:05 PST
x-uunet-gateway: sjc3sosrv11.alter.net from bug-gdb to gnu.gdb.bug; Fri, 3 May 2002 19:02:03 GMT
Sender: msnyder@cygnus.com
Message-ID: <3CD2DBAA.70D8033F@redhat.com>
Date: Fri, 03 May 2002 11:49:14 -0700
From: msnyder@redhat.com (Michael Snyder)
Organization: Red Hat, Inc.
X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: RFE: more than 16-bit line numbers
References: <Pine.LNX.4.33.0205022344130.811-100000@seamonkey.pasture.cow>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!ra.nrl.navy.mil!dca6-feed2.news.algx.net!allegiance!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
Lines: 74