Skip to content

Consider the first chunk that we encounter as valid #26

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
Mar 8, 2024
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
4 changes: 3 additions & 1 deletion include/quokka/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,10 @@ class HeadIterator {
/**
* Retrieve the next chunk address if any are found
* @param address Address to start from
* @param skip_current Do not consider the chunk starting at the current
* address
*/
void SetNextChunk(ea_t address);
void SetNextChunk(ea_t address, bool skip_current = true);

/**
* Compute the next address and state
Expand Down
19 changes: 16 additions & 3 deletions src/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,24 @@ void HeadIterator::InitAddresses(ea_t address) {
this->next_unk_addr = next_unknown(address, this->max_ea);
this->next_head_addr = next_head(address, this->max_ea);

this->SetNextChunk(address);
this->SetNextChunk(address, false);
}

void HeadIterator::SetNextChunk(ea_t address) {
func_t* func = get_next_fchunk(address);
void HeadIterator::SetNextChunk(ea_t address, bool skip_current /* = true*/) {
func_t* func;

// Check if there is a chunk starting at provided address
if (!skip_current) {
func = get_fchunk(address);
if (func != nullptr && func->start_ea == address) {
this->next_chunk_addr = address;
this->next_func_chunk = func;
return;
}
}

// Find the next chunk, not considering the one at the current address
func = get_next_fchunk(address);
if (func != nullptr) {
this->next_chunk_addr = func->start_ea;
this->next_func_chunk = func;
Expand Down