This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/5] powerpc64-aix- Processing XLC generated line tables + CHANGELOG


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]