ianlancetaylor / libbacktrace

A C library that may be linked into a C/C++ program to produce symbolic backtraces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`backtrace_pcinfo` yields mixed relative and absolute pathes

athre0z opened this issue · comments

https://github.com/ianlancetaylor/libbacktrace/blob/master/dwarf.c#L2874

Absolute paths are returned when no line info is found, relative ones for all other cases. The code that creates an abs path from the relative one is only invoked when ln == NULL. What is the intuition behind that? I think it would be better to always return absolute paths, or always return relative ones and make comp_dir available to the user.

Related: athre0z/color-backtrace#2

The code does the same thing in all cases, as far as I can see. In the ln == NULL case in dwarf_lookup_pc, there is no entry in the line table, so we add the directory to a relative path name there. When there is an entry in the line table, we add the directory when we build the line table information in read_line_program. So while there could certainly be a bug here, I think I need to see a test case. Thanks.

So while there could certainly be a bug here, I think I need to see a test case. Thanks.

@ianlancetaylor => #72