I'm trying to display the output of the gdb command "info registers" in my cocoa app (in a UITableView). In order to do that, I will need to convert the output which is currently a string into an array. Currently, the string output looks like this :
"rax 0x10004005 268451845
rbx 0x0 0
rcx 0x7fff5fbfe948 140734799800648
rdx 0x0 0
rsi 0x7000006 117440518
rdi 0x7fff5fbfea80 140734799800960
rbp 0x7fff5fbfe9a0 0x7fff5fbfe9a0
rsp 0x7fff5fbfe948 0x7fff5fbfe948
r8 0x1e03 7683
r9 0x0 0
r10 0x800 2048
r11 0x206 518
r12 0x1e开发者_开发知识库03 7683
r13 0x800 2048
r14 0x7fff5fbfea80 140734799800960
r15 0x7000006 117440518
rip 0x7fff823d8d7a 0x7fff823d8d7a <mach_msg_trap+10>
eflags 0x206 518
cs 0x2f 47
ss 0x0 0
ds 0x0 0
es 0x0 0
fs 0x10 16
gs 0x48 72"
How do i convert this string into an array such that it looks like this?
"rax 0x10004005 268451845,
rbx 0x0 0,
rcx 0x7fff5fbfe948 140734799800648,
rdx 0x0 0,
rsi 0x7000006 117440518,
rdi 0x7fff5fbfea80 140734799800960,
rbp 0x7fff5fbfe9a0 0x7fff5fbfe9a0,
rsp 0x7fff5fbfe948 0x7fff5fbfe948,
r8 0x1e03 7683,
r9 0x0 0,
r10 0x800 2048,
r11 0x206 518,
r12 0x1e03 7683,
r13 0x800 2048,
r14 0x7fff5fbfea80 140734799800960,
r15 0x7000006 117440518,
rip 0x7fff823d8d7a 0x7fff823d8d7a <mach_msg_trap+10>,
eflags 0x206 518,
cs 0x2f 47,
ss 0x0 0,
ds 0x0 0,
es 0x0 0,
fs 0x10 16,
gs 0x48 72"
NSArray *myArray = [mysHexString componentsSeparatedByString:@"\n"];
精彩评论