Hi Paul,
thanks. I have incorporated your diffs,
SVN 1752.
Please check on your Apple since I don't own one (
⎕FIO ¯16
to provoke a stack dump).
I was also wondering where macro
_APPLE_ is defined. In a
header file
(which ?) or with -D on the command line? In the latter case we
could let
./configure set the macro (for that I would need to know the output
of
the
uname command on your machine).
Best Regards,
Jürgen
On 2/12/24 23:40, Paul Rockwell wrote:
I've found that stack traces don't display correctly with GNU APL
on macOS platforms (Intel and Apple Silicon). Examining the source
for Backtrace.cc, I've found that function Backtrace::show_item()
is expecting the string passed to it to look like this:
//
./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.
- Paul Rockwell