//
./apl(_ZN10APL_parser9nextTokenEv+0x1dc) [0x80778dc]
// │││││ │││││
│││││││││
// └┴┴┴┴─── program
name
│││││ └┴┴┴┴┴┴┴┴───── abs_addr
//
└┴┴┴┴───────────────── asm_offset
The macOS system function backtrace_symbols() - called by
Backtrace::show() returns the strings in this format:
//
// 14 apl
0x00000001000a93f0
_ZN9Workspace19immediate_executionEb + 68
// ││ └┴┴─── program
name
││││││││││││││││││ ││││││││││││││││││||||||||||||||||||
└┴─── asm_offset
// └┴─── stack
level
││││││││││││││││││
└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴─── function name
//
└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴───── abs_addr
//
These strings don't match what the code is looking for, so
the stack trace doesn't contain any useful information.
I prototyped some changes to Backtrace::show_item() to be
able to recognize that GNU APL is being built on Apple
macOS, and parse the macOS backtrace_symbols() string
format. The resulting code seems to compile and work
correctly on Intel Linux and macOS (both on Intel and Apple
Silicon CPUs).
I've attached the diffs between SVN 1745 and my changed code.
(I also made some other changes to the code to reflect use of
nullptr and '\0' instead of the number 0 to improve the
contextual clarity of some of the code. There are also a couple
of changes to remove some compiler warnings on macOS for
unreachable code)
You're welcome to use them if you find them useful.