This repository has been archived by the owner on Mar 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Using breakpoint instead of SIGUSR2 #1
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8491fb0
Modifications to ROCm-GDB to use internal breakpoints instead of SIGU…
nadeaudi ddcd230
Missing change in previous commit to use breakpoint instead of SIGUSR2.
nadeaudi 59a82fc
Removal of the codepath that uses SIGUSR2. It now uses a breakpoint i…
nadeaudi 626cc72
-Refactoring to give more explicit names to functions and variables.
nadeaudi 27e827a
Modification of the notification when a GPU Breakpoint is hit.
nadeaudi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,6 +303,9 @@ static struct breakpoint_ops longjmp_breakpoint_ops; | |
breakpoints. */ | ||
struct breakpoint_ops bkpt_breakpoint_ops; | ||
|
||
/* The breakpoint_ops structure to be used in HSA library breakpoint */ | ||
struct breakpoint_ops gpu_breakpoint_trigger_ops; | ||
|
||
/* Breakpoints set on probes. */ | ||
static struct breakpoint_ops bkpt_probe_breakpoint_ops; | ||
|
||
|
@@ -13613,6 +13616,40 @@ bkpt_resources_needed (const struct bp_location *bl) | |
return 1; | ||
} | ||
|
||
static enum print_stop_action | ||
gpu_bkpt_trigger_print_it (bpstat bs) | ||
{ | ||
struct breakpoint *b; | ||
const struct bp_location *bl; | ||
int bp_temp; | ||
struct ui_out *uiout = current_uiout; | ||
|
||
gdb_assert (bs->bp_location_at != NULL); | ||
|
||
bl = bs->bp_location_at; | ||
b = bs->breakpoint_at; | ||
|
||
bp_temp = b->disposition == disp_del; | ||
if (bl->address != bl->requested_address) | ||
breakpoint_adjustment_warning (bl->requested_address, | ||
bl->address, | ||
b->number, 1); | ||
annotate_breakpoint (b->number); | ||
if (bp_temp) | ||
ui_out_text (uiout, "\nTemporary breakpoint triggered by GPU Kernel Breakpoint"); | ||
else | ||
ui_out_text (uiout, "\nStopped on GPU Breakpoint"); | ||
if (ui_out_is_mi_like_p (uiout)) | ||
{ | ||
ui_out_field_string (uiout, "reason", | ||
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT)); | ||
ui_out_field_string (uiout, "disp", bpdisp_text (b->disposition)); | ||
} | ||
ui_out_text (uiout, ", "); | ||
|
||
return PRINT_SRC_AND_LOC; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was trying this out internally and I noticed that it should be |
||
} | ||
|
||
static enum print_stop_action | ||
bkpt_print_it (bpstat bs) | ||
{ | ||
|
@@ -16598,6 +16635,11 @@ initialize_breakpoint_ops (void) | |
ops->print_mention = bkpt_print_mention; | ||
ops->print_recreate = bkpt_print_recreate; | ||
|
||
/* The HSA breakpoint structure that will be hit when the GPU hits a breakpoint. */ | ||
ops = &gpu_breakpoint_trigger_ops; | ||
*ops = bkpt_breakpoint_ops; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above about the name "gpu_breakpoint_trigger_ops". |
||
ops->print_it = gpu_bkpt_trigger_print_it; | ||
|
||
/* Ranged breakpoints. */ | ||
ops = &ranged_breakpoint_ops; | ||
*ops = bkpt_breakpoint_ops; | ||
|
@@ -16761,6 +16803,30 @@ initialize_breakpoint_ops (void) | |
ops->breakpoint_hit = dprintf_breakpoint_hit; | ||
} | ||
|
||
void | ||
create_hsa_gpu_breakpoint_trigger(char *location) | ||
{ | ||
/* A copy to a local buffer is used, as | ||
* location might be in a read-only memory | ||
* and create_breakpoint takes a non constant | ||
* char *. | ||
*/ | ||
char buffer[30]; | ||
strncpy(buffer, location,30); | ||
create_breakpoint(get_current_arch(), | ||
buffer, | ||
NULL, 0, NULL, 1, | ||
0, bp_breakpoint, | ||
0, | ||
pending_break_support, | ||
&gpu_breakpoint_trigger_ops, | ||
1, | ||
1, /* Is enabled. */ | ||
1, /* Internal breakpoint. */ | ||
0); /* No flags */ | ||
|
||
} | ||
|
||
/* Chain containing all defined "enable breakpoint" subcommands. */ | ||
|
||
static struct cmd_list_element *enablebreaklist = NULL; | ||
|
This file contains 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
This file contains 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
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.
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.
If we add PRINT_NOTHING below, then a new line is needed in
ui_out_text (uiout, "\nStopped on GPU Breakpoint\n");
so that the (rocm-gdb) prompt comes on a new line.
also," ui_out_text (uiout, ", ");" should be removed.