我是靠谱客的博主 斯文火车,最近开发中收集的这篇文章主要介绍GDB windows powershell 如何把一个命令输出结果赋值给一个变量,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

 

找了一轮没有找到,发现可以使用$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)

 

PS 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, 方便后面打命令。

转发一下端口
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 windows powershell 如何把一个命令输出结果赋值给一个变量所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(45)

评论列表共有 0 条评论

立即
投稿
返回
顶部