summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mythri Alle <mythria@google.com> 2024-11-20 10:29:18 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-11-21 11:41:19 +0000
commit53d8174b0003eb22192aba21d54ca96947002151 (patch)
tree09eabe7dce19356c18f6a10b7b334438c24dddbe
parente5ff363769734fb4ea84a31875f8046f2a887ac6 (diff)
Log an error for an invalid fd in dumpLowOverheadTraceImpl
dumpLowOverheadTraceImpl can take a filename or a file descriptor. If a filename is incorrect we just log an error and ignore the request. For an invalid file descriptor we throw a runtime exception. Make it uniform by logging an error for invalid descriptor as well. Bug: 352518093 Test: art/test.py Change-Id: I6241acf7dd6bcaf41a2789660e442204e4788d62
-rw-r--r--runtime/native/dalvik_system_VMDebug.cc16
1 files changed, 5 insertions, 11 deletions
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index 74b9199917..9440610f36 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -165,29 +165,23 @@ static void VMDebug_stopLowOverheadTraceImpl(JNIEnv*, jclass) {
static void VMDebug_dumpLowOverheadTraceImpl(JNIEnv* env, jclass, jstring javaProfileFileName) {
ScopedUtfChars profileFileName(env, javaProfileFileName);
if (profileFileName.c_str() == nullptr) {
- LOG(ERROR) << "Filename not provided, ignoring the request to dump profile";
+ LOG(ERROR) << "Filename not provided, ignoring the request to dump low-overhead trace";
return;
}
TraceProfiler::Dump(profileFileName.c_str());
}
-static void VMDebug_dumpLowOverheadTraceFdImpl(JNIEnv* env, jclass, jint originalFd) {
+static void VMDebug_dumpLowOverheadTraceFdImpl(JNIEnv*, jclass, jint originalFd) {
if (originalFd < 0) {
- ScopedObjectAccess soa(env);
- soa.Self()->ThrowNewExceptionF("Ljava/lang/RuntimeException;",
- "Trace fd is invalid: %d",
- originalFd);
+ LOG(ERROR) << "Invalid file descriptor, ignoring the request to dump low-overhead trace";
return;
}
// Set the O_CLOEXEC flag atomically here, so the file gets closed when a new process is forked.
int fd = DupCloexec(originalFd);
if (fd < 0) {
- ScopedObjectAccess soa(env);
- soa.Self()->ThrowNewExceptionF("Ljava/lang/RuntimeException;",
- "dup(%d) failed: %s",
- originalFd,
- strerror(errno));
+ LOG(ERROR)
+ << "Unable to dup the file descriptor, ignoring the request to dump low-overhead trace";
return;
}