Skip to content

Add support for enabling/querying local memory exceptions.#105

Open
oogunbow-amd wants to merge 1 commit intoamd-stagingfrom
users/oogunbow/lds_reporting
Open

Add support for enabling/querying local memory exceptions.#105
oogunbow-amd wants to merge 1 commit intoamd-stagingfrom
users/oogunbow/lds_reporting

Conversation

@oogunbow-amd
Copy link
Copy Markdown

@oogunbow-amd oogunbow-amd commented Apr 29, 2026

This feature allows users to detect out‑of‑address-range accesses to local memory (LDS) during debugging sessions using new set/show lds-out-of-addr-range-exceptions commands.

Updated target data structures, attach/detach logic, and clone/fork handling to propagate the new setting. Adjusted build configuration to require amd‑dbgapi ≥ 0.81.0.

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

This feature allows users to detect out‑of‑address-range
accesses to local memory (LDS) during debugging sessions using
new set/show lds-out-of-addr-range-exceptions commands.

Updated target data structures, attach/detach logic, and
clone/fork handling to propagate the new setting. Adjusted
build configuration to require amd‑dbgapi ≥ 0.81.0.
@oogunbow-amd oogunbow-amd requested a review from a team as a code owner April 29, 2026 13:12
@oogunbow-amd oogunbow-amd self-assigned this Apr 29, 2026
Copy link
Copy Markdown
Contributor

@simark simark left a comment

Choose a reason for hiding this comment

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

The commit message says set/show lds-out-of-addr-range-exceptions, so I was going to say this setting should probably be under set/show amdgpu, but that's what the code actually does. So I think the commit message should be updated to reflect that.

Comment thread CHANGELOG_AMD.md
- set amdgpu lds-out-of-addr-exception
- show amdgpu lds-out-of-addr-exception

## ROCgdb-X for ROCm-next
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these new added lines are duplicate and should be removed.

## ROCgdb-X for ROCm-next

### Added

The new entries should also go at the end of the "Added" list.

Comment thread gdb/amd-dbgapi-target.c
cmds = add_setshow_boolean_cmd ("lds-out-of-address-range-exception", no_class,
_("Set lds-out-of-address-range-exception mode."),
_("Show lds-out-of-address-range-exception mode."), _("\
If on, local memory out-of-address-range exception reporting is enabled if/when\n\
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like you copy/pasted this from the code block above, nonetheless I think "if/when" is not adding any value. a mere "when" would suffice.

Comment thread gdb/amd-dbgapi-target.c
/* Callback for "show amdgpu lds-out-of-address-range-exception". */

static void
show_local_memory_out_of_addr_range_exception_mode (struct ui_file *file, int from_tty,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

right now, this line is above 80 column limit (87 chars to be exact).

the function name is 50 characters long. show_lds_addr_range_excp_mode() maybe? the same holds true for other functions.

Comment thread gdb/amd-dbgapi-target.c

static void
show_local_memory_out_of_addr_range_exception_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The alignment of the text is off.

I'm going to suppress other GNU coding standard violations at this point. Please find and fix them.

Comment thread gdb/amd-dbgapi-target.c
return info.precise_alu_exceptions.enabled;
}

/* Callback for "show amdgpu lds-out-of-address-range-exception". */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lds-addr-range-exception ?

@@ -0,0 +1,57 @@
# Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2026

@@ -0,0 +1,48 @@
/* Copyright (C) 2022-2025 Advanced Micro Devices, Inc. All rights reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2026

#include <stdio.h>
#include <stdlib.h>

#define CHECK(cmd) \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#include "rocm-test-utils.h" and drop the definition of CHECK().

} \
}

typedef void (*func_ptr) ();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this typedef? I don't see func_ptr used anywhere.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# Test debugging a program that branches to a bad address. Check that
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this description is up-to-date. moreover, maybe shared-exceptions is not the best name for this test.

"Warning: precise memory violation signal reporting is not enabled, reported" \
"location may not be accurate. See \"show amdgpu precise-memory\"\\." \
"Warning: local memory out-of-address-range exception reporting is not enabled\\." \
"See \"show amdgpu lds-out-of-addr-exception\"\\." \
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.

So what happens if you turn this on? Please explain it in the commit log, ideally with a short/concise example.

Comment thread gdb/amd-dbgapi-target.c
copy the precise memory request, it will be applied when the process
starts. */
copy the precise memory and local memory request, it will be applied when
the process starts. */
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.

We now have two things, so some words must be adjusted for plural:

request => requests
it will be => they will be

Comment thread gdb/amd-dbgapi-target.c
set_local_memory_out_of_addr_range_exception_mode,
get_local_memory_out_of_addr_range_exception_mode,
show_local_memory_out_of_addr_range_exception_mode,
&set_amdgpu_list, &show_amdgpu_list);
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.

This setting / feature must be documented in the GDB manual.

@palves
Copy link
Copy Markdown
Collaborator

palves commented May 4, 2026

Please drop period from commit log.

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.

4 participants