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
Auto-dump binaries (PPU Debug), reduce ELF loader RAM usage #14416
Conversation
ca084f9
to
b64dfa9
Compare
|
||
if (ppu_load_exec(ppu_exec, false, m_path, DeserialManager())) | ||
{ | ||
if (g_cfg.core.ppu_debug) | ||
{ |
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.
Can't you put these spu and ppu debug prog saving sections into functions?
It's getting increasingly worse to read the general flow of these code sections
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.
Fixed.
5da394e
to
cf4e568
Compare
9a6379d
to
72413de
Compare
b998dd7
to
915f30c
Compare
Do not duplicate shdr memory when it is present in phdr.
// Rely on previous sh_offset value! | ||
if (hdr.p_offset <= shdr.sh_offset && shdr.sh_offset + shdr.sh_size - 1 <= hdr.p_offset + hdr.p_filesz - 1) | ||
{ | ||
const auto& prog = ::at32(progs, p_index); |
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.
unused
|
||
for (const auto& hdr : progs) | ||
{ | ||
if (shdr.bin_view.empty()) |
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.
why not check this in line 440 ?
{ | ||
if (out.size() == data.size()) | ||
{ | ||
// Risky optimization: assume if file size match they are equal and does not need to rewrite 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.
Why does this need such an optimization if it's a debug tool anyway?
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.
So it would be convenient to use it most of the time, the risks are extremely low and depend on disk errors. The write itself is not atomic so it's not perfect anyways.
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.
And even if there are errors, common sense says to delete the file and redump it.
This was the difference in file size when using this dumping code and the decryption tool because elf_object::open/save were not optimized to include inner sections.