mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 20:37:02 +08:00
GP-6176: Better logging from AbstractObjcTypeMetadata
This commit is contained in:
+11
-2
@@ -18,7 +18,6 @@ package ghidra.app.util.bin.format.objc;
|
|||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import ghidra.app.util.bin.format.objc.objc1.Objc1TypeMetadata;
|
|
||||||
import ghidra.app.util.importer.MessageLog;
|
import ghidra.app.util.importer.MessageLog;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
@@ -60,7 +59,17 @@ public abstract class AbstractObjcTypeMetadata implements Closeable {
|
|||||||
* @param message The message to log
|
* @param message The message to log
|
||||||
*/
|
*/
|
||||||
public void log(String message) {
|
public void log(String message) {
|
||||||
log.appendMsg(Objc1TypeMetadata.class.getSimpleName(), message);
|
log.appendMsg(getClass().getSimpleName(), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience method to perform logging (with exception)
|
||||||
|
*
|
||||||
|
* @param message The message to log
|
||||||
|
* @param e The exception to log
|
||||||
|
*/
|
||||||
|
public void log(String message, Exception e) {
|
||||||
|
log.appendMsg(getClass().getSimpleName(), message + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+4
-4
@@ -93,7 +93,7 @@ public class Objc1TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse modules from section '" + section + "'");
|
log("Failed to parse modules from section '" + section + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ public class Objc1TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse protocols from section '" + section + "'");
|
log("Failed to parse protocols from section '" + section + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ public class Objc1TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
module.applyTo(program.getGlobalNamespace(), monitor);
|
module.applyTo(program.getGlobalNamespace(), monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + module.getName());
|
log("Failed to markup: " + module.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Objc1Protocol protocol : protocols) {
|
for (Objc1Protocol protocol : protocols) {
|
||||||
@@ -131,7 +131,7 @@ public class Objc1TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
protocol.applyTo(program.getGlobalNamespace(), monitor);
|
protocol.applyTo(program.getGlobalNamespace(), monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + protocol.getName());
|
log("Failed to markup: " + protocol.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-11
@@ -180,7 +180,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse Objective-C categeory from section '" + section + "'");
|
log("Failed to parse Objective-C categeory from section '" + section + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse Objective-C class from section '" + section + "'");
|
log("Failed to parse Objective-C class from section '" + section + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse Objective-C protocol from section '" + section + "'");
|
log("Failed to parse Objective-C protocol from section '" + section + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse Objective-C message reference from section '" + section + "'");
|
log("Failed to parse Objective-C message reference from section '" + section + "'", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,8 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
log("Failed to parse Objective-C libObjc optimizations from section '" + section + "'");
|
log("Failed to parse Objective-C libObjc optimizations from section '" + section + "'",
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +283,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
DataUtilities.ClearDataMode.CLEAR_SINGLE_DATA);
|
DataUtilities.ClearDataMode.CLEAR_SINGLE_DATA);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to create pointer at " + addr);
|
log("Failed to create pointer at " + addr, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Objc2ImageInfo imageInfo : imageInfos) {
|
for (Objc2ImageInfo imageInfo : imageInfos) {
|
||||||
@@ -290,7 +291,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
imageInfo.applyTo(program.getGlobalNamespace(), monitor);
|
imageInfo.applyTo(program.getGlobalNamespace(), monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + imageInfo);
|
log("Failed to markup: " + imageInfo, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Objc2Category category : categories) {
|
for (Objc2Category category : categories) {
|
||||||
@@ -298,7 +299,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
category.applyTo(program.getGlobalNamespace(), monitor);
|
category.applyTo(program.getGlobalNamespace(), monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + category);
|
log("Failed to markup: " + category, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Objc2Class cls : classes) {
|
for (Objc2Class cls : classes) {
|
||||||
@@ -306,7 +307,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
cls.applyTo(program.getGlobalNamespace(), monitor);
|
cls.applyTo(program.getGlobalNamespace(), monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + cls);
|
log("Failed to markup: " + cls, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Objc2Protocol protocol : protocols) {
|
for (Objc2Protocol protocol : protocols) {
|
||||||
@@ -316,7 +317,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
protocol.applyTo(namespace, monitor);
|
protocol.applyTo(namespace, monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + protocol);
|
log("Failed to markup: " + protocol, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Objc2MessageReference messageRef : messageRefs) {
|
for (Objc2MessageReference messageRef : messageRefs) {
|
||||||
@@ -324,7 +325,7 @@ public class Objc2TypeMetadata extends AbstractObjcTypeMetadata {
|
|||||||
messageRef.applyTo(program.getGlobalNamespace(), monitor);
|
messageRef.applyTo(program.getGlobalNamespace(), monitor);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
log("Failed to markup: " + messageRef);
|
log("Failed to markup: " + messageRef, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user