From 2ec4daeeff60b3a727f48b2c99abb002a2dd7a14 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 17 Apr 2025 12:15:36 -0600 Subject: gdb-helpers: libcr.py: Begone with the CrCoroutine.id alias --- gdb-helpers/libcr.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'gdb-helpers') diff --git a/gdb-helpers/libcr.py b/gdb-helpers/libcr.py index fcfd86e..658ddf6 100644 --- a/gdb-helpers/libcr.py +++ b/gdb-helpers/libcr.py @@ -131,7 +131,7 @@ class CrGlobals: if gdb_bug_32428: print("Must return to running coroutine before continuing.") print("Hit ^C twice then run:") - print(f" cr select {self.coroutine_running.id}") + print(f" cr select {self.coroutine_running.cid}") while True: time.sleep(1) assert self.coroutine_running.cont_env @@ -255,10 +255,6 @@ class CrCoroutine: self.cid = cid self.cont_env = None - @property - def id(self) -> int: - return self.cid - @property def state(self) -> gdb.Value: return gdb.parse_and_eval(f"coroutine_table[{self.cid-1}].state") @@ -272,8 +268,8 @@ class CrCoroutine: def is_selected(self) -> bool: sp = int(gdb.parse_and_eval("$sp")) - lo = int(gdb.parse_and_eval(f"coroutine_table[{self.id-1}].stack")) - hi = lo + int(gdb.parse_and_eval(f"coroutine_table[{self.id-1}].stack_size")) + lo = int(gdb.parse_and_eval(f"coroutine_table[{self.cid-1}].stack")) + hi = lo + int(gdb.parse_and_eval(f"coroutine_table[{self.cid-1}].stack_size")) return lo <= sp < hi def select(self, level: int = -1) -> None: @@ -289,7 +285,7 @@ class CrCoroutine: elif self.state == self.cr_globals.CR_RUNNING: env = self.cr_globals.readjmp("&coroutine_add_env") else: - env = self.cr_globals.readjmp(f"&coroutine_table[{self.id-1}].env") + env = self.cr_globals.readjmp(f"&coroutine_table[{self.cid-1}].env") gdb_longjmp(env) cr_select_top_frame() @@ -353,7 +349,7 @@ class CrListCommand(gdb.Command): "G" if cr.is_selected() else " ", ] ), - str(cr.id), + str(cr.cid), repr(cr.name), str(cr.state), self._pretty_frame(cr, from_tty), -- cgit v1.2.3-2-g168b