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

Side by Side Diff: courgette/disassembler_win32.h

Issue 2055343002: Courgette: Add static method QuickDetect() to optimize program detection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit cleanup Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COURGETTE_DISASSEMBLER_WIN32_H_ 5 #ifndef COURGETTE_DISASSEMBLER_WIN32_H_
6 #define COURGETTE_DISASSEMBLER_WIN32_H_ 6 #define COURGETTE_DISASSEMBLER_WIN32_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Output is a vector of the RVAs corresponding to locations within executable 42 // Output is a vector of the RVAs corresponding to locations within executable
43 // that are listed in the base relocation table. 43 // that are listed in the base relocation table.
44 bool ParseRelocs(std::vector<RVA>* addresses); 44 bool ParseRelocs(std::vector<RVA>* addresses);
45 45
46 // Returns Section containing the relative virtual address, or null if none. 46 // Returns Section containing the relative virtual address, or null if none.
47 const Section* RVAToSection(RVA rva) const; 47 const Section* RVAToSection(RVA rva) const;
48 48
49 static std::string SectionName(const Section* section); 49 static std::string SectionName(const Section* section);
50 50
51 protected: 51 protected:
52 static bool QuickDetect(const uint8_t* start, size_t length, uint16_t magic);
Will Harris 2016/06/13 19:15:21 would be nice to see a comment here, in particular
etiennep 2016/06/14 21:16:37 Done.
53
52 // Disassembler interfaces. 54 // Disassembler interfaces.
53 RvaVisitor* CreateAbs32TargetRvaVisitor() override; 55 RvaVisitor* CreateAbs32TargetRvaVisitor() override;
54 RvaVisitor* CreateRel32TargetRvaVisitor() override; 56 RvaVisitor* CreateRel32TargetRvaVisitor() override;
55 void RemoveUnusedRel32Locations(AssemblyProgram* program) override; 57 void RemoveUnusedRel32Locations(AssemblyProgram* program) override;
56 58
57 DisassemblerWin32(const void* start, size_t length); 59 DisassemblerWin32(const uint8_t* start, size_t length);
58 60
59 CheckBool ParseFile(AssemblyProgram* target) WARN_UNUSED_RESULT; 61 CheckBool ParseFile(AssemblyProgram* target) WARN_UNUSED_RESULT;
60 bool ParseAbs32Relocs(); 62 bool ParseAbs32Relocs();
61 void ParseRel32RelocsFromSections(); 63 void ParseRel32RelocsFromSections();
62 virtual void ParseRel32RelocsFromSection(const Section* section) = 0; 64 virtual void ParseRel32RelocsFromSection(const Section* section) = 0;
63 65
64 CheckBool ParseNonSectionFileRegion(FileOffset start_file_offset, 66 CheckBool ParseNonSectionFileRegion(FileOffset start_file_offset,
65 FileOffset end_file_offset, 67 FileOffset end_file_offset,
66 AssemblyProgram* program) 68 AssemblyProgram* program)
67 WARN_UNUSED_RESULT; 69 WARN_UNUSED_RESULT;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 std::map<RVA, int> rel32_target_rvas_; 141 std::map<RVA, int> rel32_target_rvas_;
140 #endif 142 #endif
141 143
142 private: 144 private:
143 DISALLOW_COPY_AND_ASSIGN(DisassemblerWin32); 145 DISALLOW_COPY_AND_ASSIGN(DisassemblerWin32);
144 }; 146 };
145 147
146 } // namespace courgette 148 } // namespace courgette
147 149
148 #endif // COURGETTE_DISASSEMBLER_WIN32_H_ 150 #endif // COURGETTE_DISASSEMBLER_WIN32_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698