Fix all our unused parameter warnings so we let GCC report them.
There were a couple of genuine bugs here (fixed), plus there's a missing
feature in trace.cc that I've just added a TODO for.
Also note that I haven't touched the compilers; this warning is still
explicitly disabled for that code. I'll do that when there's less going
on in those directories.
Change-Id: Ic3570bf82411a07c7530bfaf1995ac995b9fc00f
diff --git a/src/assembler_arm.cc b/src/assembler_arm.cc
index e25e656..ae9f092 100644
--- a/src/assembler_arm.cc
+++ b/src/assembler_arm.cc
@@ -1658,7 +1658,7 @@
StoreToOffset(kStoreWord, SP, TR, thr_offs.Int32Value());
}
-void ArmAssembler::Move(ManagedRegister mdest, ManagedRegister msrc, size_t size) {
+void ArmAssembler::Move(ManagedRegister mdest, ManagedRegister msrc, size_t /*size*/) {
ArmManagedRegister dest = mdest.AsArm();
ArmManagedRegister src = msrc.AsArm();
if (!dest.Equals(src)) {
@@ -1717,8 +1717,8 @@
StoreToOffset(kStoreWord, scratch, dest_base.AsArm().AsCoreRegister(), dest_offset.Int32Value());
}
-void ArmAssembler::Copy(FrameOffset dest, FrameOffset src_base, Offset src_offset,
- ManagedRegister mscratch, size_t size) {
+void ArmAssembler::Copy(FrameOffset /*dst*/, FrameOffset /*src_base*/, Offset /*src_offset*/,
+ ManagedRegister /*mscratch*/, size_t /*size*/) {
UNIMPLEMENTED(FATAL);
}
@@ -1731,8 +1731,8 @@
StoreToOffset(kStoreWord, scratch, dest.AsArm().AsCoreRegister(), dest_offset.Int32Value());
}
-void ArmAssembler::Copy(FrameOffset dest, Offset dest_offset, FrameOffset src, Offset src_offset,
- ManagedRegister scratch, size_t size) {
+void ArmAssembler::Copy(FrameOffset /*dst*/, Offset /*dest_offset*/, FrameOffset /*src*/, Offset /*src_offset*/,
+ ManagedRegister /*scratch*/, size_t /*size*/) {
UNIMPLEMENTED(FATAL);
}
@@ -1816,11 +1816,11 @@
in_reg.AsCoreRegister(), 0, NE);
}
-void ArmAssembler::VerifyObject(ManagedRegister src, bool could_be_null) {
+void ArmAssembler::VerifyObject(ManagedRegister /*src*/, bool /*could_be_null*/) {
// TODO: not validating references
}
-void ArmAssembler::VerifyObject(FrameOffset src, bool could_be_null) {
+void ArmAssembler::VerifyObject(FrameOffset /*src*/, bool /*could_be_null*/) {
// TODO: not validating references
}
@@ -1849,7 +1849,7 @@
// TODO: place reference map on call
}
-void ArmAssembler::Call(ThreadOffset offset, ManagedRegister scratch) {
+void ArmAssembler::Call(ThreadOffset /*offset*/, ManagedRegister /*scratch*/) {
UNIMPLEMENTED(FATAL);
}
@@ -1858,7 +1858,7 @@
}
void ArmAssembler::GetCurrentThread(FrameOffset offset,
- ManagedRegister scratch) {
+ ManagedRegister /*scratch*/) {
StoreToOffset(kStoreWord, TR, SP, offset.Int32Value(), AL);
}
diff --git a/src/assembler_x86.cc b/src/assembler_x86.cc
index 97663a7..f771676 100644
--- a/src/assembler_x86.cc
+++ b/src/assembler_x86.cc
@@ -183,7 +183,7 @@
}
-void X86Assembler::movb(Register dst, const Address& src) {
+void X86Assembler::movb(Register /*dst*/, const Address& /*src*/) {
LOG(FATAL) << "Use movzxb or movsxb instead.";
}
@@ -236,7 +236,7 @@
}
-void X86Assembler::movw(Register dst, const Address& src) {
+void X86Assembler::movw(Register /*dst*/, const Address& /*src*/) {
LOG(FATAL) << "Use movzxw or movsxw instead.";
}
@@ -1494,8 +1494,8 @@
fs()->movl(Address::Absolute(thr_offs), lbl);
}
-void X86Assembler::StoreSpanning(FrameOffset dest, ManagedRegister src,
- FrameOffset in_off, ManagedRegister scratch) {
+void X86Assembler::StoreSpanning(FrameOffset /*dst*/, ManagedRegister /*src*/,
+ FrameOffset /*in_off*/, ManagedRegister /*scratch*/) {
UNIMPLEMENTED(FATAL); // this case only currently exists for ARM
}
@@ -1647,8 +1647,8 @@
}
}
-void X86Assembler::Copy(FrameOffset dest, ManagedRegister src_base, Offset src_offset,
- ManagedRegister scratch, size_t size) {
+void X86Assembler::Copy(FrameOffset /*dst*/, ManagedRegister /*src_base*/, Offset /*src_offset*/,
+ ManagedRegister /*scratch*/, size_t /*size*/) {
UNIMPLEMENTED(FATAL);
}
@@ -1752,11 +1752,11 @@
Bind(&null_arg);
}
-void X86Assembler::VerifyObject(ManagedRegister src, bool could_be_null) {
+void X86Assembler::VerifyObject(ManagedRegister /*src*/, bool /*could_be_null*/) {
// TODO: not validating references
}
-void X86Assembler::VerifyObject(FrameOffset src, bool could_be_null) {
+void X86Assembler::VerifyObject(FrameOffset /*src*/, bool /*could_be_null*/) {
// TODO: not validating references
}
@@ -1773,7 +1773,7 @@
call(Address(scratch, offset));
}
-void X86Assembler::Call(ThreadOffset offset, ManagedRegister mscratch) {
+void X86Assembler::Call(ThreadOffset offset, ManagedRegister /*mscratch*/) {
fs()->call(Address::Absolute(offset));
}
@@ -1789,7 +1789,7 @@
movl(Address(ESP, offset), scratch.AsCpuRegister());
}
-void X86Assembler::SuspendPoll(ManagedRegister scratch,
+void X86Assembler::SuspendPoll(ManagedRegister /*scratch*/,
ManagedRegister return_reg,
FrameOffset return_save_location,
size_t return_size) {
@@ -1819,7 +1819,7 @@
#undef __
}
-void X86Assembler::ExceptionPoll(ManagedRegister scratch) {
+void X86Assembler::ExceptionPoll(ManagedRegister /*scratch*/) {
X86ExceptionSlowPath* slow = new X86ExceptionSlowPath();
buffer_.EnqueueSlowPath(slow);
fs()->cmpl(Address::Absolute(Thread::ExceptionOffset()), Immediate(0));
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 7b8a02e..c1acab0 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1509,7 +1509,7 @@
DCHECK(!it.HasNext());
}
-void ClassLinker::LoadField(const DexFile& dex_file, const ClassDataItemIterator& it,
+void ClassLinker::LoadField(const DexFile& /*dex_file*/, const ClassDataItemIterator& it,
SirtRef<Class>& klass, SirtRef<Field>& dst) {
uint32_t field_idx = it.GetMemberIndex();
dst->SetDexFieldIndex(field_idx);
@@ -1951,7 +1951,7 @@
}
}
#else
-static void CheckMethodsHaveGcMaps(Class* klass) {
+static void CheckMethodsHaveGcMaps(Class*) {
}
#endif
diff --git a/src/class_linker_test.cc b/src/class_linker_test.cc
index a6a58d6..f505d58 100644
--- a/src/class_linker_test.cc
+++ b/src/class_linker_test.cc
@@ -130,7 +130,7 @@
EXPECT_STREQ(kh.GetDescriptor(), "Ljava/io/Serializable;");
}
- void AssertMethod(Class* klass, Method* method) {
+ void AssertMethod(Method* method) {
MethodHelper mh(method);
EXPECT_TRUE(method != NULL);
EXPECT_TRUE(method->GetClass() != NULL);
@@ -226,14 +226,14 @@
for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
Method* method = klass->GetDirectMethod(i);
- AssertMethod(klass, method);
+ AssertMethod(method);
EXPECT_TRUE(method->IsDirect());
EXPECT_EQ(klass, method->GetDeclaringClass());
}
for (size_t i = 0; i < klass->NumVirtualMethods(); i++) {
Method* method = klass->GetVirtualMethod(i);
- AssertMethod(klass, method);
+ AssertMethod(method);
EXPECT_FALSE(method->IsDirect());
EXPECT_TRUE(method->GetDeclaringClass()->IsAssignableFrom(klass));
}
@@ -322,7 +322,7 @@
}
}
- static void TestRootVisitor(const Object* root, void* arg) {
+ static void TestRootVisitor(const Object* root, void*) {
EXPECT_TRUE(root != NULL);
}
};
diff --git a/src/dalvik_system_VMDebug.cc b/src/dalvik_system_VMDebug.cc
index 317cd3d..557a421 100644
--- a/src/dalvik_system_VMDebug.cc
+++ b/src/dalvik_system_VMDebug.cc
@@ -50,7 +50,7 @@
Runtime::Current()->SetStatsEnabled(false);
}
-static jint VMDebug_getAllocCount(JNIEnv* env, jclass, jint kind) {
+static jint VMDebug_getAllocCount(JNIEnv*, jclass, jint kind) {
return Runtime::Current()->GetStat(kind);
}
@@ -58,7 +58,7 @@
Runtime::Current()->ResetStats(kinds);
}
-static void VMDebug_startMethodTracingDdmsImpl(JNIEnv* env, jclass, jint bufferSize, jint flags) {
+static void VMDebug_startMethodTracingDdmsImpl(JNIEnv*, jclass, jint bufferSize, jint flags) {
Trace::Start("[DDMS]", -1, bufferSize, flags, true);
}
@@ -127,7 +127,7 @@
jniThrowException(env, "java/lang/UnsupportedOperationException", NULL);
}
-static void VMDebug_getInstructionCount(JNIEnv* env, jclass, jintArray javaCounts) {
+static void VMDebug_getInstructionCount(JNIEnv* env, jclass, jintArray /*javaCounts*/) {
jniThrowException(env, "java/lang/UnsupportedOperationException", NULL);
}
diff --git a/src/dalvik_system_VMRuntime.cc b/src/dalvik_system_VMRuntime.cc
index 3799bcf..ef11f4b 100644
--- a/src/dalvik_system_VMRuntime.cc
+++ b/src/dalvik_system_VMRuntime.cc
@@ -129,7 +129,7 @@
t->GetJniEnv()->SetCheckJniEnabled(false);
}
-static void VMRuntime_setTargetSdkVersion(JNIEnv* env, jobject, jint targetSdkVersion) {
+static void VMRuntime_setTargetSdkVersion(JNIEnv*, jobject, jint targetSdkVersion) {
// This is the target SDK version of the app we're about to run.
// Note that targetSdkVersion may be CUR_DEVELOPMENT (10000).
// Note that targetSdkVersion may be 0, meaning "current".
@@ -150,7 +150,7 @@
}
}
-static void VMRuntime_trimHeap(JNIEnv* env, jobject) {
+static void VMRuntime_trimHeap(JNIEnv*, jobject) {
ScopedHeapLock heap_lock;
Heap* heap = Runtime::Current()->GetHeap();
size_t alloc_space_size = heap->GetAllocSpace()->Size();
diff --git a/src/dalvik_system_Zygote.cc b/src/dalvik_system_Zygote.cc
index 3ba5552..3f44109 100644
--- a/src/dalvik_system_Zygote.cc
+++ b/src/dalvik_system_Zygote.cc
@@ -52,7 +52,7 @@
}
// This signal handler is for zygote mode, since the zygote must reap its children
-static void SigChldHandler(int s) {
+static void SigChldHandler(int /*signal_number*/) {
pid_t pid;
int status;
@@ -175,7 +175,7 @@
return 0;
}
-static void SetCapabilities(int64_t permitted, int64_t effective) {
+static void SetCapabilities(int64_t __attribute__((unused)) permitted, int64_t __attribute__((unused)) effective) {
#ifdef HAVE_ANDROID_OS
struct __user_cap_header_struct capheader;
struct __user_cap_data_struct capdata;
diff --git a/src/debugger.cc b/src/debugger.cc
index 84dd055..78acf31 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -1262,8 +1262,10 @@
if (IsPrimitiveTag(tag)) {
if (tag == JDWP::JT_DOUBLE || tag == JDWP::JT_LONG) {
+ CHECK_EQ(width, 8);
f->Set64(o, value);
} else {
+ CHECK_LE(width, 4);
f->Set32(o, value);
}
} else {
@@ -1571,7 +1573,7 @@
*pThisId = gRegistry->Add(o);
}
-void Dbg::GetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, JDWP::JdwpTag tag, uint8_t* buf, size_t width) {
+void Dbg::GetLocalValue(JDWP::ObjectId /*threadId*/, JDWP::FrameId frameId, int slot, JDWP::JdwpTag tag, uint8_t* buf, size_t width) {
Method** sp = reinterpret_cast<Method**>(frameId);
Frame f(sp);
Method* m = f.GetMethod();
@@ -1668,7 +1670,7 @@
JDWP::Set1(buf, tag);
}
-void Dbg::SetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, JDWP::JdwpTag tag, uint64_t value, size_t width) {
+void Dbg::SetLocalValue(JDWP::ObjectId /*threadId*/, JDWP::FrameId frameId, int slot, JDWP::JdwpTag tag, uint64_t value, size_t width) {
Method** sp = reinterpret_cast<Method**>(frameId);
Frame f(sp);
Method* m = f.GetMethod();
@@ -2033,7 +2035,7 @@
return JDWP::ERR_NONE;
}
-void Dbg::UnconfigureStep(JDWP::ObjectId threadId) {
+void Dbg::UnconfigureStep(JDWP::ObjectId /*threadId*/) {
gSingleStepControl.is_active = false;
gSingleStepControl.thread = NULL;
gSingleStepControl.dex_pcs.clear();
@@ -2668,7 +2670,7 @@
pieceLenField_ = NULL;
}
- void HeapChunkCallback(void* start, void* end, size_t used_bytes) {
+ void HeapChunkCallback(void* start, void* /*end*/, size_t used_bytes) {
// Note: heap call backs cannot manipulate the heap upon which they are crawling, care is taken
// in the following code not to allocate memory, by ensuring buf_ is of the correct size
diff --git a/src/dex_file.cc b/src/dex_file.cc
index 850415e..d3e1c68 100644
--- a/src/dex_file.cc
+++ b/src/dex_file.cc
@@ -143,7 +143,7 @@
return NULL;
}
- if (!DexFileVerifier::Verify(dex_file, dex_file->Begin(), dex_file->Size())) {
+ if (verify && !DexFileVerifier::Verify(dex_file, dex_file->Begin(), dex_file->Size())) {
LOG(ERROR) << "Failed to verify dex file '" << filename << "'";
return NULL;
}
diff --git a/src/dex_verifier_test.cc b/src/dex_verifier_test.cc
index 9106b76..fba1d34 100644
--- a/src/dex_verifier_test.cc
+++ b/src/dex_verifier_test.cc
@@ -28,7 +28,7 @@
class DexVerifierTest : public CommonTest {
protected:
- void VerifyClass(ClassLoader* class_loader, const std::string& descriptor) {
+ void VerifyClass(const std::string& descriptor) {
ASSERT_TRUE(descriptor != NULL);
Class* klass = class_linker_->FindSystemClass(descriptor.c_str());
@@ -37,20 +37,20 @@
ASSERT_TRUE(DexVerifier::VerifyClass(klass, error_msg)) << error_msg;
}
- void VerifyDexFile(const DexFile* dex, ClassLoader* class_loader) {
+ void VerifyDexFile(const DexFile* dex) {
ASSERT_TRUE(dex != NULL);
// Verify all the classes defined in this file
for (size_t i = 0; i < dex->NumClassDefs(); i++) {
const DexFile::ClassDef& class_def = dex->GetClassDef(i);
const char* descriptor = dex->GetClassDescriptor(class_def);
- VerifyClass(class_loader, descriptor);
+ VerifyClass(descriptor);
}
}
};
TEST_F(DexVerifierTest, LibCore) {
- VerifyDexFile(java_lang_dex_file_, NULL);
+ VerifyDexFile(java_lang_dex_file_);
}
TEST_F(DexVerifierTest, IntMath) {
diff --git a/src/heap.h b/src/heap.h
index 374fa84..be8c62a 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -62,9 +62,9 @@
// Check sanity of given reference. Requires the heap lock.
#if VERIFY_OBJECT_ENABLED
- void VerifyObject(const Object *obj);
+ void VerifyObject(const Object* o);
#else
- void VerifyObject(const Object *obj) {}
+ void VerifyObject(const Object*) {}
#endif
// Check sanity of all live references. Requires the heap lock.
@@ -182,16 +182,16 @@
// Must be called if a field of an Object in the heap changes, and before any GC safe-point.
// The call is not needed if NULL is stored in the field.
- void WriteBarrierField(const Object* dest, MemberOffset offset, const Object* new_val) {
+ void WriteBarrierField(const Object* dst, MemberOffset /*offset*/, const Object* /*new_value*/) {
if (!card_marking_disabled_) {
- card_table_->MarkCard(dest);
+ card_table_->MarkCard(dst);
}
}
// Write barrier for array operations that update many field positions
- void WriteBarrierArray(const Object* dest, int pos, size_t len) {
+ void WriteBarrierArray(const Object* dst, int /*start_offset*/, size_t /*length TODO: element_count or byte_count?*/) {
if (UNLIKELY(!card_marking_disabled_)) {
- card_table_->MarkCard(dest);
+ card_table_->MarkCard(dst);
}
}
diff --git a/src/hprof/hprof.cc b/src/hprof/hprof.cc
index 6de9c64..04e43d2 100644
--- a/src/hprof/hprof.cc
+++ b/src/hprof/hprof.cc
@@ -278,7 +278,7 @@
return err;
}
-int Hprof::StackTraceSerialNumber(const void *obj) {
+int Hprof::StackTraceSerialNumber(const void* /*obj*/) {
return HPROF_NULL_STACK_TRACE;
}
diff --git a/src/image_writer.cc b/src/image_writer.cc
index cc37e5b..40f5d5f 100644
--- a/src/image_writer.cc
+++ b/src/image_writer.cc
@@ -113,8 +113,8 @@
}
-bool ImageWriter::ComputeLazyFieldsForClassesVisitor(Class* klass, void* arg) {
- klass->ComputeName();
+bool ImageWriter::ComputeLazyFieldsForClassesVisitor(Class* c, void* /*arg*/) {
+ c->ComputeName();
return true;
}
diff --git a/src/indirect_reference_table.h b/src/indirect_reference_table.h
index 78617f8..cdf2f8b 100644
--- a/src/indirect_reference_table.h
+++ b/src/indirect_reference_table.h
@@ -341,7 +341,7 @@
* The object pointer itself is subject to relocation in some GC
* implementations, so we shouldn't really be using it here.
*/
- IndirectRef ToIndirectRef(const Object* obj, uint32_t tableIndex) const {
+ IndirectRef ToIndirectRef(const Object* /*o*/, uint32_t tableIndex) const {
DCHECK_LT(tableIndex, 65536U);
uint32_t serialChunk = slot_data_[tableIndex].serial;
uint32_t uref = serialChunk << 20 | (tableIndex << 2) | kind_;
diff --git a/src/java_lang_Runtime.cc b/src/java_lang_Runtime.cc
index a057d36..44703b7 100644
--- a/src/java_lang_Runtime.cc
+++ b/src/java_lang_Runtime.cc
@@ -32,7 +32,7 @@
Runtime::Current()->GetHeap()->CollectGarbage(false);
}
-static void Runtime_nativeExit(JNIEnv* env, jclass, jint status, jboolean isExit) {
+static void Runtime_nativeExit(JNIEnv*, jclass, jint status, jboolean isExit) {
// isExit is true for System.exit and false for System.halt.
if (isExit) {
Runtime::Current()->CallExitHook(status);
@@ -64,15 +64,15 @@
return env->NewStringUTF(detail.c_str());
}
-static jlong Runtime_maxMemory(JNIEnv* env, jclass) {
+static jlong Runtime_maxMemory(JNIEnv*, jclass) {
return Runtime::Current()->GetHeap()->GetMaxMemory();
}
-static jlong Runtime_totalMemory(JNIEnv* env, jclass) {
+static jlong Runtime_totalMemory(JNIEnv*, jclass) {
return Runtime::Current()->GetHeap()->GetTotalMemory();
}
-static jlong Runtime_freeMemory(JNIEnv* env, jclass) {
+static jlong Runtime_freeMemory(JNIEnv*, jclass) {
return Runtime::Current()->GetHeap()->GetFreeMemory();
}
diff --git a/src/java_lang_Thread.cc b/src/java_lang_Thread.cc
index 0871bdd..52c5378 100644
--- a/src/java_lang_Thread.cc
+++ b/src/java_lang_Thread.cc
@@ -30,7 +30,7 @@
return AddLocalReference<jobject>(env, Thread::Current()->GetPeer());
}
-static jboolean Thread_interrupted(JNIEnv* env, jclass) {
+static jboolean Thread_interrupted(JNIEnv*, jclass) {
return Thread::Current()->Interrupted();
}
diff --git a/src/java_lang_VMClassLoader.cc b/src/java_lang_VMClassLoader.cc
index 1bb2e63..3d96c47 100644
--- a/src/java_lang_VMClassLoader.cc
+++ b/src/java_lang_VMClassLoader.cc
@@ -41,7 +41,7 @@
}
}
-static jint VMClassLoader_getBootClassPathSize(JNIEnv* env, jclass) {
+static jint VMClassLoader_getBootClassPathSize(JNIEnv*, jclass) {
return Runtime::Current()->GetClassLinker()->GetBootClassPath().size();
}
diff --git a/src/jdwp/jdwp_adb.cc b/src/jdwp/jdwp_adb.cc
index eb49bce..ae45f18 100644
--- a/src/jdwp/jdwp_adb.cc
+++ b/src/jdwp/jdwp_adb.cc
@@ -294,7 +294,7 @@
/*
* Connect out to a debugger (for server=n). Not required.
*/
-static bool establishConnection(JdwpState* state) {
+static bool establishConnection(JdwpState*) {
return false;
}
diff --git a/src/jdwp/jdwp_handler.cc b/src/jdwp/jdwp_handler.cc
index 9fb8ad0..804f683 100644
--- a/src/jdwp/jdwp_handler.cc
+++ b/src/jdwp/jdwp_handler.cc
@@ -99,8 +99,8 @@
* If "is_constructor" is set, this returns "objectId" rather than the
* expected-to-be-void return value of the called function.
*/
-static JdwpError finishInvoke(JdwpState* state,
- const uint8_t* buf, int dataLen, ExpandBuf* pReply,
+static JdwpError finishInvoke(JdwpState*,
+ const uint8_t* buf, int, ExpandBuf* pReply,
ObjectId threadId, ObjectId objectId, RefTypeId classId, MethodId methodId,
bool is_constructor)
{
@@ -167,7 +167,7 @@
/*
* Request for version info.
*/
-static JdwpError handleVM_Version(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_Version(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
/* text information on runtime version */
std::string version(StringPrintf("Android Runtime %s", Runtime::Current()->GetVersion()));
expandBufAddUtf8String(pReply, version);
@@ -187,7 +187,7 @@
* referenceTypeID. We need to send back more than one if the class has
* been loaded by multiple class loaders.
*/
-static JdwpError handleVM_ClassesBySignature(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_ClassesBySignature(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
std::string classDescriptor(ReadNewUtf8String(&buf));
VLOG(jdwp) << " Req for class by signature '" << classDescriptor << "'";
@@ -219,7 +219,7 @@
* We exclude ourselves from the list, because we don't allow ourselves
* to be suspended, and that violates some JDWP expectations.
*/
-static JdwpError handleVM_AllThreads(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_AllThreads(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
ObjectId* pThreadIds;
uint32_t threadCount;
Dbg::GetAllThreads(&pThreadIds, &threadCount);
@@ -239,7 +239,7 @@
/*
* List all thread groups that do not have a parent.
*/
-static JdwpError handleVM_TopLevelThreadGroups(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_TopLevelThreadGroups(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
/*
* TODO: maintain a list of parentless thread groups in the VM.
*
@@ -261,7 +261,7 @@
*
* All IDs are 8 bytes.
*/
-static JdwpError handleVM_IDSizes(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_IDSizes(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
expandBufAdd4BE(pReply, sizeof(FieldId));
expandBufAdd4BE(pReply, sizeof(MethodId));
expandBufAdd4BE(pReply, sizeof(ObjectId));
@@ -270,7 +270,7 @@
return ERR_NONE;
}
-static JdwpError handleVM_Dispose(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_Dispose(JdwpState*, const uint8_t*, int, ExpandBuf*) {
Dbg::Disposed();
return ERR_NONE;
}
@@ -281,7 +281,7 @@
*
* This needs to increment the "suspend count" on all threads.
*/
-static JdwpError handleVM_Suspend(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_Suspend(JdwpState*, const uint8_t*, int, ExpandBuf*) {
Dbg::SuspendVM();
return ERR_NONE;
}
@@ -289,7 +289,7 @@
/*
* Resume execution. Decrements the "suspend count" of all threads.
*/
-static JdwpError handleVM_Resume(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_Resume(JdwpState*, const uint8_t*, int, ExpandBuf*) {
Dbg::ResumeVM();
return ERR_NONE;
}
@@ -297,7 +297,7 @@
/*
* The debugger wants the entire VM to exit.
*/
-static JdwpError handleVM_Exit(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_Exit(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
uint32_t exitCode = Get4BE(buf);
LOG(WARNING) << "Debugger is telling the VM to exit with code=" << exitCode;
@@ -312,7 +312,7 @@
* (Ctrl-Shift-I in Eclipse on an array of objects causes it to create the
* string "java.util.Arrays".)
*/
-static JdwpError handleVM_CreateString(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_CreateString(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
std::string str(ReadNewUtf8String(&buf));
VLOG(jdwp) << " Req to create string '" << str << "'";
ObjectId stringId = Dbg::CreateString(str);
@@ -326,7 +326,7 @@
/*
* Tell the debugger what we are capable of.
*/
-static JdwpError handleVM_Capabilities(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_Capabilities(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
expandBufAdd1(pReply, false); /* canWatchFieldModification */
expandBufAdd1(pReply, false); /* canWatchFieldAccess */
expandBufAdd1(pReply, false); /* canGetBytecodes */
@@ -337,7 +337,7 @@
return ERR_NONE;
}
-static JdwpError handleVM_ClassPaths(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_ClassPaths(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
expandBufAddUtf8String(pReply, "/");
std::vector<std::string> class_path;
@@ -362,14 +362,14 @@
*
* Currently does nothing.
*/
-static JdwpError HandleVM_DisposeObjects(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError HandleVM_DisposeObjects(JdwpState*, const uint8_t*, int, ExpandBuf*) {
return ERR_NONE;
}
/*
* Tell the debugger what we are capable of.
*/
-static JdwpError handleVM_CapabilitiesNew(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleVM_CapabilitiesNew(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
expandBufAdd1(pReply, false); /* canWatchFieldModification */
expandBufAdd1(pReply, false); /* canWatchFieldAccess */
expandBufAdd1(pReply, false); /* canGetBytecodes */
@@ -399,7 +399,7 @@
return ERR_NONE;
}
-static JdwpError handleVM_AllClasses(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply, bool descriptor_and_status, bool generic) {
+static JdwpError handleVM_AllClasses(ExpandBuf* pReply, bool descriptor_and_status, bool generic) {
std::vector<JDWP::RefTypeId> classes;
Dbg::GetClassList(classes);
@@ -429,15 +429,15 @@
return ERR_NONE;
}
-static JdwpError handleVM_AllClasses(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
- return handleVM_AllClasses(state, buf, dataLen, pReply, true, false);
+static JdwpError handleVM_AllClasses(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
+ return handleVM_AllClasses(pReply, true, false);
}
-static JdwpError handleVM_AllClassesWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
- return handleVM_AllClasses(state, buf, dataLen, pReply, true, true);
+static JdwpError handleVM_AllClassesWithGeneric(JdwpState*, const uint8_t*, int, ExpandBuf* pReply) {
+ return handleVM_AllClasses(pReply, true, true);
}
-static JdwpError handleRT_Modifiers(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_Modifiers(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
return Dbg::GetModifiers(refTypeId, pReply);
}
@@ -445,7 +445,7 @@
/*
* Get values from static fields in a reference type.
*/
-static JdwpError handleRT_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_GetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
uint32_t field_count = Read4BE(&buf);
expandBufAdd4BE(pReply, field_count);
@@ -462,7 +462,7 @@
/*
* Get the name of the source file in which a reference type was declared.
*/
-static JdwpError handleRT_SourceFile(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_SourceFile(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
std::string source_file;
JdwpError status = Dbg::GetSourceFile(refTypeId, source_file);
@@ -476,7 +476,7 @@
/*
* Return the current status of the reference type.
*/
-static JdwpError handleRT_Status(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_Status(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
JDWP::JdwpTypeTag type_tag;
uint32_t class_status;
@@ -491,7 +491,7 @@
/*
* Return interfaces implemented directly by this class.
*/
-static JdwpError handleRT_Interfaces(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_Interfaces(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
VLOG(jdwp) << StringPrintf(" Req for interfaces in %#llx (%s)", refTypeId, Dbg::GetClassName(refTypeId).c_str());
return Dbg::OutputDeclaredInterfaces(refTypeId, pReply);
@@ -500,7 +500,7 @@
/*
* Return the class object corresponding to this type.
*/
-static JdwpError handleRT_ClassObject(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_ClassObject(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
ObjectId classObjectId;
JdwpError status = Dbg::GetClassObject(refTypeId, classObjectId);
@@ -517,12 +517,12 @@
*
* JDB seems interested, but DEX files don't currently support this.
*/
-static JdwpError handleRT_SourceDebugExtension(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_SourceDebugExtension(JdwpState*, const uint8_t*, int, ExpandBuf*) {
/* referenceTypeId in, string out */
return ERR_ABSENT_INFORMATION;
}
-static JdwpError handleRT_Signature(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply, bool with_generic) {
+static JdwpError handleRT_Signature(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply, bool with_generic) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
VLOG(jdwp) << StringPrintf(" Req for signature of refTypeId=%#llx", refTypeId);
@@ -551,7 +551,7 @@
* Return the instance of java.lang.ClassLoader that loaded the specified
* reference type, or null if it was loaded by the system loader.
*/
-static JdwpError handleRT_ClassLoader(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_ClassLoader(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
return Dbg::GetClassLoader(refTypeId, pReply);
}
@@ -566,14 +566,14 @@
* Given a referenceTypeId, return a block of stuff that describes the
* fields declared by a class.
*/
-static JdwpError handleRT_FieldsWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_FieldsWithGeneric(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
VLOG(jdwp) << " Req for fields in " << Describe(refTypeId);
return Dbg::OutputDeclaredFields(refTypeId, true, pReply);
}
// Obsolete equivalent of FieldsWithGeneric, without the generic type information.
-static JdwpError handleRT_Fields(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_Fields(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
VLOG(jdwp) << " Req for fields in " << Describe(refTypeId);
return Dbg::OutputDeclaredFields(refTypeId, false, pReply);
@@ -583,14 +583,14 @@
* Given a referenceTypeID, return a block of goodies describing the
* methods declared by a class.
*/
-static JdwpError handleRT_MethodsWithGeneric(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_MethodsWithGeneric(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
VLOG(jdwp) << " Req for methods in " << Describe(refTypeId);
return Dbg::OutputDeclaredMethods(refTypeId, true, pReply);
}
// Obsolete equivalent of MethodsWithGeneric, without the generic type information.
-static JdwpError handleRT_Methods(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleRT_Methods(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
VLOG(jdwp) << " Req for methods in " << Describe(refTypeId);
return Dbg::OutputDeclaredMethods(refTypeId, false, pReply);
@@ -599,7 +599,7 @@
/*
* Return the immediate superclass of a class.
*/
-static JdwpError handleCT_Superclass(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleCT_Superclass(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId classId = ReadRefTypeId(&buf);
RefTypeId superClassId;
JdwpError status = Dbg::GetSuperclass(classId, superClassId);
@@ -613,7 +613,7 @@
/*
* Set static class values.
*/
-static JdwpError handleCT_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleCT_SetValues(JdwpState* , const uint8_t* buf, int, ExpandBuf*) {
RefTypeId classId = ReadRefTypeId(&buf);
uint32_t values = Read4BE(&buf);
@@ -676,7 +676,7 @@
/*
* Create a new array object of the requested type and length.
*/
-static JdwpError handleAT_newInstance(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleAT_newInstance(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId arrayTypeId = ReadRefTypeId(&buf);
uint32_t length = Read4BE(&buf);
@@ -697,7 +697,7 @@
/*
* Return line number information for the method, if present.
*/
-static JdwpError handleM_LineTable(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleM_LineTable(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId refTypeId = ReadRefTypeId(&buf);
MethodId methodId = ReadMethodId(&buf);
@@ -708,7 +708,7 @@
return ERR_NONE;
}
-static JdwpError handleM_VariableTable(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply, bool generic) {
+static JdwpError handleM_VariableTable(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply, bool generic) {
RefTypeId classId = ReadRefTypeId(&buf);
MethodId methodId = ReadMethodId(&buf);
@@ -737,7 +737,7 @@
* This can get called on different things, e.g. threadId gets
* passed in here.
*/
-static JdwpError handleOR_ReferenceType(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleOR_ReferenceType(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId objectId = ReadObjectId(&buf);
VLOG(jdwp) << StringPrintf(" Req for type of objectId=%#llx", objectId);
return Dbg::GetReferenceType(objectId, pReply);
@@ -746,7 +746,7 @@
/*
* Get values from the fields of an object.
*/
-static JdwpError handleOR_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleOR_GetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId objectId = ReadObjectId(&buf);
uint32_t field_count = Read4BE(&buf);
@@ -768,7 +768,7 @@
/*
* Set values in the fields of an object.
*/
-static JdwpError handleOR_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleOR_SetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
ObjectId objectId = ReadObjectId(&buf);
uint32_t field_count = Read4BE(&buf);
@@ -814,7 +814,7 @@
/*
* Disable garbage collection of the specified object.
*/
-static JdwpError handleOR_DisableCollection(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleOR_DisableCollection(JdwpState*, const uint8_t*, int, ExpandBuf*) {
// this is currently a no-op
return ERR_NONE;
}
@@ -822,7 +822,7 @@
/*
* Enable garbage collection of the specified object.
*/
-static JdwpError handleOR_EnableCollection(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleOR_EnableCollection(JdwpState*, const uint8_t*, int, ExpandBuf*) {
// this is currently a no-op
return ERR_NONE;
}
@@ -830,7 +830,7 @@
/*
* Determine whether an object has been garbage collected.
*/
-static JdwpError handleOR_IsCollected(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleOR_IsCollected(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId objectId;
objectId = ReadObjectId(&buf);
@@ -845,7 +845,7 @@
/*
* Return the string value in a string object.
*/
-static JdwpError handleSR_Value(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleSR_Value(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId stringObject = ReadObjectId(&buf);
std::string str(Dbg::StringToUtf8(stringObject));
@@ -859,7 +859,7 @@
/*
* Return a thread's name.
*/
-static JdwpError handleTR_Name(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_Name(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
VLOG(jdwp) << StringPrintf(" Req for name of thread %#llx", threadId);
@@ -879,7 +879,7 @@
* It's supposed to remain suspended even if interpreted code wants to
* resume it; only the JDI is allowed to resume it.
*/
-static JdwpError handleTR_Suspend(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_Suspend(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
ObjectId threadId = ReadObjectId(&buf);
if (threadId == Dbg::GetThreadSelfId()) {
@@ -894,7 +894,7 @@
/*
* Resume the specified thread.
*/
-static JdwpError handleTR_Resume(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_Resume(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
ObjectId threadId = ReadObjectId(&buf);
if (threadId == Dbg::GetThreadSelfId()) {
@@ -909,7 +909,7 @@
/*
* Return status of specified thread.
*/
-static JdwpError handleTR_Status(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_Status(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
VLOG(jdwp) << StringPrintf(" Req for status of thread %#llx", threadId);
@@ -931,7 +931,7 @@
/*
* Return the thread group that the specified thread is a member of.
*/
-static JdwpError handleTR_ThreadGroup(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_ThreadGroup(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
return Dbg::GetThreadGroup(threadId, pReply);
}
@@ -942,7 +942,7 @@
* If the thread isn't suspended, the error code isn't defined, but should
* be THREAD_NOT_SUSPENDED.
*/
-static JdwpError handleTR_Frames(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_Frames(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
uint32_t start_frame = Read4BE(&buf);
uint32_t length = Read4BE(&buf);
@@ -992,7 +992,7 @@
/*
* Returns the #of frames on the specified thread, which must be suspended.
*/
-static JdwpError handleTR_FrameCount(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_FrameCount(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
if (!Dbg::ThreadExists(threadId)) {
@@ -1015,7 +1015,7 @@
/*
* Get the monitor that the thread is waiting on.
*/
-static JdwpError handleTR_CurrentContendedMonitor(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_CurrentContendedMonitor(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
ObjectId threadId;
threadId = ReadObjectId(&buf);
@@ -1032,7 +1032,7 @@
* (The thread *might* still be running -- it might not have examined
* its suspend count recently.)
*/
-static JdwpError handleTR_SuspendCount(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTR_SuspendCount(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
return Dbg::GetThreadSuspendCount(threadId, pReply);
}
@@ -1042,7 +1042,7 @@
*
* The Eclipse debugger recognizes "main" and "system" as special.
*/
-static JdwpError handleTGR_Name(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTGR_Name(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadGroupId = ReadObjectId(&buf);
VLOG(jdwp) << StringPrintf(" Req for name of threadGroupId=%#llx", threadGroupId);
@@ -1055,7 +1055,7 @@
* Returns the thread group -- if any -- that contains the specified
* thread group.
*/
-static JdwpError handleTGR_Parent(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTGR_Parent(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId groupId = ReadObjectId(&buf);
ObjectId parentGroup = Dbg::GetThreadGroupParent(groupId);
@@ -1068,7 +1068,7 @@
* Return the active threads and thread groups that are part of the
* specified thread group.
*/
-static JdwpError handleTGR_Children(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleTGR_Children(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadGroupId = ReadObjectId(&buf);
VLOG(jdwp) << StringPrintf(" Req for threads in threadGroupId=%#llx", threadGroupId);
@@ -1101,7 +1101,7 @@
/*
* Return the #of components in the array.
*/
-static JdwpError handleAR_Length(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleAR_Length(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId arrayId = ReadObjectId(&buf);
VLOG(jdwp) << StringPrintf(" Req for length of array %#llx", arrayId);
@@ -1120,7 +1120,7 @@
/*
* Return the values from an array.
*/
-static JdwpError handleAR_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleAR_GetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId arrayId = ReadObjectId(&buf);
uint32_t firstIndex = Read4BE(&buf);
uint32_t length = Read4BE(&buf);
@@ -1132,7 +1132,7 @@
/*
* Set values in an array.
*/
-static JdwpError handleAR_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleAR_SetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
ObjectId arrayId = ReadObjectId(&buf);
uint32_t firstIndex = Read4BE(&buf);
uint32_t values = Read4BE(&buf);
@@ -1142,13 +1142,13 @@
return Dbg::SetArrayElements(arrayId, firstIndex, values, buf);
}
-static JdwpError handleCLR_VisibleClasses(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleCLR_VisibleClasses(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId classLoaderObject;
classLoaderObject = ReadObjectId(&buf);
// TODO: we should only return classes which have the given class loader as a defining or
// initiating loader. The former would be easy; the latter is hard, because we don't have
// any such notion.
- return handleVM_AllClasses(state, buf, dataLen, pReply, false, false);
+ return handleVM_AllClasses(pReply, false, false);
}
/*
@@ -1325,7 +1325,7 @@
* Clear an event. Failure to find an event with a matching ID is a no-op
* and does not return an error.
*/
-static JdwpError handleER_Clear(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleER_Clear(JdwpState* state, const uint8_t* buf, int, ExpandBuf*) {
uint8_t eventKind;
eventKind = Read1(&buf);
uint32_t requestId = Read4BE(&buf);
@@ -1340,7 +1340,7 @@
/*
* Return the values of arguments and local variables.
*/
-static JdwpError handleSF_GetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleSF_GetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ObjectId threadId = ReadObjectId(&buf);
FrameId frameId = ReadFrameId(&buf);
uint32_t slots = Read4BE(&buf);
@@ -1365,7 +1365,7 @@
/*
* Set the values of arguments and local variables.
*/
-static JdwpError handleSF_SetValues(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleSF_SetValues(JdwpState*, const uint8_t* buf, int, ExpandBuf*) {
ObjectId threadId = ReadObjectId(&buf);
FrameId frameId = ReadFrameId(&buf);
uint32_t slots = Read4BE(&buf);
@@ -1388,7 +1388,7 @@
/*
* Returns the value of "this" for the specified frame.
*/
-static JdwpError handleSF_ThisObject(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleSF_ThisObject(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
ReadObjectId(&buf); // Skip thread id.
FrameId frameId = ReadFrameId(&buf);
@@ -1411,7 +1411,7 @@
* reused, whereas ClassIds can be recycled like any other object. (Either
* that, or I have no idea what this is for.)
*/
-static JdwpError handleCOR_ReflectedType(JdwpState* state, const uint8_t* buf, int dataLen, ExpandBuf* pReply) {
+static JdwpError handleCOR_ReflectedType(JdwpState*, const uint8_t* buf, int, ExpandBuf* pReply) {
RefTypeId classObjectId = ReadRefTypeId(&buf);
VLOG(jdwp) << StringPrintf(" Req for refTypeId for class=%#llx (%s)", classObjectId, Dbg::GetClassName(classObjectId).c_str());
return Dbg::GetReflectedType(classObjectId, pReply);
diff --git a/src/jni_compiler_test.cc b/src/jni_compiler_test.cc
index 3bf3bb4..fd81457 100644
--- a/src/jni_compiler_test.cc
+++ b/src/jni_compiler_test.cc
@@ -29,13 +29,11 @@
#include "scoped_jni_thread_state.h"
#include "thread.h"
-extern "C"
-JNIEXPORT jint JNICALL Java_MyClass_bar(JNIEnv* env, jobject thisObj, jint count) {
+extern "C" JNIEXPORT jint JNICALL Java_MyClass_bar(JNIEnv*, jobject, jint count) {
return count + 1;
}
-extern "C"
-JNIEXPORT jint JNICALL Java_MyClass_sbar(JNIEnv* env, jclass myClass, jint count) {
+extern "C" JNIEXPORT jint JNICALL Java_MyClass_sbar(JNIEnv*, jclass, jint count) {
return count + 1;
}
@@ -556,7 +554,7 @@
EXPECT_EQ(10+9+8+7+6+5+4+3+2+1, result);
}
-jobject Java_MyClass_fooO(JNIEnv* env, jobject thisObj, jobject x) {
+jobject Java_MyClass_fooO(JNIEnv* env, jobject, jobject x) {
return env->NewGlobalRef(x);
}
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index 7d273ac..5230de9 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -544,10 +544,10 @@
}
/*
- * Check the result of an earlier call to JNI_OnLoad on this library. If
- * the call has not yet finished in another thread, wait for it.
+ * Check the result of an earlier call to JNI_OnLoad on this library.
+ * If the call has not yet finished in another thread, wait for it.
*/
- bool CheckOnLoadResult(JavaVMExt* vm) {
+ bool CheckOnLoadResult() {
Thread* self = Thread::Current();
if (jni_on_load_thread_id_ == self->GetThinLockId()) {
// Check this so we don't end up waiting for ourselves. We need
@@ -1240,8 +1240,7 @@
InvokeVirtualOrInterfaceWithJValues(env, obj, mid, args);
}
- static jobject CallNonvirtualObjectMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jobject CallNonvirtualObjectMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1252,21 +1251,21 @@
}
static jobject CallNonvirtualObjectMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
JValue result = InvokeWithVarArgs(env, obj, mid, args);
return AddLocalReference<jobject>(env, result.l);
}
static jobject CallNonvirtualObjectMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
JValue result = InvokeWithJValues(env, obj, mid, args);
return AddLocalReference<jobject>(env, result.l);
}
static jboolean CallNonvirtualBooleanMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1276,19 +1275,18 @@
}
static jboolean CallNonvirtualBooleanMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).z;
}
static jboolean CallNonvirtualBooleanMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).z;
}
- static jbyte CallNonvirtualByteMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jbyte CallNonvirtualByteMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1298,19 +1296,18 @@
}
static jbyte CallNonvirtualByteMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).b;
}
static jbyte CallNonvirtualByteMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).b;
}
- static jchar CallNonvirtualCharMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jchar CallNonvirtualCharMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1320,19 +1317,18 @@
}
static jchar CallNonvirtualCharMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).c;
}
static jchar CallNonvirtualCharMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).c;
}
- static jshort CallNonvirtualShortMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jshort CallNonvirtualShortMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1342,18 +1338,18 @@
}
static jshort CallNonvirtualShortMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).s;
}
static jshort CallNonvirtualShortMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).s;
}
- static jint CallNonvirtualIntMethod(JNIEnv* env, jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jint CallNonvirtualIntMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1363,19 +1359,18 @@
}
static jint CallNonvirtualIntMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).i;
}
static jint CallNonvirtualIntMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).i;
}
- static jlong CallNonvirtualLongMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jlong CallNonvirtualLongMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1385,19 +1380,18 @@
}
static jlong CallNonvirtualLongMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).j;
}
static jlong CallNonvirtualLongMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).j;
}
- static jfloat CallNonvirtualFloatMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jfloat CallNonvirtualFloatMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1407,19 +1401,18 @@
}
static jfloat CallNonvirtualFloatMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).f;
}
static jfloat CallNonvirtualFloatMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).f;
}
- static jdouble CallNonvirtualDoubleMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static jdouble CallNonvirtualDoubleMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1429,19 +1422,18 @@
}
static jdouble CallNonvirtualDoubleMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, obj, mid, args).d;
}
static jdouble CallNonvirtualDoubleMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, obj, mid, args).d;
}
- static void CallNonvirtualVoidMethod(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, ...) {
+ static void CallNonvirtualVoidMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1450,13 +1442,13 @@
}
static void CallNonvirtualVoidMethodV(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, va_list args) {
+ jobject obj, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
InvokeWithVarArgs(env, obj, mid, args);
}
static void CallNonvirtualVoidMethodA(JNIEnv* env,
- jobject obj, jclass clazz, jmethodID mid, jvalue* args) {
+ jobject obj, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
InvokeWithJValues(env, obj, mid, args);
}
@@ -1544,35 +1536,35 @@
GET_PRIMITIVE_FIELD(GetDouble, obj);
}
- static jboolean GetStaticBooleanField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jboolean GetStaticBooleanField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetBoolean, NULL);
}
- static jbyte GetStaticByteField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jbyte GetStaticByteField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetByte, NULL);
}
- static jchar GetStaticCharField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jchar GetStaticCharField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetChar, NULL);
}
- static jshort GetStaticShortField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jshort GetStaticShortField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetShort, NULL);
}
- static jint GetStaticIntField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jint GetStaticIntField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetInt, NULL);
}
- static jlong GetStaticLongField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jlong GetStaticLongField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetLong, NULL);
}
- static jfloat GetStaticFloatField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jfloat GetStaticFloatField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetFloat, NULL);
}
- static jdouble GetStaticDoubleField(JNIEnv* env, jclass clazz, jfieldID fid) {
+ static jdouble GetStaticDoubleField(JNIEnv* env, jclass, jfieldID fid) {
GET_PRIMITIVE_FIELD(GetDouble, NULL);
}
@@ -1640,7 +1632,7 @@
SET_PRIMITIVE_FIELD(SetShort, NULL, v);
}
- static jobject CallStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jobject CallStaticObjectMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1650,19 +1642,19 @@
return local_result;
}
- static jobject CallStaticObjectMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jobject CallStaticObjectMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
JValue result = InvokeWithVarArgs(env, NULL, mid, args);
return AddLocalReference<jobject>(env, result.l);
}
- static jobject CallStaticObjectMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jobject CallStaticObjectMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
JValue result = InvokeWithJValues(env, NULL, mid, args);
return AddLocalReference<jobject>(env, result.l);
}
- static jboolean CallStaticBooleanMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jboolean CallStaticBooleanMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1671,17 +1663,17 @@
return result.z;
}
- static jboolean CallStaticBooleanMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jboolean CallStaticBooleanMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).z;
}
- static jboolean CallStaticBooleanMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jboolean CallStaticBooleanMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).z;
}
- static jbyte CallStaticByteMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jbyte CallStaticByteMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1690,17 +1682,17 @@
return result.b;
}
- static jbyte CallStaticByteMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jbyte CallStaticByteMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).b;
}
- static jbyte CallStaticByteMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jbyte CallStaticByteMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).b;
}
- static jchar CallStaticCharMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jchar CallStaticCharMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1709,17 +1701,17 @@
return result.c;
}
- static jchar CallStaticCharMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jchar CallStaticCharMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).c;
}
- static jchar CallStaticCharMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jchar CallStaticCharMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).c;
}
- static jshort CallStaticShortMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jshort CallStaticShortMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1728,17 +1720,17 @@
return result.s;
}
- static jshort CallStaticShortMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jshort CallStaticShortMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).s;
}
- static jshort CallStaticShortMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jshort CallStaticShortMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).s;
}
- static jint CallStaticIntMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jint CallStaticIntMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1747,17 +1739,17 @@
return result.i;
}
- static jint CallStaticIntMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jint CallStaticIntMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).i;
}
- static jint CallStaticIntMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jint CallStaticIntMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).i;
}
- static jlong CallStaticLongMethod(JNIEnv* env, jclass clazz, jmethodID mid, ...) {
+ static jlong CallStaticLongMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1766,17 +1758,17 @@
return result.j;
}
- static jlong CallStaticLongMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jlong CallStaticLongMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).j;
}
- static jlong CallStaticLongMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jlong CallStaticLongMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).j;
}
- static jfloat CallStaticFloatMethod(JNIEnv* env, jclass cls, jmethodID mid, ...) {
+ static jfloat CallStaticFloatMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1785,17 +1777,17 @@
return result.f;
}
- static jfloat CallStaticFloatMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jfloat CallStaticFloatMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).f;
}
- static jfloat CallStaticFloatMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jfloat CallStaticFloatMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).f;
}
- static jdouble CallStaticDoubleMethod(JNIEnv* env, jclass cls, jmethodID mid, ...) {
+ static jdouble CallStaticDoubleMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1804,17 +1796,17 @@
return result.d;
}
- static jdouble CallStaticDoubleMethodV(JNIEnv* env, jclass clazz, jmethodID mid, va_list args) {
+ static jdouble CallStaticDoubleMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
return InvokeWithVarArgs(env, NULL, mid, args).d;
}
- static jdouble CallStaticDoubleMethodA(JNIEnv* env, jclass clazz, jmethodID mid, jvalue* args) {
+ static jdouble CallStaticDoubleMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
return InvokeWithJValues(env, NULL, mid, args).d;
}
- static void CallStaticVoidMethod(JNIEnv* env, jclass cls, jmethodID mid, ...) {
+ static void CallStaticVoidMethod(JNIEnv* env, jclass, jmethodID mid, ...) {
ScopedJniThreadState ts(env);
va_list ap;
va_start(ap, mid);
@@ -1822,12 +1814,12 @@
va_end(ap);
}
- static void CallStaticVoidMethodV(JNIEnv* env, jclass cls, jmethodID mid, va_list args) {
+ static void CallStaticVoidMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args) {
ScopedJniThreadState ts(env);
InvokeWithVarArgs(env, NULL, mid, args);
}
- static void CallStaticVoidMethodA(JNIEnv* env, jclass cls, jmethodID mid, jvalue* args) {
+ static void CallStaticVoidMethodA(JNIEnv* env, jclass, jmethodID mid, jvalue* args) {
ScopedJniThreadState ts(env);
InvokeWithJValues(env, NULL, mid, args);
}
@@ -1890,7 +1882,7 @@
return chars->GetData() + s->GetOffset();
}
- static void ReleaseStringChars(JNIEnv* env, jstring java_string, const jchar* chars) {
+ static void ReleaseStringChars(JNIEnv* env, jstring java_string, const jchar*) {
ScopedJniThreadState ts(env);
UnpinPrimitiveArray(ts, Decode<String*>(ts, java_string)->GetCharArray());
}
@@ -2028,7 +2020,7 @@
return array->GetRawData(array->GetClass()->GetComponentSize());
}
- static void ReleasePrimitiveArrayCritical(JNIEnv* env, jarray array, void* data, jint mode) {
+ static void ReleasePrimitiveArrayCritical(JNIEnv* env, jarray array, void*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
@@ -2073,42 +2065,42 @@
return GetPrimitiveArray<jshortArray, jshort*, ShortArray>(ts, array, is_copy);
}
- static void ReleaseBooleanArrayElements(JNIEnv* env, jbooleanArray array, jboolean* data, jint mode) {
+ static void ReleaseBooleanArrayElements(JNIEnv* env, jbooleanArray array, jboolean*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseByteArrayElements(JNIEnv* env, jbyteArray array, jbyte* data, jint mode) {
+ static void ReleaseByteArrayElements(JNIEnv* env, jbyteArray array, jbyte*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseCharArrayElements(JNIEnv* env, jcharArray array, jchar* data, jint mode) {
+ static void ReleaseCharArrayElements(JNIEnv* env, jcharArray array, jchar*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseDoubleArrayElements(JNIEnv* env, jdoubleArray array, jdouble* data, jint mode) {
+ static void ReleaseDoubleArrayElements(JNIEnv* env, jdoubleArray array, jdouble*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseFloatArrayElements(JNIEnv* env, jfloatArray array, jfloat* data, jint mode) {
+ static void ReleaseFloatArrayElements(JNIEnv* env, jfloatArray array, jfloat*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseIntArrayElements(JNIEnv* env, jintArray array, jint* data, jint mode) {
+ static void ReleaseIntArrayElements(JNIEnv* env, jintArray array, jint*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseLongArrayElements(JNIEnv* env, jlongArray array, jlong* data, jint mode) {
+ static void ReleaseLongArrayElements(JNIEnv* env, jlongArray array, jlong*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
- static void ReleaseShortArrayElements(JNIEnv* env, jshortArray array, jshort* data, jint mode) {
+ static void ReleaseShortArrayElements(JNIEnv* env, jshortArray array, jshort*, jint mode) {
ScopedJniThreadState ts(env);
ReleasePrimitiveArray(ts, array, mode);
}
@@ -2617,7 +2609,8 @@
monitors.Dump();
}
-void JNIEnvExt::PushFrame(int capacity) {
+void JNIEnvExt::PushFrame(int /*capacity*/) {
+ // TODO: take 'capacity' into account.
stacked_local_ref_cookies.push_back(local_ref_cookie);
local_ref_cookie = locals.GetSegmentState();
}
@@ -2663,7 +2656,7 @@
}
// Historically unsupported.
-extern "C" jint JNI_GetDefaultJavaVMInitArgs(void* vm_args) {
+extern "C" jint JNI_GetDefaultJavaVMInitArgs(void* /*vm_args*/) {
return JNI_ERR;
}
@@ -2797,7 +2790,7 @@
}
VLOG(jni) << "[Shared library \"" << path << "\" already loaded in "
<< "ClassLoader " << class_loader << "]";
- if (!library->CheckOnLoadResult(this)) {
+ if (!library->CheckOnLoadResult()) {
StringAppendF(&detail, "JNI_OnLoad failed on a previous attempt "
"to load \"%s\"", path.c_str());
return false;
@@ -2854,7 +2847,7 @@
if (library != NULL) {
LOG(INFO) << "WOW: we lost a race to add shared library: "
<< "\"" << path << "\" ClassLoader=" << class_loader;
- return library->CheckOnLoadResult(this);
+ return library->CheckOnLoadResult();
}
library = new SharedLibrary(path, handle, class_loader);
libraries->Put(path, library);
diff --git a/src/mem_map.cc b/src/mem_map.cc
index 885389d..93f60c4 100644
--- a/src/mem_map.cc
+++ b/src/mem_map.cc
@@ -152,7 +152,7 @@
}
#else
-static void CheckMapRequest(byte* addr, size_t length) { }
+static void CheckMapRequest(byte*, size_t) { }
#endif
MemMap* MemMap::MapAnonymous(const char* name, byte* addr, size_t length, int prot) {
diff --git a/src/mutex.cc b/src/mutex.cc
index 340a075..01aeff4 100644
--- a/src/mutex.cc
+++ b/src/mutex.cc
@@ -27,7 +27,8 @@
namespace art {
-static inline void CheckSafeToLockOrUnlock(MutexRank rank, bool is_locking) {
+static inline void CheckSafeToLockOrUnlock(MutexRank __attribute__((unused)) rank,
+ bool __attribute__((unused)) is_locking) {
#ifndef NDEBUG
if (rank == -1) {
return;
@@ -39,7 +40,7 @@
#endif
}
-static inline void CheckSafeToWait(MutexRank rank) {
+static inline void CheckSafeToWait(MutexRank __attribute__((unused)) rank) {
#ifndef NDEBUG
Thread* self = Thread::Current();
if (self != NULL) {
diff --git a/src/oat_writer.cc b/src/oat_writer.cc
index 1ac247e..a1b0f9d 100644
--- a/src/oat_writer.cc
+++ b/src/oat_writer.cc
@@ -198,10 +198,12 @@
return offset;
}
-size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index, size_t class_def_index,
- size_t class_def_method_index, bool is_native, bool is_static,
- bool is_direct, uint32_t method_idx, const DexFile* dex_file) {
-
+size_t OatWriter::InitOatCodeMethod(size_t offset, size_t oat_class_index,
+ size_t __attribute__((unused)) class_def_index,
+ size_t class_def_method_index,
+ bool __attribute__((unused)) is_native,
+ bool is_static, bool is_direct,
+ uint32_t method_idx, const DexFile* dex_file) {
#if !defined(ART_USE_LLVM_COMPILER)
// derived from CompiledMethod if available
uint32_t code_offset = 0;
diff --git a/src/oatexec.cc b/src/oatexec.cc
index f4cf2f1..2de355b 100644
--- a/src/oatexec.cc
+++ b/src/oatexec.cc
@@ -56,7 +56,7 @@
return true;
}
-static int InvokeMain(JNIEnv* env, int argc, char** argv) {
+static int InvokeMain(JNIEnv* env, char** argv) {
// We want to call main() with a String array with our arguments in
// it. Create an array and populate it. Note argv[0] is not
// included.
@@ -171,7 +171,7 @@
return EXIT_FAILURE;
}
- int rc = InvokeMain(env, argc - arg_idx, &argv[arg_idx]);
+ int rc = InvokeMain(env, &argv[arg_idx]);
if (vm->DetachCurrentThread() != JNI_OK) {
fprintf(stderr, "Warning: unable to detach main thread\n");
diff --git a/src/object.h b/src/object.h
index ae435c6..0a670ee 100644
--- a/src/object.h
+++ b/src/object.h
@@ -2332,7 +2332,7 @@
return GetField32(OFFSET_OF_OBJECT_MEMBER(Method, method_dex_index_), false);
}
-inline void Method::AssertPcIsWithinCode(uintptr_t pc) const {
+inline void Method::AssertPcIsWithinCode(uintptr_t __attribute__((unused)) pc) const {
#ifndef NDEBUG
if (IsNative() || IsRuntimeMethod() || IsProxyMethod()) {
return;
diff --git a/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index 369abd4..88416af 100644
--- a/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/src/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -26,15 +26,15 @@
namespace art {
-static void DdmVmInternal_enableRecentAllocations(JNIEnv* env, jclass, jboolean enable) {
+static void DdmVmInternal_enableRecentAllocations(JNIEnv*, jclass, jboolean enable) {
Dbg::SetAllocTrackingEnabled(enable);
}
-static jbyteArray DdmVmInternal_getRecentAllocations(JNIEnv* env, jclass) {
+static jbyteArray DdmVmInternal_getRecentAllocations(JNIEnv*, jclass) {
return Dbg::GetRecentAllocations();
}
-static jboolean DdmVmInternal_getRecentAllocationStatus(JNIEnv* env, jclass) {
+static jboolean DdmVmInternal_getRecentAllocationStatus(JNIEnv*, jclass) {
return Dbg::IsAllocTrackingEnabled();
}
@@ -138,15 +138,15 @@
return result;
}
-static jint DdmVmInternal_heapInfoNotify(JNIEnv* env, jclass, jint when) {
+static jint DdmVmInternal_heapInfoNotify(JNIEnv*, jclass, jint when) {
return Dbg::DdmHandleHpifChunk(static_cast<Dbg::HpifWhen>(when));
}
-static jboolean DdmVmInternal_heapSegmentNotify(JNIEnv* env, jclass, jint when, jint what, jboolean native) {
+static jboolean DdmVmInternal_heapSegmentNotify(JNIEnv*, jclass, jint when, jint what, jboolean native) {
return Dbg::DdmHandleHpsgNhsgChunk(static_cast<Dbg::HpsgWhen>(when), static_cast<Dbg::HpsgWhat>(what), native);
}
-static void DdmVmInternal_threadNotify(JNIEnv* env, jclass, jboolean enable) {
+static void DdmVmInternal_threadNotify(JNIEnv*, jclass, jboolean enable) {
Dbg::DdmSetThreadNotification(enable);
}
diff --git a/src/reflection.cc b/src/reflection.cc
index 6aa239e..a90af0e 100644
--- a/src/reflection.cc
+++ b/src/reflection.cc
@@ -229,7 +229,7 @@
return false;
}
-void BoxPrimitive(JNIEnv* env, Primitive::Type src_class, JValue& value) {
+void BoxPrimitive(JNIEnv*, Primitive::Type src_class, JValue& value) {
if (src_class == Primitive::kPrimNot) {
return;
}
@@ -275,7 +275,7 @@
m->Invoke(self, NULL, args, &value);
}
-bool UnboxPrimitive(JNIEnv* env, Object* o, Class* dst_class, JValue& unboxed_value, const char* what) {
+bool UnboxPrimitive(JNIEnv*, Object* o, Class* dst_class, JValue& unboxed_value, const char* what) {
if (!dst_class->IsPrimitive()) {
if (o != NULL && !o->InstanceOf(dst_class)) {
Thread::Current()->ThrowNewExceptionF("Ljava/lang/IllegalArgumentException;",
diff --git a/src/runtime_linux.cc b/src/runtime_linux.cc
index d7b32ee..a604819 100644
--- a/src/runtime_linux.cc
+++ b/src/runtime_linux.cc
@@ -41,7 +41,7 @@
return mangled_name + "()";
}
-void Runtime::PlatformAbort(const char* file, int line) {
+void Runtime::PlatformAbort(const char* /*file*/, int /*line_number*/) {
// On the host, we don't have debuggerd to dump a stack for us.
// Get the raw stack frames.
diff --git a/src/runtime_support.cc b/src/runtime_support.cc
index 1828985..230c24f 100644
--- a/src/runtime_support.cc
+++ b/src/runtime_support.cc
@@ -208,7 +208,7 @@
thread->DeliverException();
}
-extern "C" void artThrowStackOverflowFromCode(Method* method, Thread* thread, Method** sp) {
+extern "C" void artThrowStackOverflowFromCode(Method* /*method*/, Thread* thread, Method** sp) {
FinishCalleeSaveFrameSetup(thread, sp, Runtime::kSaveAll);
// Remove extra entry pushed onto second stack during method tracing
if (Runtime::Current()->IsMethodTracingActive()) {
diff --git a/src/space.cc b/src/space.cc
index 78fcdf5..cb8746f 100644
--- a/src/space.cc
+++ b/src/space.cc
@@ -237,7 +237,7 @@
// Call back from mspace_inspect_all returning the start and end of chunks and the bytes used,
// if used_bytes is 0 then it indicates the range isn't in use and we madvise to the system that
// we don't need it
-static void DontNeed(void* start, void* end, size_t used_bytes, void* num_bytes) {
+static void DontNeed(void* start, void* end, size_t used_bytes, void* /*num_bytes*/) {
if (used_bytes == 0) {
start = reinterpret_cast<void*>(RoundUp((uintptr_t)start, kPageSize));
end = reinterpret_cast<void*>(RoundDown((uintptr_t)end, kPageSize));
diff --git a/src/thread.cc b/src/thread.cc
index 58ef1fe..d9de1cb 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -436,31 +436,6 @@
}
}
-std::string GetSchedulerGroup(pid_t tid) {
- // /proc/<pid>/group looks like this:
- // 2:devices:/
- // 1:cpuacct,cpu:/
- // We want the third field from the line whose second field contains the "cpu" token.
- std::string cgroup_file;
- if (!ReadFileToString("/proc/self/cgroup", &cgroup_file)) {
- return "";
- }
- std::vector<std::string> cgroup_lines;
- Split(cgroup_file, '\n', cgroup_lines);
- for (size_t i = 0; i < cgroup_lines.size(); ++i) {
- std::vector<std::string> cgroup_fields;
- Split(cgroup_lines[i], ':', cgroup_fields);
- std::vector<std::string> cgroups;
- Split(cgroup_fields[1], ',', cgroups);
- for (size_t i = 0; i < cgroups.size(); ++i) {
- if (cgroups[i] == "cpu") {
- return cgroup_fields[2].substr(1); // Skip the leading slash.
- }
- }
- }
- return "";
-}
-
String* Thread::GetThreadName() const {
return (peer_ != NULL) ? reinterpret_cast<String*>(gThread_name->GetObject(peer_)) : NULL;
}
@@ -491,9 +466,9 @@
sched_param sp;
CHECK_PTHREAD_CALL(pthread_getschedparam, (pthread_self(), &policy, &sp), __FUNCTION__);
- std::string scheduler_group(GetSchedulerGroup(GetTid()));
- if (scheduler_group.empty()) {
- scheduler_group = "default";
+ std::string scheduler_group_name(GetSchedulerGroupName(GetTid()));
+ if (scheduler_group_name.empty()) {
+ scheduler_group_name = "default";
}
os << '"' << *name_ << '"';
@@ -512,7 +487,7 @@
os << " | sysTid=" << GetTid()
<< " nice=" << getpriority(PRIO_PROCESS, GetTid())
<< " sched=" << policy << "/" << sp.sched_priority
- << " cgrp=" << scheduler_group
+ << " cgrp=" << scheduler_group_name
<< " handle=" << pthread_self() << "\n";
// Grab the scheduler stats for this thread.
@@ -1068,7 +1043,7 @@
public:
CountStackDepthVisitor() : depth_(0), skip_depth_(0), skipping_(true) {}
- bool VisitFrame(const Frame& frame, uintptr_t pc) {
+ bool VisitFrame(const Frame& frame, uintptr_t /*pc*/) {
// We want to skip frames up to and including the exception's constructor.
// Note we also skip the frame if it doesn't have a method (namely the callee
// save frame)
diff --git a/src/thread_linux.cc b/src/thread_linux.cc
index 9578228..50db13c 100644
--- a/src/thread_linux.cc
+++ b/src/thread_linux.cc
@@ -18,7 +18,7 @@
namespace art {
-void Thread::DumpNativeStack(std::ostream& os) const {
+void Thread::DumpNativeStack(std::ostream&) const {
// TODO: use glibc backtrace(3).
}
diff --git a/src/trace.cc b/src/trace.cc
index 6648b85..61dd163 100644
--- a/src/trace.cc
+++ b/src/trace.cc
@@ -145,8 +145,8 @@
return true;
}
-static void TraceRestoreStack(Thread* t, void*) {
#if defined(__arm__)
+static void TraceRestoreStack(Thread* t, void*) {
uintptr_t trace_exit = reinterpret_cast<uintptr_t>(art_trace_exit_from_code);
Frame frame = t->GetTopOfStack();
@@ -164,10 +164,12 @@
}
}
}
-#else
- UNIMPLEMENTED(WARNING);
-#endif
}
+#else
+static void TraceRestoreStack(Thread*, void*) {
+ UNIMPLEMENTED(WARNING);
+}
+#endif
void Trace::AddSavedCodeToMap(const Method* method, const void* code) {
saved_code_map_.insert(std::make_pair(method, code));
@@ -187,16 +189,18 @@
}
}
-void Trace::SaveAndUpdateCode(Method* method) {
#if defined(__arm__)
+void Trace::SaveAndUpdateCode(Method* method) {
void* trace_stub = reinterpret_cast<void*>(art_trace_entry_from_code);
CHECK(GetSavedCodeFromMap(method) == NULL);
AddSavedCodeToMap(method, method->GetCode());
method->SetCode(trace_stub);
-#else
- UNIMPLEMENTED(WARNING);
-#endif
}
+#else
+void Trace::SaveAndUpdateCode(Method*) {
+ UNIMPLEMENTED(WARNING);
+}
+#endif
void Trace::ResetSavedCode(Method* method) {
CHECK(GetSavedCodeFromMap(method) != NULL);
@@ -210,6 +214,11 @@
return;
}
+ // TODO: implement alloc counting.
+ if (flags != 0) {
+ UNIMPLEMENTED(FATAL) << "trace flags";
+ }
+
ScopedThreadStateChange tsc(Thread::Current(), Thread::kRunnable);
Runtime::Current()->GetThreadList()->SuspendAll(false);
diff --git a/src/utils.cc b/src/utils.cc
index 26fe605..c9a6e7e 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -741,7 +741,7 @@
void GetTaskStats(pid_t tid, int& utime, int& stime, int& task_cpu) {
utime = stime = task_cpu = 0;
std::string stats;
- if (!ReadFileToString(StringPrintf("/proc/self/task/%d/stat", GetTid()).c_str(), &stats)) {
+ if (!ReadFileToString(StringPrintf("/proc/self/task/%d/stat", tid).c_str(), &stats)) {
return;
}
// Skip the command, which may contain spaces.
@@ -754,6 +754,31 @@
task_cpu = strtoull(fields[36].c_str(), NULL, 10);
}
+std::string GetSchedulerGroupName(pid_t tid) {
+ // /proc/<pid>/cgroup looks like this:
+ // 2:devices:/
+ // 1:cpuacct,cpu:/
+ // We want the third field from the line whose second field contains the "cpu" token.
+ std::string cgroup_file;
+ if (!ReadFileToString(StringPrintf("/proc/self/task/%d/cgroup", tid), &cgroup_file)) {
+ return "";
+ }
+ std::vector<std::string> cgroup_lines;
+ Split(cgroup_file, '\n', cgroup_lines);
+ for (size_t i = 0; i < cgroup_lines.size(); ++i) {
+ std::vector<std::string> cgroup_fields;
+ Split(cgroup_lines[i], ':', cgroup_fields);
+ std::vector<std::string> cgroups;
+ Split(cgroup_fields[1], ',', cgroups);
+ for (size_t i = 0; i < cgroups.size(); ++i) {
+ if (cgroups[i] == "cpu") {
+ return cgroup_fields[2].substr(1); // Skip the leading slash.
+ }
+ }
+ }
+ return "";
+}
+
const char* GetAndroidRoot() {
const char* android_root = getenv("ANDROID_ROOT");
if (android_root == NULL) {
diff --git a/src/utils.h b/src/utils.h
index cdd8fad..9c18093 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -278,6 +278,9 @@
// Reads data from "/proc/self/task/${tid}/stat".
void GetTaskStats(pid_t tid, int& utime, int& stime, int& task_cpu);
+// Returns the name of the scheduler group for the given thread the current process, or the empty string.
+std::string GetSchedulerGroupName(pid_t tid);
+
// Sets the name of the current thread. The name may be truncated to an
// implementation-defined limit.
void SetThreadName(const char* name);