@@ -274,11 +274,52 @@ namespace BinaryNinja
274274 class Type ;
275275 class DataBuffer ;
276276
277+ /* ! Logs to the error console with the given BNLogLevel.
278+
279+ \param level BNLogLevel debug log level
280+ \param fmt C-style format string.
281+ \param ... Variable arguments corresponding to the format string.
282+ */
277283 void Log (BNLogLevel level, const char * fmt, ...);
284+
285+ /* ! LogDebug only writes text to the error console if the console is set to log level: DebugLog
286+ Log level DebugLog is the most verbose logging level.
287+
288+ \param fmt C-style format string.
289+ \param ... Variable arguments corresponding to the format string.
290+ */
278291 void LogDebug (const char * fmt, ...);
292+
293+ /* ! LogInfo always writes text to the error console, and corresponds to the log level: InfoLog.
294+ Log level InfoLog is the second most verbose logging level.
295+
296+ \param fmt C-style format string.
297+ \param ... Variable arguments corresponding to the format string.
298+ */
279299 void LogInfo (const char * fmt, ...);
300+
301+ /* ! LogWarn writes text to the error console including a warning icon,
302+ and also shows a warning icon in the bottom pane. LogWarn corresponds to the log level: WarningLog.
303+
304+ \param fmt C-style format string.
305+ \param ... Variable arguments corresponding to the format string.
306+ */
280307 void LogWarn (const char * fmt, ...);
308+
309+ /* ! LogError writes text to the error console and pops up the error console. Additionall,
310+ Errors in the console log include a error icon. LogError corresponds to the log level: ErrorLog.
311+
312+ \param fmt C-style format string.
313+ \param ... Variable arguments corresponding to the format string.
314+ */
281315 void LogError (const char * fmt, ...);
316+
317+ /* ! LogAlert pops up a message box displaying the alert message and logs to the error console.
318+ LogAlert corresponds to the log level: AlertLog.
319+
320+ \param fmt C-style format string.
321+ \param ... Variable arguments corresponding to the format string.
322+ */
282323 void LogAlert (const char * fmt, ...);
283324
284325 void LogToStdout (BNLogLevel minimumLevel);
@@ -571,7 +612,6 @@ namespace BinaryNinja
571612 Ref<Architecture> arch;
572613 uint64_t addr;
573614 };
574-
575615 class AnalysisCompletionEvent : public CoreRefCountObject <BNAnalysisCompletionEvent,
576616 BNNewAnalysisCompletionEventReference, BNFreeAnalysisCompletionEvent>
577617 {
@@ -586,13 +626,26 @@ namespace BinaryNinja
586626 void Cancel ();
587627 };
588628
629+ /* ! BinaryView is the base class for creating views on binary data (e.g. ELF, PE, Mach-O).
630+ BinaryView should be subclassed to create a new BinaryView
631+ */
589632 class BinaryView : public CoreRefCountObject <BNBinaryView, BNNewViewReference, BNFreeBinaryView>
590633 {
591634 protected:
592- Ref<FileMetadata> m_file;
635+ Ref<FileMetadata> m_file; // !< The underlying file
593636
637+ /* ! BinaryView constructor
638+ \param typeName name of the BinaryView (e.g. ELF, PE, Mach-O, ...)
639+ \param file a file to create a view from
640+ */
594641 BinaryView (const std::string& typeName, FileMetadata* file);
595642
643+ /* ! PerformRead provides a mapping between the flat file and virtual offsets in the file.
644+
645+ \param dest the address to write len number of bytes.
646+ \param offset the virtual offset to find and read len bytes from
647+ ....\param len the number of bytes to read from offset and write to dest
648+ */
596649 virtual size_t PerformRead (void * dest, uint64_t offset, size_t len) { (void )dest; (void )offset; (void )len; return 0 ; }
597650 virtual size_t PerformWrite (uint64_t offset, const void * data, size_t len) { (void )offset; (void )data; (void )len; return 0 ; }
598651 virtual size_t PerformInsert (uint64_t offset, const void * data, size_t len) { (void )offset; (void )data; (void )len; return 0 ; }
@@ -740,17 +793,16 @@ namespace BinaryNinja
740793
741794 void DefineImportedFunction (Symbol* importAddressSym, Function* func);
742795
796+
743797 bool IsNeverBranchPatchAvailable (Architecture* arch, uint64_t addr);
744798 bool IsAlwaysBranchPatchAvailable (Architecture* arch, uint64_t addr);
745799 bool IsInvertBranchPatchAvailable (Architecture* arch, uint64_t addr);
746800 bool IsSkipAndReturnZeroPatchAvailable (Architecture* arch, uint64_t addr);
747801 bool IsSkipAndReturnValuePatchAvailable (Architecture* arch, uint64_t addr);
748-
749802 bool ConvertToNop (Architecture* arch, uint64_t addr);
750803 bool AlwaysBranch (Architecture* arch, uint64_t addr);
751804 bool InvertBranch (Architecture* arch, uint64_t addr);
752805 bool SkipAndReturnValue (Architecture* arch, uint64_t addr, uint64_t value);
753-
754806 size_t GetInstructionLength (Architecture* arch, uint64_t addr);
755807
756808 std::vector<BNStringReference> GetStrings ();
@@ -997,6 +1049,7 @@ namespace BinaryNinja
9971049
9981050 typedef size_t ExprId;
9991051
1052+ // ! Architecture is the base class for all architectures
10001053 class Architecture : public StaticCoreRefCountObject <BNArchitecture>
10011054 {
10021055 protected:
@@ -1035,7 +1088,6 @@ namespace BinaryNinja
10351088 static uint32_t GetLinkRegisterCallback (void * ctxt);
10361089
10371090 static bool AssembleCallback (void * ctxt, const char * code, uint64_t addr, BNDataBuffer* result, char ** errors);
1038-
10391091 static bool IsNeverBranchPatchAvailableCallback (void * ctxt, const uint8_t * data, uint64_t addr, size_t len);
10401092 static bool IsAlwaysBranchPatchAvailableCallback (void * ctxt, const uint8_t * data, uint64_t addr, size_t len);
10411093 static bool IsInvertBranchPatchAvailableCallback (void * ctxt, const uint8_t * data, uint64_t addr, size_t len);
@@ -1064,6 +1116,8 @@ namespace BinaryNinja
10641116 virtual bool GetInstructionText (const uint8_t * data, uint64_t addr, size_t & len,
10651117 std::vector<InstructionTextToken>& result) = 0;
10661118
1119+ /* ! GetInstructionLowLevelIL
1120+ */
10671121 virtual bool GetInstructionLowLevelIL (const uint8_t * data, uint64_t addr, size_t & len, LowLevelILFunction& il);
10681122 virtual std::string GetRegisterName (uint32_t reg);
10691123 virtual std::string GetFlagName (uint32_t flag);
@@ -1088,15 +1142,72 @@ namespace BinaryNinja
10881142
10891143 virtual bool Assemble (const std::string& code, uint64_t addr, DataBuffer& result, std::string& errors);
10901144
1145+ /* ! IsNeverBranchPatchAvailable returns true if the instruction at addr can be patched to never branch.
1146+ This is used in the UI to determine if "never branch" should be displayed in the right-click context
1147+ menu when right-clicking on an instruction.
1148+ \param arch the architecture of the instruction
1149+ \param addr the address of the instruction in question
1150+ */
10911151 virtual bool IsNeverBranchPatchAvailable (const uint8_t * data, uint64_t addr, size_t len);
1152+
1153+ /* ! IsAlwaysBranchPatchAvailable returns true if the instruction at addr can be patched to always branch.
1154+ This is used in the UI to determine if "always branch" should be displayed in the right-click context
1155+ menu when right-clicking on an instruction.
1156+ \param arch the architecture of the instruction
1157+ \param addr the address of the instruction in question
1158+ */
10921159 virtual bool IsAlwaysBranchPatchAvailable (const uint8_t * data, uint64_t addr, size_t len);
1160+
1161+ /* ! IsInvertBranchPatchAvailable returns true if the instruction at addr can be patched to invert the branch.
1162+ This is used in the UI to determine if "invert branch" should be displayed in the right-click context
1163+ menu when right-clicking on an instruction.
1164+ \param arch the architecture of the instruction
1165+ \param addr the address of the instruction in question
1166+ */
10931167 virtual bool IsInvertBranchPatchAvailable (const uint8_t * data, uint64_t addr, size_t len);
1168+
1169+ /* ! IsSkipAndReturnZeroPatchAvailable returns true if the instruction at addr is a call that can be patched to
1170+ return zero. This is used in the UI to determine if "skip and return zero" should be displayed in the
1171+ right-click context menu when right-clicking on an instruction.
1172+ \param arch the architecture of the instruction
1173+ \param addr the address of the instruction in question
1174+ */
10941175 virtual bool IsSkipAndReturnZeroPatchAvailable (const uint8_t * data, uint64_t addr, size_t len);
1176+
1177+ /* ! IsSkipAndReturnValuePatchAvailable returns true if the instruction at addr is a call that can be patched to
1178+ return a value. This is used in the UI to determine if "skip and return value" should be displayed in the
1179+ right-click context menu when right-clicking on an instruction.
1180+ \param arch the architecture of the instruction
1181+ \param addr the address of the instruction in question
1182+ */
10951183 virtual bool IsSkipAndReturnValuePatchAvailable (const uint8_t * data, uint64_t addr, size_t len);
10961184
1185+ /* ! ConvertToNop converts the instruction at addr to a no-operation instruction
1186+ \param arch the architecture of the instruction
1187+ \param addr the address of the instruction in question
1188+ */
10971189 virtual bool ConvertToNop (uint8_t * data, uint64_t addr, size_t len);
1190+
1191+ /* ! AlwaysBranch converts the conditional branch instruction at addr to an unconditional branch. This is called
1192+ when the right-click context menu item "always branch" is selected in the UI.
1193+ \param arch the architecture of the instruction
1194+ \param addr the address of the instruction in question
1195+ */
10981196 virtual bool AlwaysBranch (uint8_t * data, uint64_t addr, size_t len);
1197+
1198+ /* ! InvertBranch converts the conditional branch instruction at addr to its invert. This is called
1199+ when the right-click context menu item "invert branch" is selected in the UI.
1200+ \param arch the architecture of the instruction
1201+ \param addr the address of the instruction in question
1202+ */
10991203 virtual bool InvertBranch (uint8_t * data, uint64_t addr, size_t len);
1204+
1205+ /* ! SkipAndReturnValue converts the call instruction at addr to an instruction that simulates that call
1206+ returning a value. This is called when the right-click context menu item "skip and return value" is selected
1207+ in the UI.
1208+ \param arch the architecture of the instruction
1209+ \param addr the address of the instruction in question
1210+ */
11001211 virtual bool SkipAndReturnValue (uint8_t * data, uint64_t addr, size_t len, uint64_t value);
11011212
11021213 void RegisterFunctionRecognizer (FunctionRecognizer* recog);
@@ -1637,6 +1748,8 @@ namespace BinaryNinja
16371748 BNUpdateResult UpdateToLatestVersion (const std::function<bool (uint64_t progress, uint64_t total)>& progress);
16381749 };
16391750
1751+ /* ! UpdateVersion documentation
1752+ */
16401753 struct UpdateVersion
16411754 {
16421755 std::string version;
@@ -1785,6 +1898,9 @@ namespace BinaryNinja
17851898 virtual uint32_t GetFloatReturnValueRegister () override ;
17861899 };
17871900
1901+ /* !
1902+ Platform base class. This should be subclassed when creating a new platform
1903+ */
17881904 class Platform : public CoreRefCountObject <BNPlatform, BNNewPlatformReference, BNFreePlatform>
17891905 {
17901906 protected:
0 commit comments