This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/5] powerpc64-aix- Processing XLC generated line tables + CHANGELOG
- From: Raunaq 12 <raunaq12 at in dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Tue, 23 Jul 2013 11:08:00 +0530
- Subject: Re: [PATCH 1/5] powerpc64-aix- Processing XLC generated line tables + CHANGELOG
- References: <OFCC1287F3 dot 734C3B12-ON65257BA3 dot 003677E5-65257BA3 dot 00368540 at in dot ibm dot com> <20130709144847 dot GC8063 at adacore dot com> <OF9A3EE4E4 dot 3316E009-ON65257BA4 dot 0022706B-65257BA4 dot 00236B06 at in dot ibm dot com> <87zjtufh9s dot fsf at fleche dot redhat dot com> <OF10BAEAF9 dot FB22C356-ON65257BA5 dot 002879DF-65257BA5 dot 002A8FFA at LocalDomain>
Any feedback on this patch?
Raunaq 12/India/IBM wrote on 07/11/2013 01:13:44 PM:
> From: Raunaq 12/India/IBM
> To: Tom Tromey <tromey@redhat.com>
> Cc: gdb-patches@sourceware.org
> Date: 07/11/2013 01:13 PM
> Subject: Re: [PATCH 1/5] powerpc64-aix- Processing XLC generated line
tables + CHANGELOG
>
> powerpc-ibm-aix: Fix line number handling for xlc compiled binaries.
>
> xlc compiled binaries have a line table which is different from gcc
compiled ones.
> It does not contain 1 extra entry which indicates the function start PC.
>
> Because of this, listing functions, eg: 'list main' or
> breaking at functions, eg: 'break function1' give wrong line numbers.
>
> To fix this, we check if the function entry point has an entry in the
> line table (in case of gcc, it does). If it does not have this entry,
then we retain
> the function entry lines marked as line number equal to 0 and assign the
line number
> equal to the succeeding line table entry.
> ---
>
> ChangeLog :-
> * xcoffread.c (process_linenos): Add fix to correctly process linenos in
> case of xlc compiled binaries.
>
> ---
> Index: ./gdb/xcoffread.c
> ===================================================================
> --- ./gdb.orig/xcoffread.c
> +++ ./gdb/xcoffread.c
> @@ -602,7 +602,7 @@
> static void
> process_linenos (CORE_ADDR start, CORE_ADDR end)
> {
> - int offset, ii;
> + int offset, ii, jj;
> file_ptr max_offset
> = XCOFF_DATA (this_symtab_objfile)->max_lineno_offset;
>
> @@ -698,10 +698,24 @@
>
> lv = main_subfile.line_vector;
>
> + /* xlc compiled binaries have one less entry in the line table.
> + So the function entry lines marked as line number equal to 0
> + will be retained in the line table with line numbers equal
> + to its succeeding line table entry. */
> +
> + lineTb = lv;
> +
> + for (jj = 0; jj < lineTb->nitems; jj++)
> + {
> + if (lineTb->item[jj].line == 0 && (lineTb->item[jj].pc
> + != lineTb->item[jj + 1].pc))
> + lineTb->item[jj].line = lineTb->item[jj + 1].line;
> + }
> +
> /* Line numbers are not necessarily ordered. xlc compilation will
> put static function to the end. */
>
> - lineTb = arrange_linetable (lv);
> + lineTb = arrange_linetable (lineTb);
> if (lv == lineTb)
> {
> current_subfile->line_vector = (struct linetable *)
> @@ -730,10 +744,24 @@
>
> lv = (inclTable[ii].subfile)->line_vector;
>
> + /* xlc compiled binaries have one less entry in the line
table.
> + So the function entry lines marked as line number equal to
0
> + will be retained in the line table with line numbers equal
> + to its succeeding line table entry. */
> +
> + lineTb = lv;
> +
> + for (jj = 0; jj < lineTb->nitems; jj++)
> + {
> + if (lineTb->item[jj].line == 0 && (lineTb->item[jj].pc
> + != lineTb->item[jj + 1].pc))
> + lineTb->item[jj].line = lineTb->item[jj + 1].line;
> + }
> +
> /* Line numbers are not necessarily ordered. xlc compilation
will
> put static function to the end. */
>
> - lineTb = arrange_linetable (lv);
> + lineTb = arrange_linetable (lineTb);
>
> push_subfile ();
>
> ---
> Hope this clears up the formatting. I reduced the line size,
> removed spaces after "->" and added spaces around "+".
> Thanks for the feedback. Just in case the patch is still not readable,
> I am attaching it as a text file below.
>
> [attachment "gdb-7.6-xcoffread_line_nos.patch" deleted by Raunaq
12/India/IBM]
>
> Thanks & Regards,
> Raunaq