-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Absolute source file paths are required for debuginfod to work #91
Comments
Are you suggesting that libbacktrace should pass an absolute path if possible when calling the callback functions? That seems reasonable. I kind of thought that libbacktrace did that already. It certainly tries to do so. Maybe there are some cases that it misses. Can you show me a test case? Thanks. |
Yes, absolute paths should be expected. I have created a simple test application: // g++ test.cpp -g ../libbacktrace/.libs/libbacktrace.a
#include <execinfo.h>
#include <stdio.h>
#include "../libbacktrace/backtrace.h"
int SymCb( void* data, uintptr_t pc, const char* fn, int lineno, const char* func )
{
printf( "%s: %s:%i\n", func, fn, lineno );
return 0;
}
void ErrCb( void* data, const char* msg, int errnum )
{
}
int main()
{
uintptr_t addr;
backtrace( (void**)&addr, 1 );
auto state = backtrace_create_state( nullptr, 0, nullptr, nullptr );
backtrace_pcinfo( state, addr, SymCb, ErrCb, nullptr );
} Unfortunately, it is returning an absolute path: This is happening with a relative
There must be some deeper interaction which is preventing proper |
Ok, I have repro. The code is the same as above, but you have to build it in a slightly different way:
|
There are four places in For the case returning absolute values:
And for the case returning relative values:
|
In |
This is a different take on #72 and #26.
Excerpt from the DEBUGINFOD(8) manual page about the requirement, with some reasoning about it:
The problem is that libbacktrace is currently providing paths such as:
/usr/src/debug/curl-7.83.0/lib/transfer.c
or../mesa-22.0.2/src/mesa/state_tracker/st_atom_viewport.c
. The first path, which is absolute, can be used with debuginfod without any problems. However, the second path, a relative one, does not specify an exact location, due to reasons discussed in the manual page above.Inspecting the libraries with objdump gives the following results:
In this case,
DW_AT_name
is absolute, soDW_AT_comp_dir
value does not need to be used.However, in this second example, the
DW_AT_name
is relative, soDW_AT_comp_dir
should be prepended to it, producing the following result:/usr/src/debug/build/../mesa-22.0.2/src/mesa/state_tracker/st_atom_viewport.c
.Is this something you are interested in implementing?
The text was updated successfully, but these errors were encountered: