Debug Location Info #267
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#267
Loading…
Reference in New Issue
No description provided.
Delete Branch "debug_info"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Added the debug location info needed to show the backtrace.
Tested on devices with some common cases except for this bug which I did not find manage to find the cause yet...
this code works fine:
gives:
but if we specify the type of the exception by
except IndexError:
modified code
the traceback will fail to give correct line number and the source code information:
AFAIK the "standard" in Python would be
<nac3_synthesized_modinit>
Hmm despite some more trails with the code that users may write (among which some can and some cannot produce the valid location info in traceback), it seems that the problem is with the llvm optimization when lowering to target platform specific binaries?
for the following more minimized code:
the optimized IR can be generated with desired debug location info:
optimized IR
but the traceback will still fail UNLESS we take the following patch to set the optimization level to
None
(Less
does not work, either) when creating target machine:67d52b93a0
to5c9c8c19b3
Thanks! force-pushed to change the internal names to be enclosed by
<>
5c9c8c19b3
toa0d170ab41
a0d170ab41
toa722386b72
a722386b72
to5cfd308bb1
5cfd308bb1
to8fa8da9a94
8fa8da9a94
to16801eec72
16801eec72
to397b04f1b8
Just to note down some more minimized examples that would cause the location info to disappear (setting
OptimizationLevel::None
when creating target machine can still bring them back):So it seems that the control flow did matters.. guess that it is indeed the optimization which causes the location information to be invalid, plan to look more into how
llvm-dwarfdump
can help@ -554,0 +577,4 @@
|| "<nac3_internal>".to_string(),
|f| {
let name = f.location.file.0.to_string();
if name.contains("__nac3_synthesized_modinit__") {
Why
contains
and not==
?Also can we simply call it
<nac3_synthesized_modinit>
in the first place (i.e. when callingparse_program
), or is it causing problems?This special case also goes against the nac3core/nac3artiq separation, we should avoid nac3artiq-specific code in nac3core.
Indeed calling
<nac_synthesized_modinit>
in the first place should be the best, force-pushed to update this, thanks!397b04f1b8
toa022005183
WIP: Debug Location Infoto Debug Location Info