Permalink
Browse files

Handle [native code] stack frames

Reviewed By: ashwinb, javache

Differential Revision: D5104078

fbshipit-source-id: edefc7cb7e1d401155372c917875ad8b14af94e9
  • Loading branch information...
adamjernst authored and facebook-github-bot committed May 22, 2017
1 parent a975c1e commit 0ee8786cd8025302284af6df3f63ea843dfb9737
Showing with 13 additions and 9 deletions.
  1. +13 −9 ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java
@@ -174,17 +174,21 @@ public JSONObject toJSON() {
String[] stackTrace = stack.split("\n");
StackFrame[] result = new StackFrame[stackTrace.length];
for (int i = 0; i < stackTrace.length; ++i) {
Matcher matcher = STACK_FRAME_PATTERN.matcher(stackTrace[i]);
if (!matcher.find()) {
throw new IllegalArgumentException(
if (stackTrace[i].equals("[native code]")) {
result[i] = new StackFrameImpl(null, stackTrace[i], -1, -1);
} else {
Matcher matcher = STACK_FRAME_PATTERN.matcher(stackTrace[i]);
if (!matcher.find()) {
throw new IllegalArgumentException(
"Unexpected stack frame format: " + stackTrace[i]);
}
}
result[i] = new StackFrameImpl(
matcher.group(2),
matcher.group(1) == null ? "(unknown)" : matcher.group(1),
Integer.parseInt(matcher.group(3)),
Integer.parseInt(matcher.group(4)));
result[i] = new StackFrameImpl(
matcher.group(2),
matcher.group(1) == null ? "(unknown)" : matcher.group(1),
Integer.parseInt(matcher.group(3)),
Integer.parseInt(matcher.group(4)));
}
}
return result;
}

0 comments on commit 0ee8786

Please sign in to comment.