MallocDebug

public class MallocDebug
extends Object implements AutoCloseable

java.lang.Object
   ↳ com.android.sts.common.MallocDebug


用于在进程中设置 malloc 调试选项、检查 malloc 调试错误以及之后进行清理的实用程序。

摘要

公共方法

void close()
static AutoCloseable withLibcMallocDebugOnAllNewProcesses(ITestDevice device, String mallocDebugOptions)

开始将 libc malloc 调试附加到此调用后启动的所有进程,并断言关闭时没有 malloc 调试错误。

static AutoCloseable withLibcMallocDebugOnNewProcess(ITestDevice device, String mallocDebugOptions, String processName)

进行设置,以便 malloc 调试会附加到给定的 processName,并断言关闭时没有 malloc 调试错误。

static AutoCloseable withLibcMallocDebugOnService(ITestDevice device, String mallocDebugOptions, String processName)

重启给定服务并为其启用 malloc 调试,断言关闭时没有 malloc 调试错误。

公共方法

关闭

public void close ()

抛出
Exception

withLibcMallocDebugOnAllNewProcesses

public static AutoCloseable withLibcMallocDebugOnAllNewProcesses (ITestDevice device, 
                String mallocDebugOptions)

开始将 libc malloc 调试附加到此调用后启动的所有进程,并断言关闭时没有 malloc 调试错误。

参数
device ITestDevice:要使用的设备

mallocDebugOptions String:要将 libc.debug.malloc.options 设置为的值。

返回
AutoCloseable AutoCloseable 对象,用于停用 libc malloc 调试,并在关闭时检查是否存在 malloc 调试错误。

抛出
DeviceNotAvailableException
TimeoutException
ProcessUtil.KillException

withLibcMallocDebugOnNewProcess

public static AutoCloseable withLibcMallocDebugOnNewProcess (ITestDevice device, 
                String mallocDebugOptions, 
                String processName)

进行设置,以便 malloc 调试会附加到给定的 processName,并断言关闭时没有 malloc 调试错误。请注意,此调用后需要手动启动 processName。

参数
device ITestDevice:要使用的设备

mallocDebugOptions String:要将 libc.debug.malloc.options 设置为的值。

processName String:要附加 libc malloc 调试的进程。尚不应运行。

返回
AutoCloseable AutoCloseable 对象,用于停用 libc malloc 调试,并在关闭时检查是否存在 malloc 调试错误。

抛出
DeviceNotAvailableException
IllegalArgumentException
TimeoutException
ProcessUtil.KillException

withLibcMallocDebugOnService

public static AutoCloseable withLibcMallocDebugOnService (ITestDevice device, 
                String mallocDebugOptions, 
                String processName)

重启给定服务并为其启用 malloc 调试,断言关闭时没有 malloc 调试错误。

参数
device ITestDevice:要使用的设备

mallocDebugOptions String:要将 libc.debug.malloc.options 设置为的值。

processName String:要附加 libc malloc 调试的服务进程。应处于运行状态。

返回
AutoCloseable AutoCloseable 对象,用于重启/取消附加服务、停用 libc malloc 调试,并在关闭时检查是否存在 malloc 调试错误。

抛出
DeviceNotAvailableException
IllegalArgumentException
TimeoutException
ProcessUtil.KillException