mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
Add ability to disable address decoding using evironment variable
Closes https://github.com/espressif/esp-idf/issues/1679
This commit is contained in:
@@ -95,6 +95,11 @@ To decode each address, IDF Monitor runs the following command in the background
|
|||||||
|
|
||||||
xtensa-{IDF_TARGET_TOOLCHAIN_NAME}-elf-addr2line -pfiaC -e build/PROJECT.elf ADDRESS
|
xtensa-{IDF_TARGET_TOOLCHAIN_NAME}-elf-addr2line -pfiaC -e build/PROJECT.elf ADDRESS
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Set environment variable ``ESP_MONITOR_DECODE`` to ``0``
|
||||||
|
or call idf_monitor.py with specific command line option: ``idf_monitor.py --disable-address-decoding``
|
||||||
|
to disable address decoding.
|
||||||
|
|
||||||
Launching GDB with GDBStub
|
Launching GDB with GDBStub
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@@ -401,7 +401,7 @@ class SerialReader(StoppableThread):
|
|||||||
except (serial.serialutil.SerialException, IOError) as e:
|
except (serial.serialutil.SerialException, IOError) as e:
|
||||||
data = b''
|
data = b''
|
||||||
# self.serial.open() was successful before, therefore, this is an issue related to
|
# self.serial.open() was successful before, therefore, this is an issue related to
|
||||||
# the disapperence of the device
|
# the disappearance of the device
|
||||||
red_print(e)
|
red_print(e)
|
||||||
yellow_print('Waiting for the device to reconnect', newline='')
|
yellow_print('Waiting for the device to reconnect', newline='')
|
||||||
self.serial.close()
|
self.serial.close()
|
||||||
@@ -502,11 +502,13 @@ class Monitor(object):
|
|||||||
decode_coredumps=COREDUMP_DECODE_INFO,
|
decode_coredumps=COREDUMP_DECODE_INFO,
|
||||||
decode_panic=PANIC_DECODE_DISABLE,
|
decode_panic=PANIC_DECODE_DISABLE,
|
||||||
target=None,
|
target=None,
|
||||||
websocket_client=None):
|
websocket_client=None,
|
||||||
|
enable_address_decoding=True):
|
||||||
super(Monitor, self).__init__()
|
super(Monitor, self).__init__()
|
||||||
self.event_queue = queue.Queue()
|
self.event_queue = queue.Queue()
|
||||||
self.cmd_queue = queue.Queue()
|
self.cmd_queue = queue.Queue()
|
||||||
self.console = miniterm.Console()
|
self.console = miniterm.Console()
|
||||||
|
self.enable_address_decoding = enable_address_decoding
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
sys.stderr = ANSIColorConverter(sys.stderr, decode_output=True)
|
sys.stderr = ANSIColorConverter(sys.stderr, decode_output=True)
|
||||||
self.console.output = ANSIColorConverter(self.console.output)
|
self.console.output = ANSIColorConverter(self.console.output)
|
||||||
@@ -586,7 +588,7 @@ class Monitor(object):
|
|||||||
self._invoke_processing_last_line_timer.cancel()
|
self._invoke_processing_last_line_timer.cancel()
|
||||||
self._invoke_processing_last_line_timer = threading.Timer(0.1, self.invoke_processing_last_line)
|
self._invoke_processing_last_line_timer = threading.Timer(0.1, self.invoke_processing_last_line)
|
||||||
self._invoke_processing_last_line_timer.start()
|
self._invoke_processing_last_line_timer.start()
|
||||||
# If no futher data is received in the next short period
|
# If no further data is received in the next short period
|
||||||
# of time then the _invoke_processing_last_line_timer
|
# of time then the _invoke_processing_last_line_timer
|
||||||
# generates an event which will result in the finishing of
|
# generates an event which will result in the finishing of
|
||||||
# the last line. This is fix for handling lines sent
|
# the last line. This is fix for handling lines sent
|
||||||
@@ -656,8 +658,9 @@ class Monitor(object):
|
|||||||
def handle_possible_pc_address_in_line(self, line):
|
def handle_possible_pc_address_in_line(self, line):
|
||||||
line = self._pc_address_buffer + line
|
line = self._pc_address_buffer + line
|
||||||
self._pc_address_buffer = b""
|
self._pc_address_buffer = b""
|
||||||
for m in re.finditer(MATCH_PCADDR, line.decode(errors="ignore")):
|
if self.enable_address_decoding:
|
||||||
self.lookup_pc_address(m.group())
|
for m in re.finditer(MATCH_PCADDR, line.decode(errors="ignore")):
|
||||||
|
self.lookup_pc_address(m.group())
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
""" Use 'with self' to temporarily disable monitoring behaviour """
|
""" Use 'with self' to temporarily disable monitoring behaviour """
|
||||||
@@ -999,6 +1002,13 @@ def main():
|
|||||||
default=os.environ.get('ESPTOOL_PORT', '/dev/ttyUSB0')
|
default=os.environ.get('ESPTOOL_PORT', '/dev/ttyUSB0')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
'--disable-address-decoding', '-d',
|
||||||
|
help="Don't print lines about decoded addresses from the application ELF file.",
|
||||||
|
action="store_true",
|
||||||
|
default=True if os.environ.get("ESP_MONITOR_DECODE") == 0 else False
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--baud', '-b',
|
'--baud', '-b',
|
||||||
help='Serial port baud rate',
|
help='Serial port baud rate',
|
||||||
@@ -1105,7 +1115,7 @@ def main():
|
|||||||
monitor = Monitor(serial_instance, args.elf_file.name, args.print_filter, args.make, args.encrypted,
|
monitor = Monitor(serial_instance, args.elf_file.name, args.print_filter, args.make, args.encrypted,
|
||||||
args.toolchain_prefix, args.eol,
|
args.toolchain_prefix, args.eol,
|
||||||
args.decode_coredumps, args.decode_panic, args.target,
|
args.decode_coredumps, args.decode_panic, args.target,
|
||||||
ws)
|
ws, enable_address_decoding=not args.disable_address_decoding)
|
||||||
|
|
||||||
yellow_print('--- idf_monitor on {p.name} {p.baudrate} ---'.format(
|
yellow_print('--- idf_monitor on {p.name} {p.baudrate} ---'.format(
|
||||||
p=serial_instance))
|
p=serial_instance))
|
||||||
|
Reference in New Issue
Block a user