Patch: Handle relative paths in .debug_line

Bryce McKinlay mckinlay@redhat.com
Thu Jul 22 23:31:00 GMT 2004


When debugging mainline gcc, GDB has a problem locating source for files 
which are only referenced from .debug_line. For example: debugging gcj, 
and trying to put a breakpoint on the parse.y file, I get the following:

Breakpoint 1, lookup_method_invoke (lc=1, cl=0xf6dee5f0, class=0xf6def244,
    name=0xf6dee550, arg_list=0xf6e574b0) at parse.y:10956
10956   parse.y: No such file or directory.
        in parse.y
(gdb) info source
Current source file is parse.y
Compilation directory is ../../gcc/java
Source language is c.
Compiled with unknown debugging format.
Does not include preprocessor macro info.

This is because the contents of the directory table in .debug_line can 
be paths relative to the DW_AT_comp_dir:


 The Directory Table:
  ../../gcc/java
  java
  /usr/include/bits
  .
  ../../gcc
  ../../gcc/../libcpp/include
  ../../gcc/config/i386
  ../../gcc/../include
  /local/gcc-clean/lib/gcc/i686-pc-linux-gnu/3.5.0/include
  /usr/include

 The File Name Table:
  Entry    Dir    Time    Size    Name
  1    1    0    0    keyword.h
  2    1    0    0    lex.c
  3    2    0    0    parse.c
  4    1    0    0    parse.y
... etc...

     DW_AT_comp_dir    : (indirect string, offset: 0x658c): 
/home/mckinlay/cvs/gcc-really-clean/build/gcc   

This patch fixes the problem by appending the path from the directory 
table, if it is not absolute already, to the DW_AT_comp_dir path when 
creating subfiles from the .debug_line info.

OK to commit?

Bryce


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb-subfile-compdir.patch
Type: text/x-patch
Size: 4315 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20040722/63407f40/attachment.bin>


More information about the Gdb-patches mailing list