@@ -173,7 +173,7 @@ class Terminal(object):
173
173
stackTraceFile = None
174
174
175
175
def __init__ (self , port_instance : StreamDevice , transformations = (),
176
- output_raw : bool = False , request_banner : bool = True ,
176
+ output_raw : bool = False , request_banner : bool = True ,
177
177
auto_stack_trace : bool = True , stack_trace_file : str = None ):
178
178
self .device = port_instance
179
179
self .device .subscribe (b'sout' )
@@ -234,37 +234,36 @@ def reader(self):
234
234
addr = "0x" + decode_bytes_to_str (data [1 ])[:7 ]
235
235
236
236
convert_trace = (self .beginStackTrace and
237
- addr .isalnum () and
238
- addr [3 ] != 'x' and
239
- self .convert_stack_traces and
237
+ addr .isalnum () and
238
+ addr [3 ] != 'x' and
239
+ self .convert_stack_traces and
240
240
((os .name != 'nt' ) or os .environ .get ('PROS_TOOLCHAIN' )))
241
-
241
+
242
242
if convert_trace :
243
243
if os .name == 'nt' and os .environ .get ('PROS_TOOLCHAIN' ):
244
- addr2line_path = os .path .join (os .environ .get ('PROS_TOOLCHAIN' ), 'bin' , 'arm-none-eabi-addr2line.exe ' )
244
+ addr2line_path = os .path .join (os .environ .get ('PROS_TOOLCHAIN' ), 'bin' , 'arm-none-eabi-addr2line' )
245
245
else :
246
- addr2line_path = 'addr2line'
246
+ addr2line_path = 'arm-none-eabi- addr2line'
247
247
248
248
def getTrace (s , path ):
249
249
if not os .path .exists (path ):
250
250
return ''
251
- temp = subprocess .Popen ([addr2line_path , '-faps' , '-e' , path , s ],
252
- stdout = subprocess .PIPE ,shell = True ).communicate ()[0 ].decode ('utf-8' )
251
+ temp = subprocess .run ([addr2line_path , '-faps' , '-e' , path , s ], capture_output = True ).stdout .decode ('utf-8' )
253
252
if (temp .find ('?' ) != - 1 ):
254
253
return ''
255
254
else :
256
255
return temp [12 : len (temp ) - 2 ]
257
256
258
257
trace = ' : {}{}{}' .format (
259
- getTrace (addr , "bin/hot.package.elf" ),
260
- getTrace (addr , "bin/cold.package.elf" ),
261
- getTrace (addr , "bin/monolith.elf" ))
258
+ getTrace (addr , "./ bin/hot.package.elf" ),
259
+ getTrace (addr , "./ bin/cold.package.elf" ),
260
+ getTrace (addr , "./ bin/monolith.elf" ))
262
261
text = '{}{}{}{}{}{}' .format (colorama .Fore .RED , decode_bytes_to_str (data [1 ]), colorama .Style .RESET_ALL , colorama .Fore .WHITE , trace , colorama .Style .RESET_ALL )
263
- if (self .stack_trace_file ):
262
+ if (self .stack_trace_file ):
264
263
file .write (addr + trace + '\n ' )
265
264
else :
266
265
text = '{}{}{}' .format (colorama .Fore .RED , decode_bytes_to_str (data [1 ]), colorama .Style .RESET_ALL )
267
-
266
+
268
267
if "BEGIN STACK TRACE" in text :
269
268
self .beginStackTrace = True
270
269
if (self .convert_stack_traces ):
@@ -279,7 +278,7 @@ def getTrace(s, path):
279
278
if (self .stack_trace_file ):
280
279
file .close ()
281
280
file = None
282
-
281
+
283
282
elif data [0 ] == b'kdbg' :
284
283
text = '{}\n \n KERNEL DEBUG:\t {}{}\n ' .format (colorama .Back .GREEN + colorama .Style .BRIGHT ,
285
284
decode_bytes_to_str (data [1 ]),
0 commit comments