Skip to content

[#9971] Gracefully error out in ETDump for set_debug_buffer #10130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions devtools/etdump/etdump_flatcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,17 @@ ETDumpResult ETDumpGen::get_etdump_data() {
return result;
}

void ETDumpGen::set_debug_buffer(Span<uint8_t> buffer) {
Result<bool> ETDumpGen::set_debug_buffer(Span<uint8_t> buffer) {
Result<BufferDataSink> bds_ret = BufferDataSink::create(buffer);
ET_CHECK_MSG(
ET_CHECK_OR_RETURN_ERROR(
bds_ret.ok(),
InvalidArgument,
"Failed to create data sink from debug buffer with error 0x%" PRIx32,
static_cast<uint32_t>(bds_ret.error()));

buffer_data_sink_ = std::move(bds_ret.get());
data_sink_ = &buffer_data_sink_;
return true;
}

void ETDumpGen::set_data_sink(DataSinkBase* data_sink) {
Expand Down
2 changes: 1 addition & 1 deletion devtools/etdump/etdump_flatcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ETDumpGen : public ::executorch::runtime::EventTracer {
virtual void set_delegation_intermediate_output_filter(
EventTracerFilterBase* event_tracer_filter) override;

void set_debug_buffer(::executorch::runtime::Span<uint8_t> buffer);
Result<bool> set_debug_buffer(::executorch::runtime::Span<uint8_t> buffer);
void set_data_sink(DataSinkBase* data_sink);
ETDumpResult get_etdump_data();
size_t get_num_blocks();
Expand Down