Attribute host-exception pc to module and print guest stack #1182

Closed
github-bot wants to merge 1 commit from gh-pr/1182/head into gh-pr/1182/base
Owner

@⁠baz947 on GitHub · 2026-10-08 02:30 UTC · original
baz947:fix/1070-fault-module-attribution → main · +10 −0 · 1 files · 1 commits · closed without merging

Refs #1070 (Astro Bot Linux host exception).

The host-exception report had registers/code/stack but no module attribution
and no guest unwind, although StackTrace() and FindProgramByAddr() already
exist for exactly this. The handler now prints module+offset for the fault
pc and the guest stack trace before EXIT, reusing those helpers.

Diagnostic-only: report path only, same termination behavior.

**@⁠baz947** on GitHub · 2026-10-08 02:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1182) `baz947:fix/1070-fault-module-attribution` → `main` · +10 −0 · 1 files · 1 commits · closed without merging Refs #1070 (Astro Bot Linux host exception). The host-exception report had registers/code/stack but no module attribution and no guest unwind, although StackTrace() and FindProgramByAddr() already exist for exactly this. The handler now prints module+offset for the fault pc and the guest stack trace before EXIT, reusing those helpers. Diagnostic-only: report path only, same termination behavior.
Refs KytyPS5/KytyPS5#1070. Diagnostic-only: message text only, no behavior change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:46:49 +00:00
github-bot closed this pull request 2026-11-26 09:46:49 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 02:33 UTC · original

Review in Change Stack →

📝 Walkthrough

Walkthrough

The host exception handler now reports the faulting module’s filename and base-relative offset when the address belongs to a loaded program. Otherwise, it reports module: ???. When a RuntimeLinker instance is available, the handler also logs a stack trace using the exception’s frame and stack pointers.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Bug fix

Merge Risk: 🔵 Low · up to 886f6

Some host-exception reports can omit the guest trace from stdout in File or Silent logging modes, limiting debugging. This is a bounded diagnostic gap, not a change to guest termination behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: attributing the host-exception program counter to its module and printing the guest stack trace.
Description check ✅ Passed The description directly explains the module attribution and guest stack trace changes, their diagnostic purpose, and unchanged termination behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 02:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1182#issuecomment-6050983044) <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1182?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The host exception handler now reports the faulting module’s filename and base-relative offset when the address belongs to a loaded program. Otherwise, it reports `module: ???`. When a `RuntimeLinker` instance is available, the handler also logs a stack trace using the exception’s frame and stack pointers. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"886f6532fc99b031a995309cc17cd5039e476815" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **🔵 Low** · up to `886f6` <!-- final_review_risk_coverage:{"sourceCommitId":"886f6532fc99b031a995309cc17cd5039e476815","coveredCommitId":"886f6532fc99b031a995309cc17cd5039e476815","kind":"reviewed"} --> Some host-exception reports can omit the guest trace from stdout in File or Silent logging modes, limiting debugging. This is a bounded diagnostic gap, not a change to guest termination behavior. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :---------------- | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------ | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes the main changes: attributing the host-exception program counter to its module and printing the guest stack trace. | | Description check | ✅ Passed | The description directly explains the module attribution and guest stack trace changes, their diagnostic purpose, and unchanged termination behavior. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1182)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 02:33 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8b592e7f-595b-4899-9577-f8982e6693f6
📥 Commits

Reviewing files that changed from the base of the PR and between 5a8808086a and 886f6532fc.

📒 Files selected for processing (1)
  • src/loader/runtimeLinker.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 02:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1182#pullrequestreview-5450709315) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `8b592e7f-595b-4899-9577-f8982e6693f6` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 5a8808086a9815b67d4822cd20cf1e8a7a05f002 and 886f6532fc99b031a995309cc17cd5039e476815. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/loader/runtimeLinker.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=5d42e349-5418-4f6b-be9d-68ef8e528d38 attempt=23225d2a-4c56-47c2-b2c5-baa35916efa4 batch=1/1 -->
@ -715,0 +720,4 @@
} else {
std::printf("module: ???\n");
}
linker->StackTrace(info->rbp, info->rsp);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 02:33 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect LOGF's definition and its console/log output path.
rg -n -C 5 '#\s*define\s+LOGF\b|void\s+LogF\s*\(|WriteToConsoleAndLog\s*\(' .

Repository: KytyPS5/KytyPS5

Length of output: 20323


Send the guest stack trace to the fault report output.

StackTrace() uses LOGF, which resolves to Log::Write(...). The surrounding fault report uses std::printf, so the guest stack trace may not appear in the report output when Log::Write targets only the logger or file. Use the same console-and-log path as the surrounding report, or otherwise ensure that the trace is written to its output stream.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 02:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1182#discussion_r4214017688) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Inspect LOGF's definition and its console/log output path. rg -n -C 5 '#\s*define\s+LOGF\b|void\s+LogF\s*\(|WriteToConsoleAndLog\s*\(' . ``` Repository: KytyPS5/KytyPS5 Length of output: 20323 --- </details> **Send the guest stack trace to the fault report output.** `StackTrace()` uses `LOGF`, which resolves to `Log::Write(...)`. The surrounding fault report uses `std::printf`, so the guest stack trace may not appear in the report output when `Log::Write` targets only the logger or file. Use the same console-and-log path as the surrounding report, or otherwise ensure that the trace is written to its output stream. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:8267e764d0039166e270e0e1 --> <!-- This is an auto-generated comment by CodeRabbit -->

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.