@@ -245,7 +245,6 @@ def __init__(self, process, args):
245245 key/value pairs used by the scripted thread.
246246 """
247247 self .target = None
248- self .arch = None
249248 self .originating_process = None
250249 self .process = None
251250 self .args = None
@@ -267,9 +266,6 @@ def __init__(self, process, args):
267266 and process .IsValid ()
268267 ):
269268 self .target = process .target
270- triple = self .target .triple
271- if triple :
272- self .arch = triple .split ("-" )[0 ]
273269 self .originating_process = process
274270 self .process = self .target .GetProcess ()
275271 self .get_register_info ()
@@ -356,14 +352,17 @@ def get_stackframes(self):
356352 def get_register_info (self ):
357353 if self .register_info is None :
358354 self .register_info = dict ()
359- if "x86_64" in self .arch :
355+ if "x86_64" in self .originating_process . arch :
360356 self .register_info ["sets" ] = ["General Purpose Registers" ]
361357 self .register_info ["registers" ] = INTEL64_GPR
362- elif "arm64" in self .arch or self .arch == "aarch64" :
358+ elif (
359+ "arm64" in self .originating_process .arch
360+ or self .originating_process .arch == "aarch64"
361+ ):
363362 self .register_info ["sets" ] = ["General Purpose Registers" ]
364363 self .register_info ["registers" ] = ARM64_GPR
365364 else :
366- raise ValueError ("Unknown architecture" , self .arch )
365+ raise ValueError ("Unknown architecture" , self .originating_process . arch )
367366 return self .register_info
368367
369368 @abstractmethod
@@ -406,12 +405,11 @@ def __init__(self, thread, args):
406405 """Construct a scripted frame.
407406
408407 Args:
409- thread (ScriptedThread/lldb.SBThread ): The thread owning this frame.
408+ thread (ScriptedThread): The thread owning this frame.
410409 args (lldb.SBStructuredData): A Dictionary holding arbitrary
411410 key/value pairs used by the scripted frame.
412411 """
413412 self .target = None
414- self .arch = None
415413 self .originating_thread = None
416414 self .thread = None
417415 self .args = None
@@ -421,17 +419,15 @@ def __init__(self, thread, args):
421419 self .register_ctx = {}
422420 self .variables = []
423421
424- if isinstance (thread , ScriptedThread ) or (
425- isinstance (thread , lldb .SBThread ) and thread .IsValid ()
422+ if (
423+ isinstance (thread , ScriptedThread )
424+ or isinstance (thread , lldb .SBThread )
425+ and thread .IsValid ()
426426 ):
427+ self .target = thread .target
427428 self .process = thread .process
428- self .target = self .process .target
429- triple = self .target .triple
430- if triple :
431- self .arch = triple .split ("-" )[0 ]
432- tid = thread .tid if isinstance (thread , ScriptedThread ) else thread .id
433429 self .originating_thread = thread
434- self .thread = self .process .GetThreadByIndexID (tid )
430+ self .thread = self .process .GetThreadByIndexID (thread . tid )
435431 self .get_register_info ()
436432
437433 @abstractmethod
@@ -512,18 +508,7 @@ def get_variables(self, filters):
512508
513509 def get_register_info (self ):
514510 if self .register_info is None :
515- if isinstance (self .originating_thread , ScriptedThread ):
516- self .register_info = self .originating_thread .get_register_info ()
517- elif isinstance (self .originating_thread , lldb .SBThread ):
518- self .register_info = dict ()
519- if "x86_64" in self .arch :
520- self .register_info ["sets" ] = ["General Purpose Registers" ]
521- self .register_info ["registers" ] = INTEL64_GPR
522- elif "arm64" in self .arch or self .arch == "aarch64" :
523- self .register_info ["sets" ] = ["General Purpose Registers" ]
524- self .register_info ["registers" ] = ARM64_GPR
525- else :
526- raise ValueError ("Unknown architecture" , self .arch )
511+ self .register_info = self .originating_thread .get_register_info ()
527512 return self .register_info
528513
529514 @abstractmethod
@@ -657,12 +642,12 @@ def get_stop_reason(self):
657642
658643 # TODO: Passthrough stop reason from driving process
659644 if self .driving_thread .GetStopReason () != lldb .eStopReasonNone :
660- if "arm64" in self .arch :
645+ if "arm64" in self .originating_process . arch :
661646 stop_reason ["type" ] = lldb .eStopReasonException
662647 stop_reason ["data" ]["desc" ] = (
663648 self .driving_thread .GetStopDescription (100 )
664649 )
665- elif self .arch == "x86_64" :
650+ elif self .originating_process . arch == "x86_64" :
666651 stop_reason ["type" ] = lldb .eStopReasonSignal
667652 stop_reason ["data" ]["signal" ] = signal .SIGTRAP
668653 else :
0 commit comments