Skip to content

addr2line reports incorrect line numbers #5

@igrr

Description

@igrr

In some cases xtensa-{esp32,lx106}-elf-addr2line reports line numbers which don't match the source code. If the same address is passed into gdb, gdb reports correct line number.

Example (with xtensa-esp32-elf):

xtensa-esp32-elf-addr2line -pfia -e unit-test-app.elf <<<"0x400859b1"
0x400859b1: spi_flash_read at /Users/ivan/e/esp-idf/components/spi_flash/./flash_ops.c:521
xtensa-esp32-elf-gdb unit-test-app.elf -ex "l *0x400859b1" -ex "q"
GNU gdb (crosstool-NG crosstool-ng-1.22.0-70-gfa0bad1) 7.10
<snip>
0x400859b1 is in spi_flash_read (/Users/ivan/e/esp-idf/components/spi_flash/./flash_ops.c:454).
449	/Users/ivan/e/esp-idf/components/spi_flash/./flash_ops.c: No such file or directory.

This address was part of a backtrace; based on the context i see that 454 is the correct line.

unit-test-app.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions