pyocd / pyocd/pyOCD

IntervalTree error when debugging nRF-52840 using elf built with GCC

Open
#728 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

PyOCD: 0.21.0
Mbed OS: 5.13.1
OS: MacOS 10.14.5
Compiler: GCC (works fine on AC6)

When debugging blinky, the following error occurs:

> ./pyocd gdbserver --target nrf52840 --elf "/Users/thegecko/Mbed Programs/mbed-os-example-blinky/BUILD/NRF52840_DK/GCC_ARM/mbed-os-example-blinky.elf"
0002303:CRITICAL:__main__:IntervalTree: Null Interval objects not allowed in IntervalTree: Interval(85192, 85192, )
Traceback (most recent call last):
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/pyocd/__main__.py", line 338, in run
    self._COMMANDS[self._args.cmd](self)
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/pyocd/__main__.py", line 569, in do_gdbserver
    session.board.target.elf = self._args.elf
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/pyocd/core/coresight_target.py", line 91, in elf
    self.cores[0].set_target_context(FlashReaderContext(self.cores[0].get_target_context(), self._elf))
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/pyocd/debug/elf/flash_reader.py", line 31, in __init__
    self._build_regions()
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/pyocd/debug/elf/flash_reader.py", line 39, in _build_regions
    self._tree.addi(start, start + length, sect)
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/intervaltree/intervaltree.py", line 343, in addi
    return self.add(Interval(begin, end, data))
  File "/Users/thegecko/mbed-studio-tools/python/lib/python2.7/site-packages/intervaltree/intervaltree.py", line 326, in add
    " {0}".format(interval)
ValueError: IntervalTree: Null Interval objects not allowed in IntervalTree: Interval(85192, 85192, )

When the elf file isn't specified, debugging works fine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the provided nRF52840 blinky ELF and the gdbserver command. Start in pyocd/debug/elf/flash_reader.py, especially _build_regions(), and inspect how the ELF sections produce the IntervalTree input. Done means gdbserver can load this ELF without the null-interval exception while debugging still works without --elf.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.