Merge branch 'feature/coredump_pygdbmi' into 'master'

espcoredump: use pygdbmi for interaction with GDB

Closes IDF-48

See merge request espressif/esp-idf!8841
This commit is contained in:
Ivan Grokhotkov 2020-06-23 01:44:45 +08:00
commit c140a66d3d
6 changed files with 354 additions and 634 deletions

File diff suppressed because it is too large Load diff

View file

@ -28,24 +28,14 @@ except ImportError:
class TestESPCoreDumpFileLoader(unittest.TestCase):
def setUp(self):
self.tmp_file = 'tmp'
self.dloader = espcoredump.ESPCoreDumpFileLoader(path='coredump.b64', b64=True)
self.assertIsInstance(self.dloader, espcoredump.ESPCoreDumpFileLoader)
def tearDown(self):
self.dloader.cleanup()
def testESPCoreDumpFileLoaderWithoutB64(self):
t = espcoredump.ESPCoreDumpFileLoader(path='coredump.b64', b64=False)
self.assertIsInstance(t, espcoredump.ESPCoreDumpFileLoader) # invoke for coverage of open()
t.cleanup()
def test_cannot_remove_dir(self):
self.dloader.remove_tmp_file(fname='.') # silent failure (but covers exception inside)
loader = espcoredump.ESPCoreDumpFileLoader(path='coredump.b64', b64=False)
loader.cleanup()
def test_create_corefile(self):
self.assertEqual(self.dloader.create_corefile(core_fname=self.tmp_file, off=0, rom_elf=None), self.tmp_file)
loader = espcoredump.ESPCoreDumpFileLoader(path='coredump.b64', b64=True)
loader.create_corefile()
loader.cleanup()
if __name__ == '__main__':

View file

@ -2,8 +2,10 @@
{ coverage debug sys \
&& coverage erase \
&& coverage run -a --source=espcoredump ../espcoredump.py info_corefile -m -t b64 -c coredump.b64 test.elf &> output \
&& coverage run -a --source=espcoredump ../espcoredump.py info_corefile -m -t b64 -c coredump.b64 -s core.elf test.elf &> output \
&& diff expected_output output \
&& coverage run -a --source=espcoredump ../espcoredump.py info_corefile -m -t elf -c core.elf test.elf &> output2 \
&& diff expected_output output2 \
&& coverage run -a --source=espcoredump ./test_espcoredump.py \
&& coverage report \
; } || { echo 'The test for espcoredump has failed!'; exit 1; }

View file

@ -777,7 +777,7 @@ class Monitor(object):
self._print(output)
self._output_enabled = False # Will be reenabled in check_coredump_trigger_after_print
except subprocess.CalledProcessError as e:
yellow_print("Failed to run espcoredump script: {}\n\n".format(e))
yellow_print("Failed to run espcoredump script: {}\n{}\n\n".format(e, e.output))
self._output_enabled = True
self._print(COREDUMP_UART_START + b'\n')
self._print(self._coredump_buffer)

View file

@ -27,12 +27,12 @@ except ImportError:
import idf_monitor
ELF_FILE = './dummy.elf' # ELF file used for starting the monitor
ELF_FILE = 'dummy.elf' # ELF file used for starting the monitor
def monitor_serial_reader_state(serial_reader, file_to_create):
"""
The pupose of this wrapper is to monitor the serial reader state of idf_monitor.py. file_to_create is created
The purpose of this wrapper is to monitor the serial reader state of idf_monitor.py. file_to_create is created
after the serial reader thread has been started. The existence of this file will indicate to
run_test_idf_monitor.py that idf_monitor.py is ready to process inputs.
"""
@ -50,7 +50,7 @@ def main():
args = parser.parse_args()
serial_instance = serial.serial_for_url(args.port, 115200, do_not_open=True)
monitor = idf_monitor.Monitor(serial_instance, ELF_FILE, args.print_filter, 'make', 'xtensa-esp32-elf-', 'CR')
monitor = idf_monitor.Monitor(serial_instance, ELF_FILE, args.print_filter, 'make', toolchain_prefix='xtensa-esp32-elf-', eol='CR')
sys.stderr.write('Monitor instance has been created.\n')
monitor_thread = threading.Thread(target=monitor_serial_reader_state,
args=(monitor.serial_reader, args.serial_alive_file))

View file

@ -36,7 +36,6 @@ I (401) esp_core_dump_uart: Press Enter to print core dump to UART...
Core Dump detected!
I (434) esp_core_dump_uart: Print core dump to uart...
I (434) esp_core_dump_elf: Found tasks: 8
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
espcoredump.py v0.4-dev
===============================================================
==================== ESP32 CORE DUMP START ====================
@ -112,48 +111,40 @@ a15 0x0 0
6 process 1073412788 0x400812c4 in ?? ()
7 process 1073432444 0x40087e10 in ?? ()
8 process 1073413520 0x400812c4 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 1 (TCB: 0x3ffb5e80, name: '') =====================
#0 0x400e37f7 in ?? ()
#1 0x400d0c31 in ?? ()
#2 0x40087018 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 2 (TCB: 0x3ffb6d48, name: '') =====================
#0 0x40087010 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 3 (TCB: 0x3ffb65e4, name: '') =====================
#0 0x40087010 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 4 (TCB: 0x3ffb77a0, name: '') =====================
#0 0x400812c4 in ?? ()
#1 0x40089806 in ?? ()
#2 0x400898f3 in ?? ()
#3 0x40087018 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 5 (TCB: 0x3ffb4bf0, name: '') =====================
#0 0x400812c4 in ?? ()
#1 0x4008913b in ?? ()
#2 0x400d0d5c in ?? ()
#3 0x40087018 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 6 (TCB: 0x3ffafab4, name: '') =====================
#0 0x400812c4 in ?? ()
#1 0x40087e10 in ?? ()
#2 0x400d1f4b in ?? ()
#3 0x40087018 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 7 (TCB: 0x3ffb477c, name: '') =====================
#0 0x40087e10 in ?? ()
#1 0x40081a2b in ?? ()
#2 0x40087018 in ?? ()
ERROR: GDB/MI command failed (error / msg="No symbol table is loaded. Use the \"file\" command.")!
==================== THREAD 8 (TCB: 0x3ffafd90, name: '') =====================
#0 0x400812c4 in ?? ()