Snap for 5184694 from 377b443ecd0a025363c0ae6fa3a2611009286811 to qt-release
Change-Id: Ibd9d63eb23c5e09f0f1f7a313f8192f0fc33a14b
diff --git a/partition_tools/Android.bp b/partition_tools/Android.bp
index b076178..4a1bb27 100644
--- a/partition_tools/Android.bp
+++ b/partition_tools/Android.bp
@@ -39,6 +39,13 @@
srcs: [
"lpdump.cc",
],
+ target: {
+ android: {
+ shared_libs: [
+ "libfs_mgr",
+ ],
+ },
+ },
}
cc_binary {
diff --git a/partition_tools/lpdump.cc b/partition_tools/lpdump.cc
index 524479b..bde86fc 100644
--- a/partition_tools/lpdump.cc
+++ b/partition_tools/lpdump.cc
@@ -27,6 +27,9 @@
#include <android-base/strings.h>
#include <android-base/parseint.h>
+#ifdef __ANDROID__
+#include <fs_mgr.h>
+#endif
#include <liblp/liblp.h>
using namespace android;
@@ -37,7 +40,7 @@
"%s - command-line tool for dumping Android Logical Partition images.\n"
"\n"
"Usage:\n"
- " %s [-s,--slot] file-or-device\n"
+ " %s [-s <SLOT#>|--slot=<SLOT#>] [FILE|DEVICE]\n"
"\n"
"Options:\n"
" -s, --slot=N Slot number or suffix.\n",
@@ -107,15 +110,22 @@
}
}
- if (optind >= argc) {
- return usage(argc, argv);
- }
- const char* file = argv[optind++];
+ std::unique_ptr<LpMetadata> pt;
+ if (optind < argc) {
+ const char* file = argv[optind++];
- FileOrBlockDeviceOpener opener;
- auto pt = ReadMetadata(opener, file, slot);
- if (!pt && !IsBlockDevice(file)) {
- pt = ReadFromImageFile(file);
+ FileOrBlockDeviceOpener opener;
+ pt = ReadMetadata(opener, file, slot);
+ if (!pt && !IsBlockDevice(file)) {
+ pt = ReadFromImageFile(file);
+ }
+ } else {
+#ifdef __ANDROID__
+ auto slot_number = SlotNumberForSlotSuffix(fs_mgr_get_slot_suffix());
+ pt = ReadMetadata(fs_mgr_get_super_partition_name(), slot_number);
+#else
+ return usage(argc, argv);
+#endif
}
if (!pt) {
fprintf(stderr, "Failed to read metadata.\n");
diff --git a/perfprofd/symbolizer.cc b/perfprofd/symbolizer.cc
index 58ff280..7244539 100644
--- a/perfprofd/symbolizer.cc
+++ b/perfprofd/symbolizer.cc
@@ -35,7 +35,7 @@
struct SimpleperfSymbolizer : public Symbolizer {
// For simplicity, we assume non-overlapping symbols.
struct Symbol {
- Symbol(const std::string& n, uint64_t l) : name(n), length(l) {}
+ Symbol(std::string_view n, uint64_t l) : name(n), length(l) {}
std::string name;
uint64_t length;
@@ -175,4 +175,3 @@
}
} // namespace perfprofd
-
diff --git a/simpleperf/Android.bp b/simpleperf/Android.bp
index 759aee5..c97ba09 100644
--- a/simpleperf/Android.bp
+++ b/simpleperf/Android.bp
@@ -98,6 +98,12 @@
cc_defaults {
name: "libsimpleperf_dex_read_static_reqs_defaults",
defaults: ["libdexfile_static_defaults"],
+ static_libs: [
+ "libdexfile_external",
+ "libdexfile_support",
+ ],
+ header_libs: ["libdexfile_external_headers"],
+ export_header_lib_headers: ["libdexfile_external_headers"],
}
cc_library_static {
diff --git a/simpleperf/Android.mk b/simpleperf/Android.mk
index 4b82136..8afb4d4 100644
--- a/simpleperf/Android.mk
+++ b/simpleperf/Android.mk
@@ -26,8 +26,8 @@
-DUSE_BIONIC_UAPI_HEADERS -I bionic/libc/kernel \
-fvisibility=hidden \
-simpleperf_cflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include
-simpleperf_cflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include
+simpleperf_cflags_host_darwin := -I $(LOCAL_PATH)/nonlinux_support/include -DNO_LIBDEXFILE_SUPPORT
+simpleperf_cflags_host_windows := -I $(LOCAL_PATH)/nonlinux_support/include -DNO_LIBDEXFILE_SUPPORT
LLVM_ROOT_PATH := external/llvm
@@ -36,6 +36,8 @@
simpleperf_static_libraries_target := \
libbacktrace \
libunwindstack \
+ libdexfile_support \
+ libdexfile_external \
libdexfile \
libziparchive \
libz \
@@ -77,6 +79,8 @@
libprocinfo \
libbacktrace \
libunwindstack \
+ libdexfile_support \
+ libdexfile_external \
libdexfile \
libcutils \
libevent \
diff --git a/simpleperf/demo/SimpleperfExampleOfKotlin/.idea/caches/build_file_checksums.ser b/simpleperf/demo/SimpleperfExampleOfKotlin/.idea/caches/build_file_checksums.ser
index 3da69c6..6468d99 100644
--- a/simpleperf/demo/SimpleperfExampleOfKotlin/.idea/caches/build_file_checksums.ser
+++ b/simpleperf/demo/SimpleperfExampleOfKotlin/.idea/caches/build_file_checksums.ser
Binary files differ
diff --git a/simpleperf/demo/SimpleperfExampleOfKotlin/app/build.gradle b/simpleperf/demo/SimpleperfExampleOfKotlin/app/build.gradle
index 4eb80e6..aa37a5b 100644
--- a/simpleperf/demo/SimpleperfExampleOfKotlin/app/build.gradle
+++ b/simpleperf/demo/SimpleperfExampleOfKotlin/app/build.gradle
@@ -8,7 +8,7 @@
android {
compileSdkVersion 25
- buildToolsVersion '26.0.2'
+ buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.simpleperf.simpleperfexampleofkotlin"
minSdkVersion 15
diff --git a/simpleperf/demo/SimpleperfExampleOfKotlin/app/build/outputs/apk/profiling/app-profiling.apk b/simpleperf/demo/SimpleperfExampleOfKotlin/app/build/outputs/apk/profiling/app-profiling.apk
index 414fd6e..8b69bd4 100644
--- a/simpleperf/demo/SimpleperfExampleOfKotlin/app/build/outputs/apk/profiling/app-profiling.apk
+++ b/simpleperf/demo/SimpleperfExampleOfKotlin/app/build/outputs/apk/profiling/app-profiling.apk
Binary files differ
diff --git a/simpleperf/demo/SimpleperfExamplePureJava/.idea/caches/build_file_checksums.ser b/simpleperf/demo/SimpleperfExamplePureJava/.idea/caches/build_file_checksums.ser
index db66eea..5ad3daf 100644
--- a/simpleperf/demo/SimpleperfExamplePureJava/.idea/caches/build_file_checksums.ser
+++ b/simpleperf/demo/SimpleperfExamplePureJava/.idea/caches/build_file_checksums.ser
Binary files differ
diff --git a/simpleperf/demo/SimpleperfExamplePureJava/app/build.gradle b/simpleperf/demo/SimpleperfExamplePureJava/app/build.gradle
index 17e3f14..e6b73d7 100644
--- a/simpleperf/demo/SimpleperfExamplePureJava/app/build.gradle
+++ b/simpleperf/demo/SimpleperfExamplePureJava/app/build.gradle
@@ -22,11 +22,11 @@
}
dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:25.3.1'
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
- testCompile 'junit:junit:4.12'
+ implementation 'com.android.support:appcompat-v7:25.3.1'
+ implementation 'com.android.support.constraint:constraint-layout:1.0.2'
+ testImplementation 'junit:junit:4.12'
}
diff --git a/simpleperf/demo/SimpleperfExamplePureJava/app/build/outputs/apk/profiling/app-profiling.apk b/simpleperf/demo/SimpleperfExamplePureJava/app/build/outputs/apk/profiling/app-profiling.apk
index 6f8c6f2..f7ead36 100644
--- a/simpleperf/demo/SimpleperfExamplePureJava/app/build/outputs/apk/profiling/app-profiling.apk
+++ b/simpleperf/demo/SimpleperfExamplePureJava/app/build/outputs/apk/profiling/app-profiling.apk
Binary files differ
diff --git a/simpleperf/demo/SimpleperfExampleWithNative/.idea/caches/build_file_checksums.ser b/simpleperf/demo/SimpleperfExampleWithNative/.idea/caches/build_file_checksums.ser
index aa013bd..0db86a4 100644
--- a/simpleperf/demo/SimpleperfExampleWithNative/.idea/caches/build_file_checksums.ser
+++ b/simpleperf/demo/SimpleperfExampleWithNative/.idea/caches/build_file_checksums.ser
Binary files differ
diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle b/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle
index 7296c4a..b85b30f 100644
--- a/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle
+++ b/simpleperf/demo/SimpleperfExampleWithNative/app/build.gradle
@@ -33,11 +33,11 @@
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
- compile fileTree(dir: 'libs', include: ['*.jar'])
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- compile 'com.android.support:appcompat-v7:25.3.1'
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
- testCompile 'junit:junit:4.12'
+ implementation 'com.android.support:appcompat-v7:25.3.1'
+ implementation 'com.android.support.constraint:constraint-layout:1.0.2'
+ testImplementation 'junit:junit:4.12'
}
diff --git a/simpleperf/demo/SimpleperfExampleWithNative/app/build/outputs/apk/profiling/app-profiling.apk b/simpleperf/demo/SimpleperfExampleWithNative/app/build/outputs/apk/profiling/app-profiling.apk
index 21ffc64..bbeb4fb 100644
--- a/simpleperf/demo/SimpleperfExampleWithNative/app/build/outputs/apk/profiling/app-profiling.apk
+++ b/simpleperf/demo/SimpleperfExampleWithNative/app/build/outputs/apk/profiling/app-profiling.apk
Binary files differ
diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp
index d2c674b..7fa7283 100644
--- a/simpleperf/dso.cpp
+++ b/simpleperf/dso.cpp
@@ -174,7 +174,7 @@
static OneTimeFreeAllocator symbol_name_allocator;
-Symbol::Symbol(const std::string& name, uint64_t addr, uint64_t len)
+Symbol::Symbol(std::string_view name, uint64_t addr, uint64_t len)
: addr(addr),
len(len),
name_(symbol_name_allocator.AllocateString(name)),
diff --git a/simpleperf/dso.h b/simpleperf/dso.h
index 5bf898f..7e7f558 100644
--- a/simpleperf/dso.h
+++ b/simpleperf/dso.h
@@ -59,7 +59,7 @@
// TODO: make len uint32_t.
uint64_t len;
- Symbol(const std::string& name, uint64_t addr, uint64_t len);
+ Symbol(std::string_view name, uint64_t addr, uint64_t len);
const char* Name() const { return name_; }
const char* DemangledName() const;
diff --git a/simpleperf/read_apk.cpp b/simpleperf/read_apk.cpp
index 8c85073..a6aae6f 100644
--- a/simpleperf/read_apk.cpp
+++ b/simpleperf/read_apk.cpp
@@ -159,6 +159,10 @@
if (entry_name_start < entry_name_end && zip_path_start < zip_path_end) {
*entry_name = path.substr(entry_name_start, entry_name_end - entry_name_start);
*zip_path = path.substr(zip_path_start, zip_path_end - zip_path_start);
+ size_t multidex_separator_pos = zip_path->find('!');
+ if (multidex_separator_pos != std::string::npos) {
+ zip_path->resize(multidex_separator_pos);
+ }
return true;
}
}
diff --git a/simpleperf/read_apk_test.cpp b/simpleperf/read_apk_test.cpp
index 6d8bf2d..d9665ac 100644
--- a/simpleperf/read_apk_test.cpp
+++ b/simpleperf/read_apk_test.cpp
@@ -62,4 +62,11 @@
ASSERT_EQ(entry_name, "classes.dex");
ASSERT_FALSE(ParseExtractedInMemoryPath("/dev/ashmem/dalvik-thread local mark stack (deleted)",
&zip_path, &entry_name));
+
+ // Parse multidex file.
+ ASSERT_TRUE(ParseExtractedInMemoryPath("/dev/ashmem/dalvik-classes2.dex extracted in memory from "
+ "/data/app/getxml.test.com.testgetxml-knxI11ZXLT-OVBs9X9bSkw==/base.apk!classes2.dex "
+ "(deleted)", &zip_path, &entry_name));
+ ASSERT_EQ(zip_path, "/data/app/getxml.test.com.testgetxml-knxI11ZXLT-OVBs9X9bSkw==/base.apk");
+ ASSERT_EQ(entry_name, "classes2.dex");
}
diff --git a/simpleperf/read_dex_file.cpp b/simpleperf/read_dex_file.cpp
index 53180af..78e9654 100644
--- a/simpleperf/read_dex_file.cpp
+++ b/simpleperf/read_dex_file.cpp
@@ -17,68 +17,63 @@
#include "read_dex_file.h"
#include <fcntl.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <functional>
+#include <algorithm>
+#include <iterator>
#include <string>
+#include <utility>
+#include <vector>
-#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/unique_fd.h>
+#include <art_api/ext_dex_file.h>
-#include <dex/class_accessor-inl.h>
-#include <dex/code_item_accessors-inl.h>
-#include <dex/dex_file_loader.h>
-#include <dex/dex_file.h>
-
-static bool OpenDexFiles(void* addr, uint64_t size, std::vector<uint64_t> dex_file_offsets,
- const std::function<void (const art::DexFile&, uint64_t)>& callback) {
- bool result = true;
+static bool ReadSymbols(
+ const std::vector<uint64_t>& dex_file_offsets, std::vector<DexFileSymbol>* symbols,
+ const std::function<std::unique_ptr<art_api::dex::DexFile>(uint64_t offset)>& open_file_cb) {
for (uint64_t offset : dex_file_offsets) {
- if (offset >= size || size - offset < sizeof(art::DexFile::Header)) {
- result = false;
- break;
+ std::unique_ptr<art_api::dex::DexFile> dex_file = open_file_cb(offset);
+ if (dex_file == nullptr) {
+ return false;
}
- auto header = reinterpret_cast<art::DexFile::Header*>(static_cast<char*>(addr) + offset);
- if (size - offset < header->file_size_) {
- result = false;
- break;
+
+ std::vector<art_api::dex::MethodInfo> file_syms = dex_file->GetAllMethodInfos(false);
+
+ // Adjust offsets to be from the start of the combined file.
+ for (art_api::dex::MethodInfo& sym : file_syms) {
+ sym.offset += offset;
}
- art::DexFileLoader loader;
- std::string error;
- std::unique_ptr<const art::DexFile> dex_file = loader.Open(reinterpret_cast<uint8_t*>(header),
- header->file_size_, "", 0, nullptr,
- false, false, &error);
- if (!dex_file) {
- result = false;
- break;
+
+ if (symbols->empty()) {
+ *symbols = std::move(file_syms);
+ } else {
+ symbols->reserve(symbols->size() + file_syms.size());
+ std::move(std::begin(file_syms), std::end(file_syms), std::back_inserter(*symbols));
}
- callback(*dex_file, offset);
}
- return result;
+
+ return true;
}
bool ReadSymbolsFromDexFileInMemory(void* addr, uint64_t size,
const std::vector<uint64_t>& dex_file_offsets,
std::vector<DexFileSymbol>* symbols) {
- auto dexfile_callback = [&](const art::DexFile& dex_file, uint64_t dex_file_offset) {
- for (art::ClassAccessor accessor : dex_file.GetClasses()) {
- for (const art::ClassAccessor::Method& method : accessor.GetMethods()) {
- art::CodeItemInstructionAccessor code = method.GetInstructions();
- if (!code.HasCodeItem()) {
- continue;
+ return ReadSymbols(
+ dex_file_offsets, symbols, [&](uint64_t offset) -> std::unique_ptr<art_api::dex::DexFile> {
+ size_t max_file_size;
+ if (__builtin_sub_overflow(size, offset, &max_file_size)) {
+ return nullptr;
}
- symbols->resize(symbols->size() + 1);
- DexFileSymbol& symbol = symbols->back();
- symbol.offset = reinterpret_cast<const uint8_t*>(code.Insns()) - dex_file.Begin() +
- dex_file_offset;
- symbol.len = code.InsnsSizeInBytes();
- symbol.name = dex_file.PrettyMethod(method.GetIndex(), false);
- }
- }
- };
- return OpenDexFiles(addr, size, dex_file_offsets, dexfile_callback);
+ uint8_t* file_addr = static_cast<uint8_t*>(addr) + offset;
+ std::string error_msg;
+ std::unique_ptr<art_api::dex::DexFile> dex_file =
+ art_api::dex::DexFile::OpenFromMemory(file_addr, &max_file_size, "", &error_msg);
+ if (dex_file == nullptr) {
+ LOG(WARNING) << "Failed to read dex file symbols: " << error_msg;
+ return nullptr;
+ }
+ return dex_file;
+ });
}
bool ReadSymbolsFromDexFile(const std::string& file_path,
@@ -88,16 +83,16 @@
if (fd == -1) {
return false;
}
- struct stat buf;
- if (fstat(fd, &buf) == -1 || buf.st_size < 0) {
- return false;
- }
- uint64_t file_size = buf.st_size;
- void* addr = mmap(nullptr, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (addr == MAP_FAILED) {
- return false;
- }
- bool result = ReadSymbolsFromDexFileInMemory(addr, file_size, dex_file_offsets, symbols);
- munmap(addr, file_size);
- return result;
+ return ReadSymbols(
+ dex_file_offsets, symbols, [&](uint64_t offset) -> std::unique_ptr<art_api::dex::DexFile> {
+ std::string error_msg;
+ std::unique_ptr<art_api::dex::DexFile> dex_file =
+ art_api::dex::DexFile::OpenFromFd(fd, offset, file_path, &error_msg);
+ if (dex_file == nullptr) {
+ LOG(WARNING) << "Failed to read dex file symbols from '" << file_path
+ << "': " << error_msg;
+ return nullptr;
+ }
+ return dex_file;
+ });
}
diff --git a/simpleperf/read_dex_file.h b/simpleperf/read_dex_file.h
index 2efcde1..5d54f65 100644
--- a/simpleperf/read_dex_file.h
+++ b/simpleperf/read_dex_file.h
@@ -22,11 +22,19 @@
#include <string>
#include <vector>
+#ifndef NO_LIBDEXFILE_SUPPORT
+#include <art_api/ext_dex_file.h>
+#endif
+
+#ifndef NO_LIBDEXFILE_SUPPORT
+typedef art_api::dex::MethodInfo DexFileSymbol;
+#else
struct DexFileSymbol {
uint64_t offset;
uint64_t len;
std::string name;
};
+#endif
bool ReadSymbolsFromDexFileInMemory(void* addr, uint64_t size,
const std::vector<uint64_t>& dex_file_offsets,
diff --git a/simpleperf/read_dex_file_test.cpp b/simpleperf/read_dex_file_test.cpp
index 6b90b8b..7e72768 100644
--- a/simpleperf/read_dex_file_test.cpp
+++ b/simpleperf/read_dex_file_test.cpp
@@ -24,10 +24,6 @@
#include "test_util.h"
#include "utils.h"
-bool operator==(const DexFileSymbol& s1, const DexFileSymbol& s2) {
- return s1.offset == s2.offset && s1.len == s2.len && s1.name == s2.name;
-}
-
TEST(read_dex_file, smoke) {
std::vector<DexFileSymbol> symbols;
ASSERT_TRUE(ReadSymbolsFromDexFile(GetTestData("base.vdex"), {0x28}, &symbols));
@@ -35,6 +31,7 @@
DexFileSymbol target;
target.offset = 0x6c77e;
target.len = 0x16;
- target.name = "com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run";
+ target.name = art_api::dex::DexString(
+ "com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run");
ASSERT_NE(std::find(symbols.begin(), symbols.end(), target), symbols.end());
}
diff --git a/simpleperf/scripts/bin/android/arm/simpleperf b/simpleperf/scripts/bin/android/arm/simpleperf
index 3b11156..871103e 100755
--- a/simpleperf/scripts/bin/android/arm/simpleperf
+++ b/simpleperf/scripts/bin/android/arm/simpleperf
Binary files differ
diff --git a/simpleperf/scripts/bin/android/arm64/simpleperf b/simpleperf/scripts/bin/android/arm64/simpleperf
index b593d73..7c55757 100755
--- a/simpleperf/scripts/bin/android/arm64/simpleperf
+++ b/simpleperf/scripts/bin/android/arm64/simpleperf
Binary files differ
diff --git a/simpleperf/scripts/bin/android/x86/simpleperf b/simpleperf/scripts/bin/android/x86/simpleperf
index 428bebb..f214e31 100755
--- a/simpleperf/scripts/bin/android/x86/simpleperf
+++ b/simpleperf/scripts/bin/android/x86/simpleperf
Binary files differ
diff --git a/simpleperf/scripts/bin/android/x86_64/simpleperf b/simpleperf/scripts/bin/android/x86_64/simpleperf
index 1ec512f..348443f 100755
--- a/simpleperf/scripts/bin/android/x86_64/simpleperf
+++ b/simpleperf/scripts/bin/android/x86_64/simpleperf
Binary files differ
diff --git a/simpleperf/scripts/bin/linux/x86/libsimpleperf_report.so b/simpleperf/scripts/bin/linux/x86/libsimpleperf_report.so
index 0fbc868..0870311 100755
--- a/simpleperf/scripts/bin/linux/x86/libsimpleperf_report.so
+++ b/simpleperf/scripts/bin/linux/x86/libsimpleperf_report.so
Binary files differ
diff --git a/simpleperf/scripts/bin/linux/x86/simpleperf b/simpleperf/scripts/bin/linux/x86/simpleperf
index 44af76b..26bf5ff 100755
--- a/simpleperf/scripts/bin/linux/x86/simpleperf
+++ b/simpleperf/scripts/bin/linux/x86/simpleperf
Binary files differ
diff --git a/simpleperf/scripts/bin/linux/x86_64/libsimpleperf_report.so b/simpleperf/scripts/bin/linux/x86_64/libsimpleperf_report.so
index f0bbb35..2c9399b 100755
--- a/simpleperf/scripts/bin/linux/x86_64/libsimpleperf_report.so
+++ b/simpleperf/scripts/bin/linux/x86_64/libsimpleperf_report.so
Binary files differ
diff --git a/simpleperf/scripts/bin/linux/x86_64/simpleperf b/simpleperf/scripts/bin/linux/x86_64/simpleperf
index 4e38a44..b3a9836 100755
--- a/simpleperf/scripts/bin/linux/x86_64/simpleperf
+++ b/simpleperf/scripts/bin/linux/x86_64/simpleperf
Binary files differ
diff --git a/simpleperf/scripts/bin/windows/x86/libsimpleperf_report.dll b/simpleperf/scripts/bin/windows/x86/libsimpleperf_report.dll
index 889b6c1..ac6b33d 100755
--- a/simpleperf/scripts/bin/windows/x86/libsimpleperf_report.dll
+++ b/simpleperf/scripts/bin/windows/x86/libsimpleperf_report.dll
Binary files differ
diff --git a/simpleperf/scripts/bin/windows/x86/libwinpthread-1.dll b/simpleperf/scripts/bin/windows/x86/libwinpthread-1.dll
index 5979688..86de5d6 100755
--- a/simpleperf/scripts/bin/windows/x86/libwinpthread-1.dll
+++ b/simpleperf/scripts/bin/windows/x86/libwinpthread-1.dll
Binary files differ
diff --git a/simpleperf/scripts/bin/windows/x86/simpleperf.exe b/simpleperf/scripts/bin/windows/x86/simpleperf.exe
index a91b916..1b97ef9 100755
--- a/simpleperf/scripts/bin/windows/x86/simpleperf.exe
+++ b/simpleperf/scripts/bin/windows/x86/simpleperf.exe
Binary files differ
diff --git a/simpleperf/scripts/bin/windows/x86_64/libsimpleperf_report.dll b/simpleperf/scripts/bin/windows/x86_64/libsimpleperf_report.dll
index 79a69f0..c7f29f7 100755
--- a/simpleperf/scripts/bin/windows/x86_64/libsimpleperf_report.dll
+++ b/simpleperf/scripts/bin/windows/x86_64/libsimpleperf_report.dll
Binary files differ
diff --git a/simpleperf/scripts/bin/windows/x86_64/libwinpthread-1.dll b/simpleperf/scripts/bin/windows/x86_64/libwinpthread-1.dll
index 755f7a8..ee5d7a3 100755
--- a/simpleperf/scripts/bin/windows/x86_64/libwinpthread-1.dll
+++ b/simpleperf/scripts/bin/windows/x86_64/libwinpthread-1.dll
Binary files differ
diff --git a/simpleperf/scripts/bin/windows/x86_64/simpleperf.exe b/simpleperf/scripts/bin/windows/x86_64/simpleperf.exe
index a91b916..1b97ef9 100755
--- a/simpleperf/scripts/bin/windows/x86_64/simpleperf.exe
+++ b/simpleperf/scripts/bin/windows/x86_64/simpleperf.exe
Binary files differ
diff --git a/simpleperf/scripts/binary_cache_builder.py b/simpleperf/scripts/binary_cache_builder.py
index 6151d16..50fcc54 100755
--- a/simpleperf/scripts/binary_cache_builder.py
+++ b/simpleperf/scripts/binary_cache_builder.py
@@ -154,7 +154,7 @@
"""pull binaries needed in perf.data to binary_cache."""
for binary in self.binaries:
build_id = self.binaries[binary]
- if binary[0] != '/' or binary == "//anon" or binary.startswith("/dev/"):
+ if not binary.startswith('/') or binary == "//anon" or binary.startswith("/dev/"):
# [kernel.kallsyms] or unknown, or something we can't find binary.
continue
binary_cache_file = binary[1:].replace('/', os.sep)
diff --git a/simpleperf/scripts/utils.py b/simpleperf/scripts/utils.py
index 20ea5c5..ea708c6 100644
--- a/simpleperf/scripts/utils.py
+++ b/simpleperf/scripts/utils.py
@@ -78,7 +78,9 @@
return str_value.encode('utf-8')
def bytes_to_str(bytes_value):
- if not is_python3() or not bytes_value:
+ if not bytes_value:
+ return ''
+ if not is_python3():
return bytes_value
return bytes_value.decode('utf-8')
diff --git a/simpleperf/utils.cpp b/simpleperf/utils.cpp
index 6e35a79..6de8811 100644
--- a/simpleperf/utils.cpp
+++ b/simpleperf/utils.cpp
@@ -46,7 +46,7 @@
end_ = nullptr;
}
-const char* OneTimeFreeAllocator::AllocateString(const std::string& s) {
+const char* OneTimeFreeAllocator::AllocateString(std::string_view s) {
size_t size = s.size() + 1;
if (cur_ + size > end_) {
size_t alloc_size = std::max(size, unit_size_);
@@ -55,7 +55,7 @@
cur_ = p;
end_ = p + alloc_size;
}
- strcpy(cur_, s.c_str());
+ strcpy(cur_, s.data());
const char* result = cur_;
cur_ += size;
return result;
diff --git a/simpleperf/utils.h b/simpleperf/utils.h
index 7fceecd..3ca8f5c 100644
--- a/simpleperf/utils.h
+++ b/simpleperf/utils.h
@@ -54,7 +54,7 @@
}
void Clear();
- const char* AllocateString(const std::string& s);
+ const char* AllocateString(std::string_view s);
private:
const size_t unit_size_;