Malloc调试

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 debug 附加到此调用后启动的所有进程,并在关闭时断言没有 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 debug 附加到此调用后启动的所有进程,并在关闭时断言没有 malloc 调试错误。

参数
device ITestDevice :要使用的设备

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

退货
AutoCloseable将禁用 libc malloc 调试并在关闭时检查 malloc 调试错误的 AutoCloseable 对象。

投掷
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将禁用 libc malloc 调试并在关闭时检查 malloc 调试错误的 AutoCloseable 对象。

投掷
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将重新启动/取消附加服务、禁用 libc malloc 调试并在关闭时检查 malloc 调试错误的 AutoCloseable 对象。

投掷
DeviceNotAvailableException
IllegalArgumentException
TimeoutException
ProcessUtil.KillException