Want to Print Partial string in GDB -


i writing gdb macro analyze core , print string. output of string core "sp-4/0/2". need print "sp", excluding others. not sure how achieve in gdb. pointers of great help.

thanks in advance.

see, argv[1] "sp-4/0/2"

(gdb) p argv[1] $4 = 0x7fffffffe3fa "sp-4/0/2" 

and 2 first chars:

(gdb) printf "%.2s\n", argv[1] sp 

or

(gdb) printf "%c%c\n", argv[1][0],argv[1][1] sp 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -