use gdb on Android to debug mediaserver

steps:

1: get mediaserver's PID

   adb shell ps | grep mediaserver or pid mediaserver (need to source build/env.sh first)


2 Login to Android target and start gdb server

 a: adb shell

 b: gdbserver :5039 --attach 1797

or on the host, run:

 adb shell gdbserver :5039 --attach `pid mediaserver`


3: forward host's port 5039 to target's port 5039

    adb forward tcp:5039 tcp:5039


4: run gdbclient 

   gdbclient ./mediaserver


Or here is a very sample way, on the host, just run on command as below:

gdbclient ./mediaserver :5039 mediaserver

Then gdbclient will help us start the gdbserver, forward the port and connect to the target, very sample.


Note: if your shared libraries are loaded dynamically, you need to set solib-search-path again after they are loaded.

Indeed, under your $OUT fold, you already have a gdbclient.cmds, which has set the path for you.

Just remove the last "remote target :5039" line and run "source gdbclient.cmds" is enough.


Then gdb client should connect to gdbserver, debugging is started!

Enjoy!



Note: if cannot break into, just put long sleep there and use gdbclient ./your_app:5039 your_app, the same as mediaserver.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值