Skip to content

Commit

Permalink
disasm: Added capability to make all labels into analysis points
Browse files Browse the repository at this point in the history
This currently helps with swars only, but if .map support is added
this can be used to analyze all symbols defined in the .map file.
  • Loading branch information
mefistotelis committed Jan 11, 2024
1 parent 2ed74cf commit 0e2ea16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/analyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ Analyser::add_eip_to_trace_queue (void)
this->set_label (Label (eip, Label::FUNCTION, "_start"));
}

void
Analyser::add_labels_to_trace_queue (void)
{
for (auto it = this->labels.begin(); it != this->labels.end(); it++)
{
Label *label = &it->second;
if (label->get_type() == Label::FUNCTION or label->get_type() == Label::JUMP)
this->add_code_trace_address (label->get_address());
}
}

void
Analyser::add_code_trace_address (uint32_t addr)
{
Expand Down
1 change: 1 addition & 0 deletions src/analyser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Analyser

void add_initial_regions (void);
void add_eip_to_trace_queue (void);
void add_labels_to_trace_queue (void);
void add_code_trace_address (uint32_t addr);

void trace_code (void);
Expand Down
1 change: 1 addition & 0 deletions src/known_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ KnownFile::pre_anal_fixups_apply(Analyser &anal)
anal.set_label (Label (0x13c443, Label::JUMP));
anal.set_label (Label (0x140096, Label::FUNCTION));
# include "known_labels_swars.cpp"
anal.add_labels_to_trace_queue ();
break;
case KnownFile::NOT_KNOWN:
break;
Expand Down

0 comments on commit 0e2ea16

Please sign in to comment.