Thread View: gnu.gdb.bug
2 messages
2 total messages
Started by Scott McPeak
Fri, 03 May 2002 07:08
RFE: more than 16-bit line numbers
Author: Scott McPeak
Date: Fri, 03 May 2002 07:08
Date: Fri, 03 May 2002 07:08
63 lines
3406 bytes
3406 bytes
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.
-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. */
Re: RFE: more than 16-bit line numbers
Author: Michael Snyder
Date: Fri, 03 May 2002 18:49
Date: Fri, 03 May 2002 18:49
74 lines
4105 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads