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] |
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. (See attached file: gdb-7.6-xcoffread_line_nos.patch) Thanks & Regards, Raunaq
Attachment:
gdb-7.6-xcoffread_line_nos.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |