Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f4f16e6
dbgapi/win32: Fix libdxg and MSVC
palves Mar 16, 2026
faa78ec
dbgapi/win32: Fix NTSTATUS constants
palves Mar 19, 2026
42091d3
dbgapi/win32: No windef.h in amd-dbgapi.h.in
palves Mar 16, 2026
50a0835
dbgapi: Handle function pointers explicitly in to_string
palves Mar 16, 2026
6d488ff
rocdbgapi: batch r_debug/link_map reads
lmoriche Mar 26, 2026
bf64978
rocdbgapi: keep an index for loaded code objects
lmoriche Mar 27, 2026
06482f1
Add process_id and wave_id arguments to amd_dbgapi_address_dependency
lmoriche Feb 6, 2025
b29650b
Move the apertures configurations to the agent
lmoriche Feb 6, 2025
b199448
dbgapi/win32: Support long paths in get_self_path
palves Mar 19, 2026
db4ce56
dbgapi/win32: __declspec(dllexport) instead of --version-script
palves Mar 20, 2026
0c47d6d
dbgapi: Untabify kmd_driver_t::xfer_agent_memory_partial
palves Mar 21, 2026
e3d28a4
dbgapi/win32: Fix src/os_driver_kmd.cpp warning in release mode
palves Mar 21, 2026
c7e507c
dbgapi/win32: Don't disable -Werror for src/os_driver_kmd.cpp
palves Mar 21, 2026
a41b9b0
dbgapi: Fix comment vs code mismatch in watchpoint_t::watchpoint_t
palves Mar 20, 2026
2e7c8a5
dbgapi: Avoid vprintf
palves Mar 20, 2026
eb7c65f
dbgapi: Add -Wconversion and fix whole dbgapi codebase
palves Mar 20, 2026
1fc5db6
dbgapi: Avoid unary minus operator applied to unsigned type
palves Mar 20, 2026
179d227
dbgapi/msvc: Fix __has_builtin
palves Mar 19, 2026
44c1872
dbgapi/msvc: NOMINMAX
palves Mar 19, 2026
9feda67
dbgapi/msvc: Fix << shift
palves Mar 21, 2026
4bb4e05
dbgapi/msvc: Fix build error with missing typename
palves Mar 20, 2026
3e7eece
dbgapi/msvc: case labels and initialization
palves Mar 18, 2026
357bd38
dbgapi/msvc: __cplusplus
palves Mar 18, 2026
9defd12
dbgapi/msvc: dbgapi_assert_not_reached
palves Mar 18, 2026
16b317d
dbgapi/msvc: Fix warning C4101: 'e': unreferenced local variable
palves Mar 20, 2026
4a3db91
dbgapi/msvc: Tweak CMakeLists.txt for MSVC
palves Mar 20, 2026
7810a4f
Add AMD_DBGAPI_PROCESS_INFO_SIGNIFICANT_ADDRESS_BITS
lancesix Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
Full documentation for AMD Debugger API is available at
[rocm.docs.amd.com/rocdbgapi](https://rocm.docs.amd.com/projects/ROCdbgapi/en/latest/index.html).

## rocm-dbgapi-0.78 for ROCm-X
## rocm-dbgapi-0.80 for ROCm-X
### Added
- amd_dbgapi_process_get_info() adds a new query to get a mask spanning
over all the bits used by all the address spaces. The query is called
`AMD_DBGAPI_PROCESS_INFO_SIGNIFICANT_ADDRESS_BITS`.

## rocm-dbgapi-0.79
### Changed
- Add `process_id` and `wave_id` arguments to `amd_dbgapi_address_dependency`.

## rocm-dbgapi-0.78
### Added
- Initial support to debug HIP applications on Windows OS. Windows is
supported only on the gfx120x architectures (gfx1200 and gfx1201) with no
Expand Down
82 changes: 48 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

cmake_minimum_required(VERSION 3.8)

project(amd-dbgapi VERSION 0.78.0)
project(amd-dbgapi VERSION 0.80.0)

include(CheckIncludeFile)
include(CheckIncludeFiles)
Expand Down Expand Up @@ -165,8 +165,17 @@ set_target_properties(amd-dbgapi PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR})

target_compile_options(amd-dbgapi PRIVATE
-fno-rtti -Werror -Wall -Wextra -Wshadow -Wno-attributes) #-pedantic)
if(MSVC)
# CMake adds /GR to CMAKE_CXX_FLAGS, remove it to avoid:
# cl : Command line warning D9025 : overriding '/GR' with '/GR-'
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

target_compile_options(amd-dbgapi PRIVATE
/GR- /permissive-)
else()
target_compile_options(amd-dbgapi PRIVATE
-fno-rtti -Werror -Wall -Wextra -Wshadow -Wno-attributes -Wconversion) #-pedantic)
endif()

target_compile_definitions(amd-dbgapi
PRIVATE __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS __STDC_FORMAT_MACROS)
Expand Down Expand Up @@ -199,26 +208,30 @@ if(libbacktrace_FOUND)
target_link_libraries(amd-dbgapi PRIVATE libbacktrace::libbacktrace)
else()
message(STATUS "[libbacktrace check] Could not find libbacktrace through find_package.")
message(STATUS "[libbacktrace check] Trying compiler fallback.")

message(STATUS "[libbacktrace check] Executing command: ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} --print-file-name libbacktrace.a")

# See if the compiler knows where libbacktrace.a is. It is worth mentioning
# that both gcc and llvm have the same behavior when --print-file-name is used
# but the compiler cannot locate the file anywhere. They output the filename
# passed as argument to --print-file-name unchanged.
#
# This makes it so the libbacktrace_check below will always pass. Though
# incorrect, this is somewhat harmless as we will call find_path and
# find_library later and we could end up finding includes and library
# depending on the system environment variables.
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} --print-file-name libbacktrace.a
RESULT_VARIABLE libbacktrace_check
OUTPUT_VARIABLE libbacktrace_path
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "[libbacktrace check] Command output: ${libbacktrace_path}")
if(NOT MSVC)
message(STATUS "[libbacktrace check] Trying compiler fallback.")

message(STATUS "[libbacktrace check] Executing command: ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} --print-file-name libbacktrace.a")

# See if the compiler knows where libbacktrace.a is. It is worth mentioning
# that both gcc and llvm have the same behavior when --print-file-name is
# used but the compiler cannot locate the file anywhere. They output the
# filename passed as argument to --print-file-name unchanged.
#
# This makes it so the libbacktrace_check below will always pass. Though
# incorrect, this is somewhat harmless as we will call find_path and
# find_library later and we could end up finding includes and library
# depending on the system environment variables.
execute_process(
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} --print-file-name libbacktrace.a
RESULT_VARIABLE libbacktrace_check
OUTPUT_VARIABLE libbacktrace_path
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "[libbacktrace check] Command output: ${libbacktrace_path}")
else()
set(libbacktrace_check 1)
endif()

if(${libbacktrace_check} EQUAL 0)
get_filename_component(BACKTRACE_PREFIX ${libbacktrace_path} DIRECTORY)
Expand Down Expand Up @@ -284,19 +297,18 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")

target_include_directories(amd-dbgapi PRIVATE
src/windows/imported
${D3DKMT_INCLUDE_PATH}
${D3DKMT_INCLUDE_PATH})

# Including libdxg raises some warnings (unknown pragmas) as well as
# "X too small to hold all values of Y". The latter warning cannot
# be silenced, so tell the compiler to treat the libdxg directory as
# a system headers include path, so that warnings are disabled for
# that directory's headers.
target_include_directories(amd-dbgapi SYSTEM PRIVATE
third_party/libdxg/include)

target_compile_definitions(amd-dbgapi
PRIVATE D3DKMDT_SPECIAL_MULTIPLATFORM_TOOL)

# Including libdxg raises some warnings (unknown pargmas) as well us
# "X too small to hold all values of Y". The latter warning cannot be
# silenced, se we need to disable -Werror for this file.
set_source_files_properties(
src/os_driver_kmd.cpp
PROPERTIES
COMPILE_OPTIONS "-Wno-error;-Wno-unknown-pragmas")
else()
message(FATAL_ERROR "Platform ${CMAKE_SYSTEM_NAME} is not supported")
endif()
Expand Down Expand Up @@ -434,8 +446,10 @@ target_include_directories(amd-dbgapi
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include/amd-dbgapi>
$<INSTALL_INTERFACE:include>)

target_link_libraries(amd-dbgapi
PRIVATE -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/src/exportmap -Wl,--no-undefined)
if(NOT WIN32)
target_link_libraries(amd-dbgapi
PRIVATE -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/src/exportmap -Wl,--no-undefined)
endif()

set(AMD_DBGAPI_CONFIG_NAME amd-dbgapi-config.cmake)
set(AMD_DBGAPI_TARGETS_NAME amd-dbgapi-targets.cmake)
Expand Down
93 changes: 75 additions & 18 deletions include/amd-dbgapi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -492,19 +492,19 @@
#endif /* !defined (AMD_DBGAPI_CALL) */

