blob: 6fdb4de2e6a1ba17c5599325437c2f27b95a8ac5 [file]
# Copyright 2026 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from typing import Any
from cli.commands.base import BaseCommand
class Command(BaseCommand):
COMMAND_NAME = "variables"
@staticmethod
def register_cli(subparsers: Any) -> None:
variables_parser = subparsers.add_parser(
Command.COMMAND_NAME,
aliases=["locals"],
help="Get variables of a stack frame.",
description=(
"Get variables (locals and arguments) of a stack frame.\n\n"
"If the target thread is running, it will be automatically paused to "
"retrieve the stack trace. Note that the stack frames (and their indices) "
"may have changed if the thread had to be paused."
),
)
variables_parser.add_argument(
"thread_id", type=int, help="Thread ID to query"
)
variables_parser.add_argument(
"--frame-index",
type=int,
default=0,
help="Frame index within the stacktrace (defaults to 0)",
)