This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/5] powerpc64-aix processing xlC generated line table
- From: Raunaq 12 <raunaq12 at in dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Cc: tromey at redhat dot com, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Date: Mon, 29 Jul 2013 11:45:27 +0530
- Subject: [PATCH 2/5] powerpc64-aix processing xlC generated line table
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 ();
---