gdb: add -catch-hiperr to the Machine Interface (MI)#180
Open
amd-shahab wants to merge 1 commit into
Open
Conversation
Introduce a new MI command to catch HIP runtime errors that takes the form of: -catch-hiperr [ -c <condition>] [ -t ] Along with it the documentation is updated and new tests are added. Change-Id: Ib1c2190cc081caeea210d61aec71e6452516525b
lancesix
reviewed
Jun 19, 2026
lancesix
left a comment
Collaborator
There was a problem hiding this comment.
First very quick remarks.
| @subsubheading Example | ||
|
|
||
| @smallexample | ||
| -catch-hiperr -c $_hiperr==hipErrorInvalidDevice -t |
Collaborator
There was a problem hiding this comment.
usual parsing question… How do you differentiate -t as a flag after the condition v.s. -t being the unari - operator, i.e. hipErrorInvalidDevice - t?
|
|
||
| require allow_hip_tests | ||
|
|
||
| standard_testfile hip-catch-errors.cpp |
Collaborator
There was a problem hiding this comment.
I think we usually try to avoid having tests share the same source. Things are easier to evolve if we have one source per test.
That being said, the test can have two phases, one testing the cli interpreter, and one testing the mi interpreter.
| # For checking the functionality of "catch hiperr" there's another test | ||
| # called hip-catch-errors.exp. | ||
|
|
||
| load_lib rocm.exp |
Collaborator
There was a problem hiding this comment.
To test MI, you most probably want to have
load_lib mi-support.exp
and use mi_gdb_test
| failures that satisfy it will trigger the catchpoint. If TEMPFLAG | ||
| is set, the catchpoint is triggered once and then it is removed. */ | ||
|
|
||
| extern void catch_hiperr_mi (const char *condition, bool tempflag); |
Collaborator
There was a problem hiding this comment.
is breakpoint.h the best place to define this? Feels out of place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a new MI command to catch HIP runtime errors that takes the form of:
-catch-hiperr [ -c ] [ -t ]
Along with it the documentation is updated and new tests are added.
Motivation
Add Machine Interface for "catch hiperr".
Technical Details
Machine Interface allows other tools control GDB by sending it commands and reading its feedback. This was missing for the "catch hiperr" support that we added earlier.
Test Plan
A new test with 4 different scenarios are added (see gdb.rocm/mi-catch-hiperr.exp).
Test Result
All the new tests are and "catch hiperr" tests are passing.