|
1 | 1 | // SPDX-License-Identifier: Apache-2.0 |
2 | 2 | // Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved. |
| 3 | +#define XCL_DRIVER_DLL_EXPORT // in same dll as exported xrt apis |
| 4 | +#define XRT_CORE_COMMON_SOURCE // in same dll as coreutil |
| 5 | +#define XRT_API_SOURCE // in same dll as coreutil |
| 6 | + |
3 | 7 | #include "capture.h" |
4 | 8 | #include "detail/capture_artifacts.h" |
5 | 9 | #include "detail/capture_fnfwd.h" |
|
9 | 13 |
|
10 | 14 | #include "core/common/config_reader.h" |
11 | 15 | #include "core/common/debug.h" |
| 16 | +#include "core/common/error.h" |
12 | 17 | #include "core/common/api/bo_int.h" |
13 | 18 | #include "core/common/api/elf_int.h" |
14 | 19 | #include "core/common/api/hw_context_int.h" |
@@ -53,7 +58,7 @@ insert_json_object(json& dest, const json& src) |
53 | 58 | static uint64_t |
54 | 59 | to_uint64(span<const uint8_t> data) |
55 | 60 | { |
56 | | - if (data.size() > 8) |
| 61 | + if (data.size() > sizeof(uint64_t)) |
57 | 62 | throw std::runtime_error("Wrong data size"); |
58 | 63 |
|
59 | 64 | uint64_t value = 0; |
@@ -114,6 +119,7 @@ class frames |
114 | 119 | } |
115 | 120 |
|
116 | 121 | public: |
| 122 | + explicit |
117 | 123 | bo(xrt::bo bo) |
118 | 124 | : m_bo{std::move(bo)} |
119 | 125 | , m_id{get_uid()} |
@@ -208,6 +214,7 @@ class frames |
208 | 214 | } |
209 | 215 |
|
210 | 216 | public: |
| 217 | + explicit |
211 | 218 | run(const xrt::run_impl* hdl) |
212 | 219 | : m_hdl{hdl} |
213 | 220 | , m_run{xrt_core::kernel_int::get_run_from_impl(m_hdl)} |
@@ -314,6 +321,7 @@ class frames |
314 | 321 | const xrt::runlist_impl* m_hdl; |
315 | 322 | std::vector<const run*> m_runs; |
316 | 323 | public: |
| 324 | + explicit |
317 | 325 | runlist(const xrt::runlist_impl* hdl) |
318 | 326 | : m_hdl{hdl} |
319 | 327 | {} |
@@ -414,8 +422,11 @@ class frames |
414 | 422 | v->set_run(run); |
415 | 423 | } |
416 | 424 | } |
417 | | - else if constexpr (std::is_same_v<T, uint64_t>) |
418 | | - args.push_back(v); |
| 425 | + else if constexpr (std::is_same_v<T, uint64_t>) { |
| 426 | + // gcc14 comple error requires explicit help here |
| 427 | + // args.push_back(v); // fails RHEL10 (gcc14) |
| 428 | + args.emplace_back(arg_type{v}); |
| 429 | + } |
419 | 430 | }, rarg); |
420 | 431 | } |
421 | 432 | XRT_DEBUGF("<- capture_frame_start(run:0x%x)\n", run); |
@@ -532,7 +543,13 @@ class frames |
532 | 543 |
|
533 | 544 | ~frames() |
534 | 545 | { |
535 | | - save_replay_script(); |
| 546 | + try { |
| 547 | + save_replay_script(); |
| 548 | + } |
| 549 | + catch (const std::exception& ex) { |
| 550 | + xrt_core::send_exception_message("could not save replay script: " + std::string(ex.what())); |
| 551 | + } |
| 552 | + |
536 | 553 | } |
537 | 554 |
|
538 | 555 | std::string |
|
0 commit comments