#if !defined(AMD_DBGAPI_EXPORT_DECORATOR)
#if defined(__GNUC__)
#define AMD_DBGAPI_EXPORT_DECORATOR __attribute__ ((visibility ("default")))
#elif defined(_MSC_VER)
#define AMD_DBGAPI_EXPORT_DECORATOR __declspec(dllexport)
#endif /* defined (_MSC_VER) */
# if defined(_WIN32)
# define AMD_DBGAPI_EXPORT_DECORATOR __declspec(dllexport)
# elif defined(__GNUC__)
# define AMD_DBGAPI_EXPORT_DECORATOR __attribute__ ((visibility ("default")))
# endif
#endif /* !defined (AMD_DBGAPI_EXPORT_DECORATOR) */

#if !defined(AMD_DBGAPI_IMPORT_DECORATOR)
#if defined(__GNUC__)
#define AMD_DBGAPI_IMPORT_DECORATOR
#elif defined(_MSC_VER)
#define AMD_DBGAPI_IMPORT_DECORATOR __declspec(dllimport)
#endif /* defined (_MSC_VER) */
# if defined(_WIN32)
# define AMD_DBGAPI_IMPORT_DECORATOR __declspec(dllimport)
# else
# define AMD_DBGAPI_IMPORT_DECORATOR
# endif
#endif /* !defined (AMD_DBGAPI_IMPORT_DECORATOR) */

#define AMD_DBGAPI_EXPORT AMD_DBGAPI_EXPORT_DECORATOR AMD_DBGAPI_CALL
Expand All @@ -518,7 +518,20 @@
#endif /* !defined (AMD_DBGAPI_EXPORTS) */
#endif /* !defined (AMD_DBGAPI) */

#if __cplusplus >= 201103L
/* By default, MSVC reports 199711L (C++98) for the __cplusplus macro,
regardless of the actual language version you are using (like C++17
or C++20). Instead, we need to look at _MSVC_LANG, which correctly
reports the C++ standard version being targeted by the
compiler. */
#if defined(__cplusplus)
# if defined(_MSVC_LANG)
# define AMD_DBGAPI_CPLUSPLUS _MSVC_LANG
# else
# define AMD_DBGAPI_CPLUSPLUS __cplusplus
# endif
#endif

#if defined(__cplusplus) && AMD_DBGAPI_CPLUSPLUS >= 201103L
/* c++11 allows extended initializer lists. */
#define AMD_DBGAPI_HANDLE_LITERAL(type, value) (type{ value })
#elif __STDC_VERSION__ >= 199901L
Expand All @@ -528,7 +541,7 @@
#define AMD_DBGAPI_HANDLE_LITERAL(type, value) {value}
#endif /* !__STDC_VERSION__ >= 199901L */

