Skip to content

gdb: add -catch-hiperr to the Machine Interface (MI)#180

Open
amd-shahab wants to merge 1 commit into
amd-stagingfrom
users/shvahedi/hip-catch-errs
Open

gdb: add -catch-hiperr to the Machine Interface (MI)#180
amd-shahab wants to merge 1 commit into
amd-stagingfrom
users/shvahedi/hip-catch-errs

Conversation

@amd-shahab

Copy link
Copy Markdown
Contributor

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.

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 lancesix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

First very quick remarks.

Comment thread gdb/doc/gdb.texinfo
@subsubheading Example

@smallexample
-catch-hiperr -c $_hiperr==hipErrorInvalidDevice -t

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

To test MI, you most probably want to have

load_lib mi-support.exp

and use mi_gdb_test

Comment thread gdb/breakpoint.h
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);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is breakpoint.h the best place to define this? Feels out of place.

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.

3 participants