fix fuzztest and native daemon sa show size

Signed-off-by: zyxzyx <zhangyixin19@huawei.com>
This commit is contained in:
zyxzyx 2023-12-28 19:26:44 +08:00
parent f7297cd09d
commit 00b08b2b56
10 changed files with 29 additions and 3 deletions

View File

@ -191,8 +191,8 @@
</target>
<target name="gpudataplugin_ut">
<preparer>
<option name="push" value="plugins/gpu_plugin/test/utresources/info/1/gpustat1.txt -> /data/local/tmp/resource" src="res"/>
<option name="push" value="plugins/gpu_plugin/test/utresources/info/2/gpustat2.txt -> /data/local/tmp/resource" src="res"/>
<option name="push" value="plugins/gpu_plugin/test/utresources/info/1/gpustat1.txt -> /data/local/tmp/resource/" src="res"/>
<option name="push" value="plugins/gpu_plugin/test/utresources/info/2/gpustat2.txt -> /data/local/tmp/resource/" src="res"/>
</preparer>
</target>
<target name="native_memory_profiler_sa_ut">

View File

@ -33,6 +33,9 @@ ohos_fuzztest("PluginCreateSessionCmdFuzzTest") {
"../../..:plugins_sources",
]
external_deps = [ "hilog:libhilog" ]
if (is_asan) {
defines = [ "ASAN_MODE" ]
}
}
###############################################################################

View File

@ -26,6 +26,9 @@
namespace OHOS {
bool CreateSessionTest(const uint8_t* data, size_t size)
{
#ifdef ASAN_MODE
std::this_thread::sleep_for(std::chrono::millseconds(1));
#endif
auto pluginManage = std::make_shared<PluginManager>();
auto commandPoller = std::make_shared<CommandPoller>(pluginManage);
pluginManage->SetCommandPoller(commandPoller);

View File

@ -33,6 +33,9 @@ ohos_fuzztest("PluginDestroySessionCmdFuzzTest") {
"../../..:plugins_sources",
]
external_deps = [ "hilog:libhilog" ]
if (is_asan) {
defines = [ "ASAN_MODE" ]
}
}
###############################################################################

View File

@ -26,6 +26,9 @@
namespace OHOS {
bool DestroySessionTest(const uint8_t* data, size_t size)
{
#ifdef ASAN_MODE
std::this_thread::sleep_for(std::chrono::millseconds(1));
#endif
auto pluginManage = std::make_shared<PluginManager>();
auto commandPoller = std::make_shared<CommandPoller>(pluginManage);
pluginManage->SetCommandPoller(commandPoller);

View File

@ -33,6 +33,9 @@ ohos_fuzztest("PluginStartSessionCmdFuzzTest") {
"../../..:plugins_sources",
]
external_deps = [ "hilog:libhilog" ]
if (is_asan) {
defines = [ "ASAN_MODE" ]
}
}
###############################################################################

View File

@ -27,6 +27,9 @@
namespace OHOS {
bool StartSessionTest(const uint8_t* data, size_t size)
{
#ifdef ASAN_MODE
std::this_thread::sleep_for(std::chrono::millseconds(1));
#endif
auto pluginManage = std::make_shared<PluginManager>();
auto commandPoller = std::make_shared<CommandPoller>(pluginManage);
pluginManage->SetCommandPoller(commandPoller);

View File

@ -33,6 +33,9 @@ ohos_fuzztest("PluginStopSessionCmdFuzzTest") {
"../../..:plugins_sources",
]
external_deps = [ "hilog:libhilog" ]
if (is_asan) {
defines = [ "ASAN_MODE" ]
}
}
###############################################################################

View File

@ -26,6 +26,9 @@
namespace OHOS {
bool StopSessionTest(const uint8_t* data, size_t size)
{
#ifdef ASAN_MODE
std::this_thread::sleep_for(std::chrono::millseconds(1));
#endif
auto pluginManage = std::make_shared<PluginManager>();
auto commandPoller = std::make_shared<CommandPoller>(pluginManage);
pluginManage->SetCommandPoller(commandPoller);

View File

@ -48,6 +48,7 @@ constexpr static uint32_t RIGHT_MOVE_4 = 4;
constexpr static uint32_t RIGHT_MOVE_8 = 8;
constexpr static uint32_t RIGHT_MOVE_16 = 16;
constexpr static uint32_t RIGHT_MOVE_32 = 32;
constexpr static uint64_t SIZE_MASK = 0xFFFFFF0000000000;
using namespace OHOS::Developtools::NativeDaemon;
using namespace OHOS::HiviewDFX;
@ -447,7 +448,8 @@ void StackPreprocess::SetAllocStatisticsFrame(const RawStackPtr& rawStack,
// ignore the first two frame if dwarf unwind
size_t idx = hookConfig_.fp_unwind() ? 0 : FILTER_STACK_DEPTH;
callStack_.clear();
callStack_.reserve(callFrames.size());
callStack_.reserve(callFrames.size() + 1);
callStack_.push_back(rawStack->stackConext->mallocSize | SIZE_MASK);
if (!hookConfig_.offline_symbolization()) {
FillCallStack(callFrames, batchNativeHookData, idx);
} else {