objutils 0.10.4__tar.gz → 0.10.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {objutils-0.10.4 → objutils-0.10.5}/PKG-INFO +1 -1
- {objutils-0.10.4 → objutils-0.10.5}/objutils/__init__.py +1 -1
- objutils-0.10.5/objutils/scripts/oj_dwarf_info.py +143 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/version.py +1 -1
- {objutils-0.10.4 → objutils-0.10.5}/pyproject.toml +2 -2
- {objutils-0.10.4 → objutils-0.10.5}/CMakeLists.txt +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/LICENSE +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/build_ext.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/docs/README.rst +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/.coveragerc +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/.vscode/launch.json +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/.vscode/settings.json +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/a2l_test.shf +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/ash.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/binfile.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/checksums.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/cosmac.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/.traverser.py.un~ +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/attrparser.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/c_generator.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/constants.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/encoding.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/lineprog.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/readers.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/sm.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/dwarf/traverser.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/elf/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/elf/arm/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/elf/arm/attributes.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/elf/defs.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/elf/model.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/emon52.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/etek.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/exceptions.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/ctre.hpp +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/difflib.h +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/exceptions.cpp +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/exceptions.hpp +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/hexfile.cpp +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/extensions/wrapper.cpp +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/fpc.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/hexdump.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/hexfile.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/ieee695.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/ihex.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/image.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/logger.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/mostec.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/objutils.code-workspace +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/pecoff/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/pecoff/defs.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/pecoff/model.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/pecoff/pdb/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/pickleif.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/rca.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/readers.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/registry.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/arduino_build_artifacts.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_cgen.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_coff_extract.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_coff_import.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_coff_info.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_coff_syms.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_dwarf_import.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_elf_arm_attrs.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_elf_extract.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_elf_import.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_elf_info.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_elf_syms.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/scripts/oj_hex_info.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/section.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/shf.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/sig.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/srec.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tek.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_arm_attributes.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_ash.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_c_generator.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_checksums.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_cygpath.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_diff_bin.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_elf.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_emon52.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_etek.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_examples_cgen.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_fpc.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_hexdump.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_hexfile.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_ihex.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_image.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_mostec.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_readers.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_registry.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_repr.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_section.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_section_join.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_shf.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_sm.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_srec.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_tek.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/tests/test_titext.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/titxt.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/utils/__init__.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/utils/arduino.py +0 -0
- {objutils-0.10.4 → objutils-0.10.5}/objutils/utils/diff.py +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""DWARF database inspector (read-only).
|
|
3
|
+
|
|
4
|
+
Lists compilation units or traverses DIE attributes from an existing ``.prgdb``
|
|
5
|
+
database. This script intentionally does **not** perform DWARF import; use
|
|
6
|
+
``oj-dwarf-import`` to build the database first.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
from collections.abc import Iterable
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
from sqlalchemy.exc import SQLAlchemyError
|
|
17
|
+
|
|
18
|
+
from objutils.dwarf.constants import Tag
|
|
19
|
+
from objutils.dwarf.traverser import AttributeParser
|
|
20
|
+
from objutils.elf import model
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _parse_offset(text: str) -> int:
|
|
24
|
+
try:
|
|
25
|
+
return int(text, 0)
|
|
26
|
+
except ValueError as exc:
|
|
27
|
+
raise argparse.ArgumentTypeError(f"Invalid offset '{text}'") from exc
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _attr_value(die: Any, name: str) -> Any:
|
|
31
|
+
attrs = getattr(die, "attributes_map", {}) or {}
|
|
32
|
+
attr = attrs.get(name)
|
|
33
|
+
return None if attr is None else getattr(attr, "raw_value", None)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _print_cus(cus: Iterable[Any], *, quiet: bool) -> None:
|
|
37
|
+
if quiet:
|
|
38
|
+
return
|
|
39
|
+
print("Compilation Units:")
|
|
40
|
+
print("-------------------")
|
|
41
|
+
for idx, cu in enumerate(cus, 1):
|
|
42
|
+
name = _attr_value(cu, "name") or ""
|
|
43
|
+
low_pc = _attr_value(cu, "low_pc")
|
|
44
|
+
high_pc = _attr_value(cu, "high_pc")
|
|
45
|
+
low_pc_str = f"0x{int(low_pc):08x}" if low_pc is not None else "-"
|
|
46
|
+
high_pc_str = f"0x{int(high_pc):08x}" if high_pc is not None else "-"
|
|
47
|
+
print(f"[{idx:03d}] off=0x{int(cu.offset):08x} name={name} range={low_pc_str}..{high_pc_str}")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _print_summary(session, *, quiet: bool) -> None:
|
|
51
|
+
if quiet:
|
|
52
|
+
return
|
|
53
|
+
die_count = session.query(model.DebugInformationEntry).count()
|
|
54
|
+
attr_count = session.query(model.DIEAttribute).count()
|
|
55
|
+
print(f"DIEs: {die_count:,}")
|
|
56
|
+
print(f"Attributes: {attr_count:,}")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def main(argv: list[str] | None = None) -> int:
|
|
60
|
+
parser = argparse.ArgumentParser(description="Inspect DWARF debug info stored in a .prgdb database (no import).")
|
|
61
|
+
parser.add_argument("db", help="Path to .prgdb database generated by oj-dwarf-import")
|
|
62
|
+
parser.add_argument("--quiet", "-q", action="store_true", help="Suppress non-error output")
|
|
63
|
+
parser.add_argument("--list-cus", action="store_true", help="List compile units")
|
|
64
|
+
parser.add_argument("--summary", action="store_true", help="Print DIE/attribute counts")
|
|
65
|
+
parser.add_argument(
|
|
66
|
+
"--walk-attrs",
|
|
67
|
+
action="store_true",
|
|
68
|
+
help="Traverse DIE attributes with AttributeParser (starts at first DIE unless --offset is set).",
|
|
69
|
+
)
|
|
70
|
+
parser.add_argument(
|
|
71
|
+
"--offset",
|
|
72
|
+
type=_parse_offset,
|
|
73
|
+
help="Absolute DIE offset (decimal or 0x-prefixed hex) used for --walk-attrs start point.",
|
|
74
|
+
)
|
|
75
|
+
args = parser.parse_args(argv)
|
|
76
|
+
|
|
77
|
+
db_path = Path(args.db)
|
|
78
|
+
if db_path.suffix.lower() != model.DB_EXTENSION:
|
|
79
|
+
parser.error(f"Expected a '{model.DB_EXTENSION}' database; got '{db_path}'")
|
|
80
|
+
if not db_path.exists():
|
|
81
|
+
parser.error(f"Database not found: {db_path}")
|
|
82
|
+
|
|
83
|
+
post_actions = args.list_cus or args.summary or args.walk_attrs
|
|
84
|
+
if not post_actions:
|
|
85
|
+
args.list_cus = True
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
db = model.Model(str(db_path))
|
|
89
|
+
except (OSError, SQLAlchemyError, ValueError) as exc:
|
|
90
|
+
if not args.quiet:
|
|
91
|
+
print(f"Failed to open database '{db_path}': {exc}")
|
|
92
|
+
return 4
|
|
93
|
+
|
|
94
|
+
try:
|
|
95
|
+
session = db.session
|
|
96
|
+
if args.summary:
|
|
97
|
+
_print_summary(session, quiet=args.quiet)
|
|
98
|
+
|
|
99
|
+
if args.list_cus or args.walk_attrs:
|
|
100
|
+
DIE = model.DebugInformationEntry
|
|
101
|
+
raw_cus = session.query(DIE).filter(DIE.tag == Tag.compile_unit).order_by(DIE.offset, DIE.cu_start).all()
|
|
102
|
+
seen = set()
|
|
103
|
+
cus = []
|
|
104
|
+
for cu in raw_cus:
|
|
105
|
+
key = (cu.offset, cu.cu_start)
|
|
106
|
+
if key in seen:
|
|
107
|
+
continue
|
|
108
|
+
seen.add(key)
|
|
109
|
+
cus.append(cu)
|
|
110
|
+
if args.list_cus:
|
|
111
|
+
_print_cus(cus, quiet=args.quiet)
|
|
112
|
+
|
|
113
|
+
if args.walk_attrs:
|
|
114
|
+
ap = AttributeParser(session)
|
|
115
|
+
if args.offset is not None:
|
|
116
|
+
start_die = session.query(DIE).filter(DIE.offset == int(args.offset)).first()
|
|
117
|
+
if start_die is None:
|
|
118
|
+
if not args.quiet:
|
|
119
|
+
print(f"No DIE found at offset 0x{int(args.offset):08x}.")
|
|
120
|
+
return 5
|
|
121
|
+
ap.traverse_tree(start_die)
|
|
122
|
+
else:
|
|
123
|
+
if not cus:
|
|
124
|
+
if not args.quiet:
|
|
125
|
+
print("No DebugInformationEntry available in the database to traverse.")
|
|
126
|
+
return 5
|
|
127
|
+
for cu in cus:
|
|
128
|
+
ap.traverse_tree(cu)
|
|
129
|
+
except (OSError, SQLAlchemyError, RuntimeError, ValueError) as exc:
|
|
130
|
+
if not args.quiet:
|
|
131
|
+
print(f"Traversal failed: {exc}")
|
|
132
|
+
return 5
|
|
133
|
+
finally:
|
|
134
|
+
try:
|
|
135
|
+
db.close()
|
|
136
|
+
except SQLAlchemyError:
|
|
137
|
+
pass
|
|
138
|
+
|
|
139
|
+
return 0
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if __name__ == "__main__":
|
|
143
|
+
raise SystemExit(main())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "objutils"
|
|
3
|
-
version = "0.10.
|
|
3
|
+
version = "0.10.5"
|
|
4
4
|
description = "Objectfile library for Python"
|
|
5
5
|
authors = ["Christoph Schueler <cpu12.gems@googlemail.com>"]
|
|
6
6
|
license = "GPLv2"
|
|
@@ -121,7 +121,7 @@ skip = ["*_i686", "*-musllinux*"]
|
|
|
121
121
|
build-frontend = "build"
|
|
122
122
|
|
|
123
123
|
[tool.bumpver]
|
|
124
|
-
current_version = "0.10.
|
|
124
|
+
current_version = "0.10.5"
|
|
125
125
|
version_pattern = "MAJOR.MINOR.PATCH"
|
|
126
126
|
commit_message = "bump version {old_version} -> {new_version}"
|
|
127
127
|
commit = true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|