GDB windows powershell 如何把一个命令输出结果赋值给一个变量

 

找了一轮没有找到,发现可以使用$X=(...)这样来实现

awk是安装了NDK中带的, 在 android-ndk-r9d\toolchains\x86-4.8\prebuilt\windows-x86_64\bin 

 

 

或者(

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 
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:
.
(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 如何把一个命令输出结果赋值给一个变量)