[MSP430] Enable some basic support for debug information

Authored by atrosinenko on Jun 22 2020, 3:14 AM.


[MSP430] Enable some basic support for debug information

This commit technically permits LLVM to emit the debug information for ELF files for MSP430 architecture. Aside from this, it only defines the register numbers as defined by part 10.1 of MSP430 EABI specification (assuming the 1-byte subregisters share the register numbers with corresponding full-size registers).

This commit was basically tested by me with TI-provided GCC 8.3.1 toolchain by compiling an example program with clang (please note manual linking may be required due to upstream clang not yet handling the -msim option necessary to run binaries on the GDB-provided simulator) and then running it and single-stepping with msp430-elf-gdb like this:

$sysroot/bin/msp430-elf-gdb ./test -ex "target sim" -ex "load ./test"
(gdb) ... traditional GDB commands follow ...

While this implementation is most probably far from completeness and is considered experimental, it can already help with debugging MSP430 programs as well as finding issues in LLVM debug info support for MSP430 itself.

One of the use cases includes trying to find a point where UBSan check in a trap-on-error mode was triggered.

The expected debug information format is described in the MSP430 Embedded Application Binary Interface specification, part 10.

Differential Revision: https://reviews.llvm.org/D81488