-
Notifications
You must be signed in to change notification settings - Fork 78
Fix data flow analysis for multiple text sections #220
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
Changes from 6 commits
4a78742
d0aa51b
e157d5f
61820cb
391cb19
35399dc
d60a042
eddece4
f757ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -273,7 +273,7 @@ pub struct Object { | |
| pub path: Option<std::path::PathBuf>, | ||
| #[cfg(feature = "std")] | ||
| pub timestamp: Option<filetime::FileTime>, | ||
| pub flow_analysis_results: BTreeMap<u64, Box<dyn FlowAnalysisResult>>, | ||
| flow_analysis_results: BTreeMap<u64, Box<dyn FlowAnalysisResult>>, | ||
| } | ||
|
|
||
| impl Default for Object { | ||
|
|
@@ -328,6 +328,20 @@ impl Object { | |
| self.symbols.iter().position(|symbol| symbol.section.is_some() && symbol.name == name) | ||
| } | ||
|
|
||
| pub fn get_flow_analysis_result(&self, symbol: &Symbol) -> Option<&dyn FlowAnalysisResult> { | ||
| let key = symbol.section.unwrap_or_default() as u64 + symbol.address; | ||
| self.flow_analysis_results.get(&key).map(|result| result.as_ref()) | ||
| } | ||
|
|
||
| pub fn add_flow_analysis_result( | ||
| &mut self, | ||
| symbol: &Symbol, | ||
| result: Box<dyn FlowAnalysisResult>, | ||
| ) { | ||
| let key = symbol.section.unwrap_or_default() as u64 + symbol.address; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This key seems like it could easily overlap, the section indices are small numbers
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, mixed up which was the section address vs section number. This thing gets called a lot so I want a cheap solution, so I just multiplied by a GB. If there's a single section bigger than a GB other things will break before this. |
||
| self.flow_analysis_results.insert(key, result); | ||
| } | ||
|
|
||
| pub fn has_flow_analysis_result(&self) -> bool { !self.flow_analysis_results.is_empty() } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.