1. seandroid
  2. Untitled project
  3. system/core

Commits

Christopher Ferris  committed 7f081ec

Use new defines in test code.

In addition, fix up the warnings and remove the -fpermissive when
compiling.

Change-Id: Ia27b902499b34ff3d881acb9057120af390baf2c

  • Participants
  • Parent commits c294585
  • Branches master

Comments (0)

Files changed (2)

File libbacktrace/Android.mk

View file
 	thread_utils.c \
 
 LOCAL_CFLAGS += \
+	$(common_cflags) \
 	-fno-builtin \
 	-fstack-protector-all \
 	-O0 \
 
 LOCAL_CPPFLAGS += \
 	$(common_cppflags) \
-	-fpermissive \
 
 LOCAL_SHARED_LIBRARIES += \
 	libcutils \
 	thread_utils.c \
 
 LOCAL_CFLAGS += \
+	$(common_cflags) \
 	-fno-builtin \
 	-fstack-protector-all \
 	-O0 \
 	libbacktrace_test \
 	libbacktrace \
 
-LOCAL_CPPFLAGS += \
-	-fpermissive \
-
 LOCAL_LDLIBS := \
 	-lpthread \
 

File libbacktrace/backtrace_test.cpp

View file
 void VerifyLevelBacktrace(void*) {
   backtrace_context_t context;
 
-  ASSERT_TRUE(backtrace_create_context(&context, -1, -1, 0));
+  ASSERT_TRUE(backtrace_create_context(&context, BACKTRACE_CURRENT_PROCESS, BACKTRACE_NO_TID, 0));
 
   VerifyLevelDump(context.backtrace);
 
 void VerifyMaxBacktrace(void*) {
   backtrace_context_t context;
 
-  ASSERT_TRUE(backtrace_create_context(&context, -1, -1, 0));
+  ASSERT_TRUE(backtrace_create_context(&context, BACKTRACE_CURRENT_PROCESS, BACKTRACE_NO_TID, 0));
 
   VerifyMaxDump(context.backtrace);
 
 
 void VerifyLevelIgnoreFrames(void*) {
   backtrace_context_t all;
-  ASSERT_TRUE(backtrace_create_context(&all, -1, -1, 0));
+  ASSERT_TRUE(backtrace_create_context(&all, BACKTRACE_CURRENT_PROCESS, BACKTRACE_NO_TID, 0));
   ASSERT_TRUE(all.backtrace != NULL);
 
   backtrace_context_t ign1;
-  ASSERT_TRUE(backtrace_create_context(&ign1, -1, -1, 1));
+  ASSERT_TRUE(backtrace_create_context(&ign1, BACKTRACE_CURRENT_PROCESS, BACKTRACE_NO_TID, 1));
   ASSERT_TRUE(ign1.backtrace != NULL);
 
   backtrace_context_t ign2;
-  ASSERT_TRUE(backtrace_create_context(&ign2, -1, -1, 2));
+  ASSERT_TRUE(backtrace_create_context(&ign2, BACKTRACE_CURRENT_PROCESS, BACKTRACE_NO_TID, 2));
   ASSERT_TRUE(ign2.backtrace != NULL);
 
   VerifyIgnoreFrames(all.backtrace, ign1.backtrace, ign2.backtrace,
     ASSERT_NE(test_level_one(1, 2, 3, 4, NULL, NULL), 0);
     exit(1);
   }
-  VerifyProcTest(pid, -1, ReadyLevelBacktrace, VerifyLevelDump);
+  VerifyProcTest(pid, BACKTRACE_NO_TID, ReadyLevelBacktrace, VerifyLevelDump);
 
   kill(pid, SIGKILL);
   int status;
     ASSERT_NE(test_recursive_call(MAX_BACKTRACE_FRAMES+10, NULL, NULL), 0);
     exit(1);
   }
-  VerifyProcTest(pid, -1, ReadyMaxBacktrace, VerifyMaxDump);
+  VerifyProcTest(pid, BACKTRACE_NO_TID, ReadyMaxBacktrace, VerifyMaxDump);
 
   kill(pid, SIGKILL);
   int status;
   pid_t pid = bt_all->pid;
 
   backtrace_context_t ign1;
-  ASSERT_TRUE(backtrace_create_context(&ign1, pid, -1, 1));
+  ASSERT_TRUE(backtrace_create_context(&ign1, pid, BACKTRACE_NO_TID, 1));
   ASSERT_TRUE(ign1.backtrace != NULL);
 
   backtrace_context_t ign2;
-  ASSERT_TRUE(backtrace_create_context(&ign2, pid, -1, 2));
+  ASSERT_TRUE(backtrace_create_context(&ign2, pid, BACKTRACE_NO_TID, 2));
   ASSERT_TRUE(ign2.backtrace != NULL);
 
   VerifyIgnoreFrames(bt_all, ign1.backtrace, ign2.backtrace, NULL);
     ASSERT_NE(test_level_one(1, 2, 3, 4, NULL, NULL), 0);
     exit(1);
   }
-  VerifyProcTest(pid, -1, ReadyLevelBacktrace, VerifyProcessIgnoreFrames);
+  VerifyProcTest(pid, BACKTRACE_NO_TID, ReadyLevelBacktrace, VerifyProcessIgnoreFrames);
 
   kill(pid, SIGKILL);
   int status;
 TEST(libbacktrace, format_test) {
   backtrace_context_t context;
 
-  ASSERT_TRUE(backtrace_create_context(&context, -1, -1, 0));
+  ASSERT_TRUE(backtrace_create_context(&context, BACKTRACE_CURRENT_PROCESS, BACKTRACE_NO_TID, 0));
   ASSERT_TRUE(context.backtrace != NULL);
 
-  backtrace_frame_data_t* frame = &context.backtrace->frames[1];
+  backtrace_frame_data_t* frame = const_cast<backtrace_frame_data_t*>(&context.backtrace->frames[1]);
   backtrace_frame_data_t save_frame = *frame;
 
   memset(frame, 0, sizeof(backtrace_frame_data_t));
   EXPECT_STREQ(buf, "#01 pc 12345678  MapFake");
 #endif
 
-  frame->func_name = "ProcFake";
+  frame->func_name = const_cast<char*>("ProcFake");
   backtrace_format_frame_data(&context, 1, buf, sizeof(buf));
 #if defined(__LP64__)
   EXPECT_STREQ(buf, "#01 pc 0000000012345678  MapFake (ProcFake)");