Using CrashReport on Mac OS

skpang

Well-known member
I'm using Teensyduino 1.54-beta12 on Mac OS and CrashReport has reported this problem:

CrashReport:
A problem occurred at (system time) 0:0:13
Code was executing from address 0x3042E
CFSR: 82
(DACCVIOL) Data Access Violation
(MMARVALID) Accessed Address: 0x8 (nullptr)
Check code at 0x3042E - very likely a bug!
Run "addr2line -e mysketch.ino.elf 0x3042E" for filename & line number.
Temperature inside the chip was 55.00 °C
Startup CPU clock speed is 600MHz
Reboot was caused by auto reboot after fault or bad interrupt detected

I tried to run addr2line -e mysketch.ino.elf but it display an error
-bash: addr2line: command not found

So I assume addr2line is not installed. Where can I get addr2line for Mac OS ? Tried to google but some of the answers are very old.
 
Its not in the current path.

Is addr2line bundled in the Teensyduino.app ? I can't find it inside the app.
 
Its not in the current path.

Is addr2line bundled in the Teensyduino.app ? I can't find it inside the app.

It should be in the same folder as arm-none-eabi-gcc. I use windows, the folder looks like this:

2021-08-18 22_10_21-bin.png
The name is arm-none-eabi-addr2line.exe here.
 
Found arm-none-eabi-addr2line but the instruction is to use "addr2line" and that doesn't exist.


When I run arm-none-eabi-addr2line -e lvgl_v8_0_2_test.ino.elf 0x3042E it just print out:
:?


Should this give a filename and line number ? No file name or line number.
 
Yes the instruction is wrong. Or, better, inadmissibly abbreviated.

:? means it could not identify a line. Can't answer why.
 
I've been using it on MacOS to diagnose my own issues lately, though I didn't know about the addr2line bundled in the Teensyduino.app, personally I installed it through Homebrew. The link to the specific brew is here, I also could not find it at first. I quickly tested the bundled one and it does work the same though.
 
Found arm-none-eabi-addr2line but the instruction is to use "addr2line" and that doesn't exist.


When I run arm-none-eabi-addr2line -e lvgl_v8_0_2_test.ino.elf 0x3042E it just print out:
:?


Should this give a filename and line number ? No file name or line number.

On Windows in a DOS box the addr2line was on my path and just worked as indicated in the CrashReport message when I supplied the address and the ELF file.

Presented a line number.
 
Hm, but that's not the normal case - there shouldn't be a addr2line in the path, unless you manually added it there or you have installed other software which does that. TD does not do it.
 
Hm, but that's not the normal case - there shouldn't be a addr2line in the path, unless you manually added it there or you have installed other software which does that. TD does not do it.

I was happy it worked - so didn't ask why.

I did just find out why: not sure when this installed - probably from installing MSFT Visual Studio - but thankful for it, and that it was added to path:
Code:
C:\>where addr2line
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\addr2line.exe

So indeed TeensyInstaller did not put that on the 'PATH' - and finding it would have taken effort, especially with the munged name of : arm-none-eabi-addr2line
 
At least the location of the compiler executables is displayed on every compile in verbose mode.
Code:
Using core 'teensy4' from platform in folder: C:\Arduino\hardware\teensy\avr
Detecting libraries used...
"C:\\Arduino\\hardware\\teensy/..[B]/tools/arm10/bin/arm-none-eabi-g++[/B]" -E -CC -x c++ -w -Wall -ffunction-sections -fdata-sections -nostdlib -fno-common -fanalyzer -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=155 -DARDUINO=10815 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_42635\\sketch\\sketch_aug19a.ino.cpp" -o nul
Generating function prototypes...
 
Found arm-none-eabi-addr2line but the instruction is to use "addr2line" and that doesn't exist.


When I run arm-none-eabi-addr2line -e lvgl_v8_0_2_test.ino.elf 0x3042E it just print out:
:?


Should this give a filename and line number ? No file name or line number.

When I mess up like using the wrong file or to high a number get either ??:0 or :?
To verify if working, put in a number like 50 or 100 (instead of the 0x3042E) you should see some library locations.

Also note that if you quit the Arduino(Teensyduino) app the temp folder and elf file will go away.
 
@skpang did you ever get this to work?
I'm in the bin folder (/Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/bin) and I also get command not found.
 
@skpang did you ever get this to work?
I'm in the bin folder (/Applications/Teensyduino.app/Contents/Java/hardware/tools/arm/bin) and I also get command not found.

Sorry I don't use my mac much, but on my machine I found something at : hardware\tools\arm\bin\arm-none-eabi-addr2line

Did not try it, Mac just rebooted, battery down to 0... now up to 1%...
 
You need to use the arm-none-eabi-addr2line instead of addr2line

That should be in the latest Teensyduino but it didn't really help me much as it didn't point to .c file.
 
I get the same command not found with arm-none-eabi-addr2line , even though it's in the folder..
 
Again don't use Mac much... but assuming it is like linux... when you type: arm-none-eabi-addr2line
it looks on the path to find the executable. You need to give it a full path like: ./arm-none-eabi-addr2line
 
Alternatively you can just drag the file from Finder into terminal rather than cding into the folder and typing it out.
 
Again don't use Mac much... but assuming it is like linux... when you type: arm-none-eabi-addr2line
it looks on the path to find the executable. You need to give it a full path like: ./arm-none-eabi-addr2line

As usual - you have the right answer:)

Now where do I find the elf file - im guessing its in a temp hidden folder?
 
Either you can use verbose output and look for where the line that generates it says where it is then copy it or what I do is after compiling in the Teensy Loader you can click "Open HEX File" and the finder browser that opens up will show the last compiled sketches folder. From there you can just drag the elf to the terminal window.
 
Either you can use verbose output and look for where the line that generates it says where it is then copy it or what I do is after compiling in the Teensy Loader you can click "Open HEX File" and the finder browser that opens up will show the last compiled sketches folder. From there you can just drag the elf to the terminal window.
That idea of using Teensy Loader "Open HEX File" to find the .elf file is a good one, easiest novice way by far. Note that the window that opens will show the .elf file grayed out which normally means you can't select it. Just ignore and drag to the terminal window(then cancel the "Open HEX File" window). I like to be in the terminal directory when issuing commands so now use your method followed by selecting the next folder up and then dragging the folder to paste into the terminal window preceded with 'cd '.

For those who like alias's, ending the path with ...../T/arduino_b*' seems to get there reliably as below.
alias ardbuild='/var/folders/q9/pwxvzmz56xvbkcnp3q0gsjkr0000gn/T/arduino_b*'

I found I can’t see line numbers unless I also compile with the -g option.
For info the -g option is called in the standard Arduino Teensy setup.
 
Has anyone been able to use the addr2line with the .elf generated by PlatformIO?
I’ve tried but no success, get random characters on output
 
The elf is the same as with Teensyduino, as it is generated by the same toolchain.
Maybe you're using the wrong addr2line?
 
Back
Top