call traceback is indecipherable garbage

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Jan 26 03:33:31 UTC 2022


On Wed, Jan 26, 2022 at 02:20:17AM +0000, forkit via Digitalmars-d wrote:
[...]
> std.exception.ErrnoException at std\stdio.d(545): Cannot open file `nosuchfile'
> in mode `rb' (No such file or directory)
> ----------------
> 0x000000013FB5F836
> 0x000000013FB53423
> 0x000000013FB51269
> 0x000000013FB51057
> 0x000000013FB5ECB3
> 0x000000013FB5EB2F
> 0x000000013FB5EC1B
> 0x000000013FB5EB2F
> 0x000000013FB5EA56
> 0x000000013FB53171
> 0x000000013FB51094
> 0x000000013FBD2F68
> 0x0000000076F9556D in BaseThreadInitThunk
> 0x00000000771F372D in RtlUserThreadStart

Did you compile with debugging symbols, i.e., with -g?

For example, given this code:

	void can() { throw new Exception("buahaha"); }
	void if_you() { can(); }
	void catch_me() { if_you(); }
	void can_you() { catch_me(); }
	void main() {
		can_you();
	}

Running with `dmd -run test.d` produces:

	object.Exception@/tmp/test.d(1): buahaha
	----------------
	??:? void test.can() [0x55c95255673b]
	??:? void test.if_you() [0x55c952556748]
	??:? void test.catch_me() [0x55c952556754]
	??:? void test.can_you() [0x55c952556760]
	??:? _Dmain [0x55c95255676c]

Not bad, but not very helpful. If there are some inner functions you
might not get the function names either.

Running with `dmd -g -run test.d` produces:

	object.Exception@/tmp/test.d(1): buahaha
	----------------
	/tmp/test.d:1 void test.can() [0x55cff3e3773b]
	/tmp/test.d:2 void test.if_you() [0x55cff3e37748]
	/tmp/test.d:3 void test.catch_me() [0x55cff3e37754]
	/tmp/test.d:4 void test.can_you() [0x55cff3e37760]
	/tmp/test.d:6 _Dmain [0x55cff3e3776c]

Voila! Line numbers and source filenames!


T

-- 
Gone Chopin. Bach in a minuet.


More information about the Digitalmars-d mailing list