Open timadye opened 2 years ago
@HadrienG2 followed up on Mattermost, which I copy here:
Glad to see that you sorted this out! Just to clarify one point...
In this case, it breaks at a different line from that selected, presumably due to inlining the tryRungeKuttaStep lambda. If this is a problem, it might help to compile with -DCMAKE_BUILD_TYPE=Debug, rather than the default RelWithDebInfo.
There's actually more than inlining going on in there.
The debugger cannot really break on source lines, since those don't exist anymore in the compiled binary, there are only machine code instructions in there. So what the debugger does, with the help of compiler-generated debug information, is to try and correlate machine instructions with the source line that triggered their generation.
This mapping is ambiguous as a machine instruction can be linked to multiple source instructions (if the compiler merged together redundant computations) and conversely a source line can at times not generate any machine code (if the compiler elided the computation at compile time, or somehow managed to execute the equivalent of multiple source instructions in one machine instruction, then decided that the "main" instruction in that ensemble is not the one that you think).
So what GDB does is to try and break at the point in machine code which is most closely linked to the source line that you were interested in.
This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.
This issue/PR has been automatically marked as stale because it has not had recent activity. The stale label will be removed if any interaction occurs.
It would be nice to have some documentation with hints for debugging ACTS. There are a few specifics:
Debug
build can help, but defaultRelWithDebInfo
still possible.Here is an example I posted to Mattermost that deals with most of these issues. Maybe it would be a good starting point for the documentation. I only have experience of
gdb
. Andi suggested adding links to the different debuggers.I didn't yet make a WiP PR, because I don't know where to put this. Should it go on a page of its own, or in a section elsewhere?
It's much easier to run with 1 thread. It's fine to use the Python examples. I edited to set
numThreads=1
inacts.examples.Sequencer()
. Then rangdb
:After that, the log includes 8 messages like:
but those are mostly ROOT running various commands, so not a problem for debugging ACTS. It breaks here:
At this point, the program has loaded all the ACTS shared libraries, so you can now set breakpoints directly, not just pending ones. Of course if you want to debug the sequence setup, you'll have to set a breakpoint earlier. But for algorithm execution,
Sequencer::run()
is a good place to start.It can be very difficult to set breakpoints using the fully qualified templated symbols, but easy to use the source line, eg.
The 10 locations are probably different template instantiations. This one breaks quite quickly, and shows the full (enormous) class name:
In this case, it breaks at a different line from that selected, presumably due to inlining the
tryRungeKuttaStep
lambda. If this is a problem, it might help to compile with-DCMAKE_BUILD_TYPE=Debug
, rather than the defaultRelWithDebInfo
.You can use
where
to see the full stack trace and all the othergdb
commands.