Skip to content
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

Merged

Conversation

rivos-eblot
Copy link

No description provided.


### Arguments

* `-a` specify an address where to load the matching RAW binary application, see `-b` optiion for

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `-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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

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')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ValueError('Not an RISC-V ELF file')
raise ValueError('Not a RISC-V ELF file')

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


@property
def raw_size(self) -> int:
"""Provide the size of the Secure Boot Header section, if any.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Provide the size of the Secure Boot Header section, if any.
"""Provide the size of the payload, if any.

Copy link
Author

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:

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?

Copy link
Author

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.


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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or the end of the execution streamed is reached.
or the end of the execution stream is reached.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

xpc = int(spc, 16)
if not lno % 10000:
self._log.debug('Parsed %d lines', lno)
#self._log.debug("0x%08x %s", xpc, func)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover debug trace?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

crc = int(buf[end+1:end+3], 16)
buf = req[end+3:]
# if start != 0:
# continue

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

resp = [f'PacketSize={self.MAX_PACKET_LENGTH-16:x}',
'ReverseStep+', 'ReverseContinue+']
for cap in req.split(';'):
# supp = cap in ('hwbreak+', 'vContSupported+', 'no-resumed+')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover tests?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@rivos-eblot rivos-eblot changed the title RIVOS: scripts/opentitan: add a GDB replay script from QEMU exec log [ot] scripts/opentitan: add a GDB replay script from QEMU exec log Nov 27, 2023
@loiclefort loiclefort self-requested a review November 27, 2023 11:07
Copy link

@loiclefort loiclefort left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@loiclefort loiclefort merged commit 8090a1f into lowRISC:ot-darjeeling-8.0.2 Nov 27, 2023
@loiclefort loiclefort deleted the dev/ebl/gdb_replay branch November 27, 2023 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants