-
Notifications
You must be signed in to change notification settings - Fork 532
dynamic tracing compiler json result support #9760
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
Closed
+31
−10
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Submodule aiebu
updated
64 files
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
dtrace_configstoresctrl_file_path.c_str()/map_data.c_str()pointers, but the arguments passed fromcreate_dtrace_util()are a localstd::string pathand a temporarym_config.dump_buf.to_string(). After the constructor call/assignment completes those underlying string buffers are destroyed, leavingdtrace_config(and potentially the dtrace handle) with dangling pointers. Please persist the strings insidedtrace_util(e.g.,std::string ctrl_path_storage; std::string map_data_storage;and setdtrace_configto point to theirc_str()), or otherwise ensurecreate_dtrace_handle()does not retain the pointers beyond the call.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.
In this flow,
create_dtrace_handledoes not retain thedtrace_configpointer. It constructsdtrace::controlusing those inputs, and control takesstd::string/const std::string&, so the data is copied during handle creation. That means there is no dangling-pointer use after the constructor callUh oh!
There was an error while loading. Please reload this page.
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.
The code is not clean, the copilot comment shows why it is not structured correctly, please redo. dtrace_config is a data member and it is definitely holding on to stale pointers after construction.
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.
done
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.
This code still makes no sense. aiebu/.../control.h control ctor takes std::string, you are moving to c_str() only to go back to std::string.
I don't want a constructor body in xrt_module, you have to fix create_dtrace_handle to accept the types it needs. You are faking it by introducing the dtrace_config struct, but then running into problems with what you store in this struct. You could in fact store std::string in config_t, and apply the proper moves in the right places, or you could have create_dtrace_handle accept the types it needs and drop config_t. Moving from std::string -> c_str -> std::string is just weird.
Let's back up and review the changes you made to AIEBU in Xilinx/aiebu#278. For example, I see that control ctor take script_file by value and map_data by const &, why is the former by value, as far as I can see it is not modified in the function. You should request Sonal's review on AIEBU changes and maybe me too (even as I don't really want review AIEBU).
I will accept the xrt_module changes without the dtrace_config struct hack. I will need much time to review the AIEBU changes, but if Sonal approves these I am okay.
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.
the reason there is std::string -> c_str -> std::string is, we want to provide C API, but the implementation in aiebu is cpp and caller is also cpp.
the reason we want to provide C API is there is potential use case in embedded baremetal
so probably here we don't need the config_t, and pass all required to create_handle?
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.
config_t struct was also introduced for future extensibility, adding new parameters for dtrace handle creation then doesn't require changing the API signature
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.
I understand your motivation for config_t, but what does it buy you? You add a new data member to the struct, you change upstream code to populate the member; or you change a function signature and change upstream code to use the new signature. Either way two changes. A config_t struct doesn't buy you anything in this case, that doesn't mean it's wrong or bad, except it is bad in its current use.