Skip to content

Commit

Permalink
Migrate stacks.py to Python 3.
Browse files Browse the repository at this point in the history
  * python/stacks.py (Stacks): int_t changed to unsigned_int_t, after
      looking up type "unsigned int").
    (Stacks.invoke): print requires parens.
  • Loading branch information
simonjwright committed Jul 3, 2022
1 parent b6ac2f3 commit 2b37668
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/stacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2018 Free Software Foundation, Inc.
# Copyright (C) 2018-2022 Free Software Foundation, Inc.

# This file is part of the Cortex GNAT RTS package.

Expand Down Expand Up @@ -51,7 +51,7 @@ class Stacks(gdb.Command):
"""stacks: report Ada task free stacks."""

tcb_t = gdb.lookup_type("TCB_t")
int_t = gdb.lookup_type("int")
unsigned_int_t = gdb.lookup_type("unsigned int")

def __init__(self):
super(Stacks, self).__init__("stacks", gdb.COMMAND_USER)
Expand All @@ -69,14 +69,14 @@ def invoke(self, arg, from_tty):
thread = atcb["common"]["thread"]

tcb = thread.cast(Stacks.tcb_t.pointer()).dereference()
stk = tcb["pxStack"].cast(Stacks.int_t.pointer())
stk = tcb["pxStack"].cast(Stacks.unsigned_int_t.pointer())

free = 0
while stk[free] == 0xa5a5a5a5:
free = free + 1

print "min free: ", free * 4, \
", tag: ", tcb["pxTaskTag"]
print("min free: ", free * 4, \
", tag: ", tcb["pxTaskTag"])

# Fetch the next ATCB in the chain, if any, from
# <ATCB>.Common.All_Tasks_Link.
Expand Down

0 comments on commit 2b37668

Please sign in to comment.