Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Unified Diff: courgette/rel32_finder_win32_x86.h

Issue 1792603006: Revert of [Courgette] Clean up Disassembler; fix ELF Memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/image_utils.h ('k') | courgette/rel32_finder_win32_x86.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/rel32_finder_win32_x86.h
diff --git a/courgette/rel32_finder_win32_x86.h b/courgette/rel32_finder_win32_x86.h
index 98ebd9825a471d9aba01a75635cd4058e710dbc9..01226aebb3dd9599263cba23aa2d6e71a81e956d 100644
--- a/courgette/rel32_finder_win32_x86.h
+++ b/courgette/rel32_finder_win32_x86.h
@@ -7,7 +7,9 @@
#include <stdint.h>
+#if COURGETTE_HISTOGRAM_TARGETS
#include <map>
+#endif
#include <vector>
#include "courgette/image_utils.h"
@@ -17,21 +19,25 @@
// A helper class to scan through a section of code to extract RVAs.
class Rel32FinderWin32X86 {
public:
- Rel32FinderWin32X86(RVA relocs_start_rva, RVA relocs_end_rva);
+ Rel32FinderWin32X86(RVA relocs_start_rva, RVA relocs_end_rva,
+ RVA image_end_rva);
virtual ~Rel32FinderWin32X86();
- // Swaps data in |rel32_locations_| with |dest|.
+ // Subsumes rva != kUnassignedRVA.
+ bool IsValidRVA(RVA rva) const { return rva < image_end_rva_; }
+
+ // Swaps data in |rel32_locations_| to |dest|.
void SwapRel32Locations(std::vector<RVA>* dest);
#if COURGETTE_HISTOGRAM_TARGETS
- // Swaps data in |rel32_target_rvas_| with |dest|.
+ // Swaps data in |rel32_target_rvas_| to |dest|.
void SwapRel32TargetRVAs(std::map<RVA, int>* dest);
#endif
// Scans through [|start_pointer|, |end_pointer|) for rel32 addresses. Seeks
// RVAs that satisfy the following:
- // - Do not overlap with |abs32_locations| (assumed sorted).
- // - Do not overlap with [relocs_start_rva, relocs_end_rva).
+ // - Do not collide with |abs32_pos| (assumed sorted).
+ // - Do not collide with |base_relocation_table|'s RVA range,
// - Whose targets are in [|start_rva|, |end_rva|).
// The sorted results are written to |rel32_locations_|.
virtual void Find(const uint8_t* start_pointer,
@@ -43,6 +49,7 @@
protected:
const RVA relocs_start_rva_;
const RVA relocs_end_rva_;
+ const RVA image_end_rva_;
std::vector<RVA> rel32_locations_;
@@ -55,7 +62,8 @@
// (excluding JPO/JPE) disregarding instruction alignment.
class Rel32FinderWin32X86_Basic : public Rel32FinderWin32X86 {
public:
- Rel32FinderWin32X86_Basic(RVA relocs_start_rva, RVA relocs_end_rva);
+ Rel32FinderWin32X86_Basic(RVA relocs_start_rva, RVA relocs_end_rva,
+ RVA image_end_rva);
virtual ~Rel32FinderWin32X86_Basic();
// Rel32FinderWin32X86 implementation.
« no previous file with comments | « courgette/image_utils.h ('k') | courgette/rel32_finder_win32_x86.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698