-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Improve DWARF5 support and refactor (new history) #3703
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
librz/bin/dwarf/serialize.c
Outdated
TRY_LOAD_SECTION("debug_line", dw->line, | ||
rz_bin_dwarf_line_from_buf(buf, &dw->encoding, dw->info, RZ_BIN_DWARF_LINE_INFO_MASK_LINES_ALL)); | ||
|
||
RzBuffer *loc = load_section("debug_loc", sdb); |
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.
@thestr4ng3r what do you think about this approach of loading/saving the debug sections? cc @wargio @ret2libc
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.
Are these sections actually info that has to be saved/loaded at all? If it is something that is parsed directly out of the binary and will never be edited during the session, it does not have to be saved as it can be restored from the binary again on the next load (might need tests so this property is actually guaranteed).
For the RzAnalysisDwarfVariable
on the other hand, we have no choice other than to serialize it, or at least some kind of reference into the binary where the same info can be restored from, since variables can be renamed, etc.
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.
@thestr4ng3r Rizin uses only a small part of that information, in fact, especially at this stage. Thus do not storing whole sections should reduce the resulting size of the project file. Moreover, as some binaries have huge debug information sections, storing them serialized might become a problem, for example for files like this one: #676
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.
What I mean is that RzAnalysisDwarfVariable should not be edited and it can be restored via sections of DWARF. then we can reference it via DIE offset.
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.
@imbillow but then you don't need to store the whole section content in the SDB, only pointers to it?
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.
@imbillow but then you don't need to store the whole section content in the SDB, only pointers to it?
Yes.
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.
Exactly. If a DIE offset for a variable is enough to reconstruct the info, then it is enough to store that as part of the variable storage info and then reconstruct the info from the bin itself.
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.
Ok, lets stick to this approach then - saving pointers to the information. Then, if it works - the only missing thing is project migration tests, also test for loading this kind of storage from the project file. Then the PR will be ready to merge
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.
Agreed
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@imbillow could you please add a new test for this kind of anonymous function too? |
My bad. It's actually just a mistake to rename an existing function with the generated name, should has been fixed. |
3e52e12
to
4867d57
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
- rz_base_type_clone_into - rz_base_type_clone
- rz_bits_leading_zeros - rz_json_eq - rz_json_string_eq - RZ_STR_EQ - RZ_STR_NE - rz_vector_clone_into - sdb_diff_eq
- `RZ_PROJECT_VERSION` 14 - Add `RzCallable`.has_unspecified_parameters - Add `RzAnalysis`.debug_info - Add `RzAnalysisVarStorageType` composite and `eval` `pending` - Support for parse DWARF section "debug_loclists", "debug_ranges", "debug_rnglists" - Partial support for eval DWARF expr_loc - Support for anonymous Type, function variable, struct member - Cache all DWARF information in `RzAnalysisDebugInfo` and remove `SDB` based caching. - Add arm32, arm64, TriCore DWARF register name - Fix same name basetype
DO NOT SQUASH ME!
Your checklist for this pull request
Detailed description
Existing DWARF loaders have incomplete support for DWARF5, and the support for DWARF location expressions is too simplified. It also uses a lot of SDBs to store DWARF information.
This PR completely refactors the DWARF loader, fixes a lot of bugs, and makes a lot of improvements to these issues.
.debug_loclists
parse_dwarf_location
fromdwarf_process.c
todwarf.c
.debug_rnglists
.debug_addr
Hide COMPOSITE storage fromRzAnalysisVarStorage
for now (deferred to Implement composite (multi-register) var storage #3744)test/unit/test_serialize_analysis.c
test/integration/test_project_migrate.c
TODO (after merge)
Test plan
CI is green
Closing issues
closes #3548
closes #3535
closes #1004
closes #3541
closes #3700
partially addresses #3581
...
See also https://gcc.gnu.org/wiki/DebugFission
Second version of #3565