Skip to content

Instantly share code, notes, and snippets.

@mzyy94
Created December 18, 2013 04:50
Show Gist options
  • Save mzyy94/8017430 to your computer and use it in GitHub Desktop.
Save mzyy94/8017430 to your computer and use it in GitHub Desktop.
(lldb) settings set target.run-args 0
(lldb) run
There is a running process, kill it and restart?: [Y/n]
Process 31576 launched: '/Volumes/RamDisk/a.out' (x86_64)
Process 31576 stopped
* thread #1: tid = 0x61fc2, 0x0000000100000f43 a.out`main(argc=2, argv=0x00007fff5fbff838) + 115 at bus_error.c:9, queue = 'com.apple.main-thread, stop reason = EXC_BAD_ACCESS (code=2, address=0x100005000)
frame #0: 0x0000000100000f43 a.out`main(argc=2, argv=0x00007fff5fbff838) + 115 at bus_error.c:9
6 for(int i = 0; ; i++){
7 switch(mode) {
8 case '0':
-> 9 c[0] = s[i];
10 break;
11 case '1':
12 s[i] = '\0';
(lldb) disassemble
a.out`main at bus_error.c:4:
0x100000ed0: pushq %rbp
0x100000ed1: movq %rsp, %rbp
0x100000ed4: movl $0, -4(%rbp)
0x100000edb: movl %edi, -8(%rbp)
0x100000ede: movq %rsi, -16(%rbp)
0x100000ee2: movq -16(%rbp), %rsi
0x100000ee6: movq 8(%rsi), %rsi
0x100000eea: movb (%rsi), %al
0x100000eec: movb %al, -18(%rbp)
0x100000eef: movl $0, -24(%rbp)
0x100000ef6: movsbl -18(%rbp), %eax
0x100000efa: movl %eax, %ecx
0x100000efc: subl $50, %ecx
0x100000eff: movl %eax, -28(%rbp)
0x100000f02: movl %ecx, -32(%rbp)
0x100000f05: je 0x100000f62 ; main + 146 at bus_error.c:15
0x100000f0b: jmpq 0x100000f10 ; main + 64 at bus_error.c:7
0x100000f10: movl -28(%rbp), %eax
0x100000f13: subl $49, %eax
0x100000f16: movl %eax, -36(%rbp)
0x100000f19: je 0x100000f4e ; main + 126 at bus_error.c:10
0x100000f1f: jmpq 0x100000f24 ; main + 84 at bus_error.c:7
0x100000f24: movl -28(%rbp), %eax
0x100000f27: subl $48, %eax
0x100000f2a: movl %eax, -40(%rbp)
0x100000f2d: jne 0x100000f75 ; main + 165 at bus_error.c:18
0x100000f33: jmpq 0x100000f38 ; main + 104 at bus_error.c:7
0x100000f38: leaq 193(%rip), %rax
0x100000f3f: movslq -24(%rbp), %rcx
-> 0x100000f43: movb (%rax,%rcx), %dl
0x100000f46: movb %dl, -17(%rbp)
0x100000f49: jmpq 0x100000f7e ; main + 174 at bus_error.c:20
0x100000f4e: leaq 171(%rip), %rax
0x100000f55: movslq -24(%rbp), %rcx
0x100000f59: movb $0, (%rax,%rcx)
0x100000f5d: jmpq 0x100000f7e ; main + 174 at bus_error.c:20
0x100000f62: movslq -24(%rbp), %rax
0x100000f66: movb -17(%rbp,%rax), %cl
0x100000f6a: movb %cl, 144(%rip)
0x100000f70: jmpq 0x100000f7e ; main + 174 at bus_error.c:20
0x100000f75: movslq -24(%rbp), %rax
0x100000f79: movb $0, -17(%rbp,%rax)
0x100000f7e: jmpq 0x100000f83 ; main + 179 at bus_error.c:6
0x100000f83: movl -24(%rbp), %eax
0x100000f86: addl $1, %eax
0x100000f8b: movl %eax, -24(%rbp)
0x100000f8e: jmpq 0x100000ef6 ; main + 38 at bus_error.c:7
(lldb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment