找了一轮没有找到,发现可以使用$X=(...)这样来实现
awk是安装了NDK中带的, 在 android-ndk-r9dtoolchainsx86-4.8prebuiltwindows-x86_64bin
或者(
http://sourceforge.net/projects/gnuwin32/files/gawk/3.1.6-1/gawk-3.1.6-1-bin.zip/download)
复制代码
1
2
3
4
5
6
7
8
9
10PS C:Users> $XXX=(adb shell ps | findstr "xxxxb" | awk '{print $2}') PS C:Users> echo XXX 7147 PS C:Users> $XPID=(adb shell ps | findstr "xxxb" | awk '{print $2}') ; adb shell /data/local/gdbserver :23456 --attach $XPID Attached; pid = 7147 Listening on port 23456
这个目录还有编译好的 i686-linux-android-gdb-orig.exe
复制一份它,把名字改成 gdbo.exe, 方便后面打命令。
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37转发一下端口 C:Users>adb forward tcp:23456 tcp:23456 C:Users>gdbo GNU gdb (GDB) 7.3.1-gg2 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-pc-mingw32msvc --target=i686-pc-linux-android". For bug reporting instructions, please see: <http://source.android.com/source/report-bugs.html>. (gdb) target remote 127.0.0.1:23456 Remote debugging using 127.0.0.1:23456 warning: Could not load vsyscall page because no executable was specified try using the "file" command first. 0xb74e2656 in ?? () (gdb) handle SIGPWR SIGXCPU nostop Signal Stop Print Pass to program Description SIGXCPU No Yes Yes CPU time limit exceeded SIGPWR No Yes Yes Power fail/restart (gdb) handle SIG33 nostop pass Signal Stop Print Pass to program Description SIG33 No Yes Yes Real-time event 33 (gdb) c Continuing. [New Thread 13837] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 13837] 0xb37ed9f6 in ?? () (gdb) bt #0 0xb37ed9f6 in ?? () #1 0xb30c021a in ?? () #2 0x00000000 in ?? () (gdb) info sharedlibrary
最后
以上就是斯文火车最近收集整理的关于GDB windows powershell 如何把一个命令输出结果赋值给一个变量的全部内容,更多相关GDB内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复