Fix DexFile's line number and test EH and StackTraceElement in 3 ways.

Testing exception handling: 1. Walking stack 10 levels and then check
depth == 10. 2. Check if correct stack trace is being generated. 3. For
native frame, lineno should be -2 to indicate it is native. Note that
"line number == -2" is how libcore tells from StackTraceElement.

Change-Id: If38c16a59624f259985bcfcebc337b73b0582460
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 231b4be..f782fe9 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -540,6 +540,12 @@
 }
 
 int32_t DexFile::GetLineNumFromPC(const art::Method* method, uint32_t rel_pc) const {
+  // For native method, lineno should be -2 to indicate it is native. Note that
+  // "line number == -2" is how libcore tells from StackTraceElement.
+  if (method->code_off_ == 0) {
+    return -2;
+  }
+
   const CodeItem* code_item = GetCodeItem(method->code_off_);
   DCHECK(code_item != NULL);