android x86debug,Debug HowTo | Android-x86

这篇教程详细介绍了如何在PC上使用VirtualBox或KVM运行Android,并通过adb连接到虚拟机进行调试。首先,设置网络为Host-Only或Bridged模式,启动Android ISO,获取VM的IP地址。然后,使用adb连接到VM的5555端口,或者在NAT模式下设置端口转发。对于KVM,可以指定端口映射以连接。此外,还讲述了如何使用gdbserver进行远程调试,包括启动gdbserver并附加到应用进程,最后在主机上运行gdb进行调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android-x86

Run Android on your PC

light_theme.png

dark_theme.png

Debug Howto

This page explains how to use adb and gdbserver with VirtualBox

1. use adb:

• In the VirtualBox network configuration, it is simplest to configure it for Host-Only or Bridged.

• boot up Android iso image on the VirtualBox.

• setup ethernet (normally, it will do DHCP by default)

• find the IP address of the android VM, by going to the console and then typing: netcfg

• you can go back to the UI by pressing

• on you host machine, cd /out/host/linux-x86/bin/

• ./adb kill-server

• ./adb connect :5555, after this command, you should see something like below

* daemon not running. starting it now *

* daemon started successfully *

connected to :5555

• ./adb logcat to dump the debug log

2. using adb with a NAT'ed VM

• The steps above work nicely if you have a VM which is set up to use Bridged or Host-Only adapters

• However, if you have a NAT'ed VM you cannot connect to the VM IP from the host

• You will need to set up port forwarding for a host port to be forwarded to the VM port 5555 (which is adb)

• VBoxManage modifyvm

• Example from one machine:

• VBoxManage modifyvm froyo --natpf1 adb,tcp,*,5555,*,5555

• Once this is done, you should see the local port (i.e. 5555 in this case) bound on the host via netstat -a

• You can now connect to the VM by adb localhost:5555

2.a using adb with KVM (qemu)

If you are using KVM instead of Virtualbox you may find the following useful.

Example of running a iso using kvm:

kvm -soundhw es1370 -net nic -net user,hostfwd=tcp::4444-:5555 -cdrom buildname.iso

note the networking arguments: this allows "user networking" which doesn't need root access, while still allowing adb connections, by forwarding them on port 4444 of localhost, so to connect you would use:

adb connect localhost:4444

to disconnect simply (you'll need to do this after stopping/restarting a VM session):

adb disconnect

Its also possible to pass-through usb devices from the host to android guest running in kvm by adding the parameters:

-usb -usbdevice host:2.*

where in the above example that would pass through all devices on the number 2 usb host bus.

3. how to use gdb with gdbserver:

Android-x86 comes with a preinstalled gdbserver. And you can find it in /sbin/gdbserver. To use gdb to debug your process, you need to:

• set up host-only network as mentioned earlier

• in the terminal emulator, run su

• in the terminal emulator, run gdbserver

:1234 [application binary name with the path] or [--attach pid]

• on your host machine, run gdb [path of your application binary]

• gdb > target remote :1234

• gdb > set solib-search-path

• gdb > c

4. Stop zygote to run automatically:

in the vendor/asus/eeepc/init.rc, change following lines

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server

socket zygote stream 666

onrestart write /sys/android_power/request_state wake

onrestart write /sys/power/state on

to:

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server

socket zygote stream 666

onrestart write /sys/android_power/request_state wake

onrestart write /sys/power/state on

disabled

oneshot

To start zygote manually just do "start zygote" from the command line.

<think>嗯,用户遇到了LoadRunner中api_trapper_x64.dll的断言失败问题,具体是trap_manager.cpp第394行的错误。首先,我需要回忆一下LoadRunner常见的这类错误通常是什么原因引起的。可能的原因包括脚本或运行时组件的问题,比如脚本中存在不兼容的函数调用或资源泄漏。还有可能是环境配置问题,例如权限不足或者软件版本不兼容。另外,第三方插件冲突或者系统组件损坏也可能导致这样的断言失败。 接下来,我应该按照步骤来排查问题。用户可能需要检查脚本中的函数调用是否正确,特别是在涉及到网络协议或自定义函数的地方。然后,检查环境配置,比如LoadRunner的版本是否支持当前操作系统,是否有最新的补丁。同时,权限问题也不容忽视,可能需要以管理员身份运行或者调整安全软件设置。 另外,第三方插件冲突的可能性存在,用户可能需要禁用一些插件试试看。系统文件损坏的话,运行sfc /scannow或DISM命令可能会有帮助。还有,重新注册DLL文件,如使用regsvr32命令,可能修复相关组件的问题。如果这些步骤都无效,可能需要联系技术支持并提供详细的日志和错误信息。 用户可能需要生成相关问题,比如如何调试LoadRunner脚本,或者如何分析断言失败日志。这些相关问题可以帮助用户更全面地解决问题。同时,确保回答中引用了合适的参考资料,比如微软的系统文件修复方法或者LoadRunner的官方文档。</think>### LoadRunner api_trapper_x64.dll 断言失败问题解决方案 #### 问题特征分析 该断言失败通常由以下原因引发: 1. **脚本/运行时组件异常**:协议不匹配的函数调用或内存泄漏,例如HTTP协议脚本调用了Socket函数[^2] 2. **环境配置问题**:权限不足、运行时库缺失或版本冲突,如VC++ 2015-2022运行库未安装[^3] 3. **系统资源限制**:Windows句柄泄漏导致超过系统限制(默认每个进程10,000个句柄) #### 分步解决方案 **步骤1:基础环境验证** ```bash # 以管理员身份执行系统文件检查 sfc /scannow DISM /Online /Cleanup-Image /RestoreHealth ``` 完成系统修复后重启工作站,验证是否仍出现断言错误[^4] **步骤2:组件重新注册** ```cmd cd "C:\Program Files\Micro Focus\LoadRunner\bin" regsvr32 /u api_trapper_x64.dll regsvr32 api_trapper_x64.dll ``` 该操作可修复DLL注册表项损坏问题(注意路径根据实际安装目录调整) **步骤3:调试模式运行** 在VuGen中启用高级日志: ```xml <Log> <EnableExtendedLogging>TRUE</EnableExtendedLogging> <LogLevel>verbose</LogLevel> </Log> ``` 通过生成的lrr文件定位具体引发断言的函数调用 **步骤4:句柄监控(适用于持续运行场景)** 使用Process Explorer监控lr_进程的句柄数变化,当接近10,000时立即执行: ```powershell taskkill /f /im mmdrv.exe ``` 同时修改注册表调整句柄限制: ```regedit Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows] "GDIProcessHandleQuota"=dword:00002710 "USERProcessHandleQuota"=dword:00002710 ``` #### 高级故障排除 对于持续出现的问题,建议: 1. 使用Windbg附加到进程进行实时调试 ```windbg .load C:\Debuggers\sosex.dll !trap ``` 2. 检查线程调用栈中与trap_manager.cpp相关的模块偏移量 3. 比对Micro Focus知识库文章KPxxxxxx中的堆栈模式
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值