#if defined(__cplusplus) && __cplusplus >= 201402L
#if defined(__cplusplus) && AMD_DBGAPI_CPLUSPLUS >= 201402L
#define DEPRECATED [[deprecated]]
#else
#define DEPRECATED
Expand All @@ -543,7 +556,10 @@ extern "C" {
#endif /* __linux__ */

#if defined(_WIN32)
#include <windef.h>
/* Define these ourselves to avoid including windows.h in our public
header and polluting the namespace. */
typedef void *amd_dbgapi_HANDLE;
typedef unsigned long amd_dbgapi_DWORD;
#endif /* _WIN32 */

#include <stddef.h>
Expand Down Expand Up @@ -625,11 +641,23 @@ extern "C" {
#define AMD_DBGAPI_VERSION_0_77

/**
* The function was introduced in version 0.77 of the interface and has the
* The function was introduced in version 0.78 of the interface and has the
* symbol version string of ``"@AMD_DBGAPI_NAME@_0.78"``.
*/
#define AMD_DBGAPI_VERSION_0_78

/**
* The function was introduced in version 0.79 of the interface and has the
* symbol version string of ``"@AMD_DBGAPI_NAME@_0.79"``.
*/
#define AMD_DBGAPI_VERSION_0_79

/**
* The function was introduced in version 0.80 of the interface and has the
* symbol version string of ``"@AMD_DBGAPI_NAME@_0.80"``.
*/
#define AMD_DBGAPI_VERSION_0_80

/** @} */

/** \ingroup callbacks_group
Expand Down Expand Up @@ -692,7 +720,7 @@ typedef enum
#if defined(__linux__)
typedef pid_t amd_dbgapi_os_process_id_t;
#elif defined(_WIN32)
typedef DWORD amd_dbgapi_os_process_id_t;
typedef amd_dbgapi_DWORD amd_dbgapi_os_process_id_t;
#endif /* _WIN32 */

/**
Expand Down Expand Up @@ -728,7 +756,7 @@ typedef DWORD amd_dbgapi_os_process_id_t;
#if defined(__linux__)
typedef int amd_dbgapi_notifier_t;
#elif defined(_WIN32)
typedef HANDLE amd_dbgapi_notifier_t;
typedef amd_dbgapi_HANDLE amd_dbgapi_notifier_t;
#endif /* _WIN32 */

/**
Expand Down Expand Up @@ -1836,6 +1864,14 @@ typedef enum
* ::AMD_DBGAPI_STATUS_ERROR_CLIENT_CALLBACK error.
*/
AMD_DBGAPI_PROCESS_INFO_CORE_STATE = 7,
/**
* Return a bitmask of all the bits which are used in at least one of the
* address spaces of each of the agents of the system. It is legal for the
* client to not preserve bits not set in this mask, as long as they are
* cleared before being returned back to the library. The type of this
* attribute is ::amd_dbgapi_segment_address_t.
*/
AMD_DBGAPI_PROCESS_INFO_SIGNIFICANT_ADDRESS_BITS = 8,
} amd_dbgapi_process_info_t;

/**
Expand Down Expand Up @@ -1889,7 +1925,7 @@ typedef enum
*/
amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_process_get_info (
amd_dbgapi_process_id_t process_id, amd_dbgapi_process_info_t query,
size_t value_size, void *value) AMD_DBGAPI_VERSION_0_77;
size_t value_size, void *value) AMD_DBGAPI_VERSION_0_80;

/**
* Attach to a process in order to provide debug control of the AMD GPUs it
Expand Down Expand Up @@ -6298,6 +6334,13 @@ typedef enum
* ::amd_dbgapi_write_memory require when reading and writing memory when given
* a specific segment address in an address space.
*
* \param[in] process_id The process that the \p segment_address belongs to.
* This is to handle generic addresses of a process.
*
* \param[in] wave_id The wave that is using the address. If the \p
* address_space is ::AMD_DBGAPI_ADDRESS_SPACE_GLOBAL then \p wave_id may be
* ::AMD_DBGAPI_WAVE_NONE.
*
* \param[in] address_space_id The address space of the \p segment_address.
*
* \param[in] segment_address The integral value of the segment address. Only
Expand All @@ -6321,18 +6364,32 @@ typedef enum
* destination_segment_address and \p segment_address_dependencies is
* unaltered.
*
* \retval ::AMD_DBGAPI_STATUS_ERROR_INVALID_PROCESS_ID \p process_id is
* invalid. \p segment_address_dependency is unaltered.
*
* \retval ::AMD_DBGAPI_STATUS_ERROR_INVALID_WAVE_ID \p wave_id is invalid
* and \p address_space_id is not ::AMD_DBGAPI_ADDRESS_SPACE_GLOBAL.
* \p segment_address_dependency is unaltered.
*
* \retval ::AMD_DBGAPI_STATUS_ERROR_INVALID_ADDRESS_SPACE_ID \p
* address_space_id is invalid. \p segment_address_dependencies is unaltered.
*
* \retval ::AMD_DBGAPI_STATUS_ERROR_INVALID_ARGUMENT \p
* segment_address_dependencies is NULL. \p segment_address_dependencies is
* unaltered.
*
* \retval ::AMD_DBGAPI_STATUS_ERROR_INVALID_ARGUMENT_COMPATIBILITY \p
* address_space_id depends on the active wave but \p wave_id is
* ::AMD_DBGAPI_WAVE_NONE, or \p address_space_id is not supported by the
* architecture of \p wave_id. \p segment_address_dependencies is unaltered.
*/
amd_dbgapi_status_t AMD_DBGAPI amd_dbgapi_address_dependency (
amd_dbgapi_process_id_t process_id,
amd_dbgapi_wave_id_t wave_id,
amd_dbgapi_address_space_id_t address_space_id,
amd_dbgapi_segment_address_t segment_address,
amd_dbgapi_segment_address_dependency_t *segment_address_dependency)
AMD_DBGAPI_VERSION_0_64;
AMD_DBGAPI_VERSION_0_79;

/**
* Indication of whether a segment address in an address space is a member of
Expand Down
Loading