Next phase of the move, reformat use C++ features.

Use the libbacktrace C++ interface instead of the C interface in debuggerd.

Reformat the debuggerd code to be closer to Google C++ style.

Fix all debuggerd casts to be C++ casts.

Add a frame number to the frame data structure for ease of formatting and
add another FormatFrameData function.

Change the format_test to use the new FormatFrameData function.

Modify all of the backtrace_test to use the C++ interface.

Change-Id: I10e1610861acf7f4a3ad53276b74971cfbfda464
diff --git a/libbacktrace/Backtrace.cpp b/libbacktrace/Backtrace.cpp
index a7568e0..fa85872 100644
--- a/libbacktrace/Backtrace.cpp
+++ b/libbacktrace/Backtrace.cpp
@@ -125,7 +125,10 @@
 }
 
 std::string Backtrace::FormatFrameData(size_t frame_num) {
-  backtrace_frame_data_t* frame = &backtrace_.frames[frame_num];
+  return FormatFrameData(&backtrace_.frames[frame_num]);
+}
+
+std::string Backtrace::FormatFrameData(const backtrace_frame_data_t* frame) {
   const char* map_name;
   if (frame->map_name) {
     map_name = frame->map_name;
@@ -142,13 +145,13 @@
   char buf[512];
   if (frame->func_name && frame->func_offset) {
     snprintf(buf, sizeof(buf), "#%02zu pc %0*" PRIxPTR "  %s (%s+%" PRIuPTR ")",
-             frame_num, (int)sizeof(uintptr_t)*2, relative_pc, map_name,
+             frame->num, (int)sizeof(uintptr_t)*2, relative_pc, map_name,
              frame->func_name, frame->func_offset);
   } else if (frame->func_name) {
-    snprintf(buf, sizeof(buf), "#%02zu pc %0*" PRIxPTR "  %s (%s)", frame_num,
+    snprintf(buf, sizeof(buf), "#%02zu pc %0*" PRIxPTR "  %s (%s)", frame->num,
              (int)sizeof(uintptr_t)*2, relative_pc, map_name, frame->func_name);
   } else {
-    snprintf(buf, sizeof(buf), "#%02zu pc %0*" PRIxPTR "  %s", frame_num,
+    snprintf(buf, sizeof(buf), "#%02zu pc %0*" PRIxPTR "  %s", frame->num,
              (int)sizeof(uintptr_t)*2, relative_pc, map_name);
   }