[PATCH 2/5] powerpc64-aix processing xlC generated line table
Ulrich Weigand
uweigand@de.ibm.com
Wed Aug 7 15:23:00 GMT 2013
Raunaq 12 wrote:
> xlc generated binaries have a line table which is not the same as GCC.
> GCC compiled binaries have an extra line entry in the line table to
> signify start of a function whereas xlc does not have this entry.
>
> Due to this difference, commands like break <function name> and
> list <function name> give wrong results.
>
> To fix this issue I have written a function modify_xlc_linenos
> which will add a line table entry at the function start points
> if there is no extra entry in the line table as in the case of xlc.
>
> Hence,
> breakpoints and listing functions will work as expected even for xlc
> compiled binaries.
I don't have much experience with the XCOFF file format or the
XLC debug info ...
Did you confirm -via test suite runs- that:
- this patch improves results when using XLC, and
- this patch does not regress when using GCC?
> +/* 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. */
> +
> +static struct linetable *
> +modify_xlc_linenos (struct linetable *lineTb)
> +{
> + int jj;
> + 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;
> + }
> + return lineTb;
> +}
> +
> /* Global variable to pass the psymtab down to all the routines involved
> in psymtab to symtab processing. */
> static struct partial_symtab *this_symtab_psymtab;
> @@ -698,10 +718,14 @@
>
> lv = main_subfile.line_vector;
>
> + /* Add extra line entry in case of xlc compiled binaries. */
> +
> + lineTb = modify_xlc_linenos (lv);
> +
> /* 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 +754,14 @@
>
> lv = (inclTable[ii].subfile)->line_vector;
>
> + /* Add extra line entry in case of xlc compiled binaries */
> +
> + lineTb = modify_xlc_linenos (lv);
> +
> /* Line numbers are not necessarily ordered. xlc compilation will
> put static function to the end. */
>
> - lineTb = arrange_linetable (lv);
> + lineTb = arrange_linetable (lineTb);
Is there any reason why the change done in the new modify_xlc_linenos
routine cannot be done inline in arrange_linetable? The latter
routine already appears to do a number of checks related to the
end of line table entries ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
More information about the Gdb-patches
mailing list