-
Notifications
You must be signed in to change notification settings - Fork 10
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ot] scripts/opentitan: add a GDB replay script from QEMU exec log #43
[ot] scripts/opentitan: add a GDB replay script from QEMU exec log #43
Conversation
docs/opentitan/gdbreplay.md
Outdated
|
||
### Arguments | ||
|
||
* `-a` specify an address where to load the matching RAW binary application, see `-b` optiion for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* `-a` specify an address where to load the matching RAW binary application, see `-b` optiion for | |
* `-a` specify an address where to load the matching RAW binary application, see `-b` option for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
scripts/opentitan/gdbreplay.py
Outdated
except ELFError as exc: | ||
raise ValueError(f'Invalid ELF file: {exc}') from exc | ||
if self._elf['e_machine'] != 'EM_RISCV': | ||
raise ValueError('Not an RISC-V ELF file') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise ValueError('Not an RISC-V ELF file') | |
raise ValueError('Not a RISC-V ELF file') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
scripts/opentitan/gdbreplay.py
Outdated
|
||
@property | ||
def raw_size(self) -> int: | ||
"""Provide the size of the Secure Boot Header section, if any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Provide the size of the Secure Boot Header section, if any. | |
"""Provide the size of the payload, if any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
raise ValueError('No loadable segment found') | ||
return phy_start, size | ||
|
||
def _build_payload(self) -> bytes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_parse_segments
and _build_payload
look very similar, maybe factorize common code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not want to build the full object in RAM when we only need to compute the final size.
scripts/opentitan/gdbreplay.py
Outdated
|
||
def cont(self, back: bool = False, addr: Optional[int] = None) -> bool: | ||
"""Continue execution of instruction stream till either a HW breakpoint | ||
or the end of the execution streamed is reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or the end of the execution streamed is reached. | |
or the end of the execution stream is reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
scripts/opentitan/gdbreplay.py
Outdated
xpc = int(spc, 16) | ||
if not lno % 10000: | ||
self._log.debug('Parsed %d lines', lno) | ||
#self._log.debug("0x%08x %s", xpc, func) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover debug trace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
scripts/opentitan/gdbreplay.py
Outdated
crc = int(buf[end+1:end+3], 16) | ||
buf = req[end+3:] | ||
# if start != 0: | ||
# continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
scripts/opentitan/gdbreplay.py
Outdated
resp = [f'PacketSize={self.MAX_PACKET_LENGTH-16:x}', | ||
'ReverseStep+', 'ReverseContinue+'] | ||
for cap in req.split(';'): | ||
# supp = cap in ('hwbreak+', 'vContSupported+', 'no-resumed+') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
e1a3b55
to
0673593
Compare
0673593
to
82efe7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.