Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Stack decoder script#8661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
d-a-v merged 9 commits intoesp8266:masterfrommcspr:tools/decoder
Dec 16, 2022
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
non-hyphenated arg for elf, toolchain path to bin/
either for when tools are already in PATHor, using `pio pkg exec --package toolchain-xtensa python decoder.py ...`(where package is a full version spec for pio registry)
  • Loading branch information
@mcspr
mcspr committedAug 23, 2022
commit79eea27638607115bbc0499fd2013f2b41e9d136
23 changes: 16 additions & 7 deletionstools/decoder.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -98,7 +98,9 @@ def addresses_addr2line(addr2line, elf, addresses):
def decode_lines(format_addresses, elf, lines):
STACK_RE = re.compile(r"^[0-9a-f]{8}:\s+([0-9a-f]{8} ?)+ *$")

LAST_ALLOC_RE = re.compile(r"last failed alloc call: ([0-9a-fA-F]{8})\(([0-9]+)\).*")
LAST_ALLOC_RE = re.compile(
r"last failed alloc call: ([0-9a-fA-F]{8})\(([0-9]+)\).*"
)
LAST_ALLOC = "last failed alloc"

CUT_HERE_STRING = "CUT HERE FOR EXCEPTION DECODER"
Expand DownExpand Up@@ -176,28 +178,35 @@ def format_address(address):
TOOLS = {"gdb": addresses_gdb, "addr2line": addresses_addr2line}


def select_tool(toolchain_path, tool):
path = os.path.join(toolchain_path, "bin", f"xtensa-lx106-elf-{tool}")
def select_tool(toolchain_path, tool, func):
path = f"xtensa-lx106-elf-{tool}"
if toolchain_path:
path = os.path.join(toolchain_path, path)

def formatter(func, path):
def wrapper(elf, addresses):
return func(path, elf, addresses)

return wrapper

return formatter(TOOLS[tool], path)
return formatter(func, path)


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--elf-path", required=True)
parser.add_argument("--toolchain-path", required=True)
parser.add_argument("--tool", choices=TOOLS, default="addr2line")
parser.add_argument(
"--toolchain-path", help="Sets path to Xtensa tools, when they are not in PATH"
)

parser.add_argument("firmware_elf")
parser.add_argument(
"postmortem", nargs="?", type=argparse.FileType("r"), default=sys.stdin
)

args = parser.parse_args()
decode_lines(
select_tool(args.toolchain_path, args.tool), args.elf_path, args.postmortem
select_tool(args.toolchain_path, args.tool, TOOLS[args.tool]),
args.firmware_elf,
args.postmortem,
)

[8]ページ先頭

©2009-2025 Movatter.jp