[Issue 23939] New: trace handler showing incorrect stack frames
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 26 16:22:41 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23939
Issue ID: 23939
Summary: trace handler showing incorrect stack frames
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: schveiguy at gmail.com
Stack trace seems to show frames that it shouldn't. For example:
```d
unittest
{
int x;
assert(x == 1);
}
void main() {}
```
Compiled with ldc/dub:
Gives:
```
core.exception.AssertError at source/app.d(4): Assertion failure
----------------
??:? object.Throwable.TraceInfo core.runtime.defaultTraceHandler(void*)
[0x1025cf073]
??:? int core.runtime.runModuleUnitTests().__foreachbody6(object.ModuleInfo*)
[0x1025cf2ff]
??:? _d_run_main [0x1025d76ef]
/Users/steves/ldc2-1.32.1-osx-universal/bin/../import/core/internal/entrypoint.d:42
main [0x10258babf]
??:? start [0x1027d508b]
??:? 0x0 [0xd5547fffffffffff]
```
In previous versions (before the stack trace handler update in 2.102), the
stack trace looked like this:
```
core.exception.AssertError at source/app.d(4): Assertion failure
----------------
??:? _d_assert [0x102cc3fcf]
source/app.d:4 void app.__unittest_L1_C1() [0x102b6420f]
??:? int core.runtime.runModuleUnitTests().__foreachbody6(object.ModuleInfo*)
[0x102cdcca3]
??:? int rt.minfo.moduleinfos_apply(scope int
delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref
rt.sections_elf_shared.DSO) [0x102cf5573]
??:? int rt.sections_elf_shared.DSO.opApply(scope int delegate(ref
rt.sections_elf_shared.DSO)) [0x102cf6c53]
??:? int rt.minfo.moduleinfos_apply(scope int
delegate(immutable(object.ModuleInfo*))) [0x102cf5507]
??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*))
[0x102ce52cf]
??:? runModuleUnitTests [0x102cdcad7]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int
function(char[][])*).runAll() [0x102ceca3b]
??:? _d_run_main2 [0x102cec853]
??:? _d_run_main [0x102cec6bf]
/Users/steves/ldc2-1.28.0-osx-arm64/bin/../import/core/internal/entrypoint.d:42
main [0x102b6424b]
```
Large differences happening between these traces. Frames don't show, extra
frames seem to be present (notably the 0x0 frame and the defaultTraceHandler
frame)
I don't know which part of the trace info is the problem -- the printing or the
storage.
The PR where the stack trace change happened was here:
https://github.com/dlang/dmd/pull/14710
Although my compiler is ldc, I have verified similar things happen on Linux
with dmd.
--
More information about the Digitalmars-d-bugs
mailing list