Skip to content

Instantly share code, notes, and snippets.

@habnabit
Last active March 3, 2016 01:16
Show Gist options
  • Save habnabit/0c331bd3891c73bc02b3 to your computer and use it in GitHub Desktop.
Save habnabit/0c331bd3891c73bc02b3 to your computer and use it in GitHub Desktop.
00001c50 <_ZN6pebble5usart26UsartInnerDebug.fmt..Write9write_str20h2ee4dcecc5128b1fkkaE>:
1c50: b580 push {r7, lr}
1c52: b082 sub sp, #8
1c54: e9cd 1200 strd r1, r2, [sp]
1c58: 4905 ldr r1, [pc, #20] ; (1c70 <_ZN6pebble5usart26UsartInnerDebug.fmt..Write9write_str20h2ee4dcecc5128b1fkkaE+0x20>)
1c5a: 2001 movs r0, #1
1c5c: 2200 movs r2, #0
1c5e: be00 bkpt 0x0000
1c60: 4479 add r1, pc
1c62: 460b mov r3, r1
1c64: f000 fa92 bl 218c <app_log>
1c64: R_ARM_THM_CALL app_log
1c68: 2000 movs r0, #0
1c6a: b002 add sp, #8
1c6c: bd80 pop {r7, pc}
1c6e: bf00 nop
1c70: 000007b2 .word 0x000007b2
1c70: R_ARM_REL32 byte_str4284
(gdb) disassemble $pc-0x10,+0x20
Dump of assembler code from 0x2001bef4 to 0x2001bf14:
0x2001bef4: push {r7, lr}
0x2001bef6: sub sp, #8
0x2001bef8: strd r1, r2, [sp]
0x2001befc: ldr r1, [pc, #20] ; (0x2001bf14)
0x2001befe: movs r0, #1
0x2001bf00: movs r2, #0
0x2001bf02: bkpt 0x0000
=> 0x2001bf04: add r1, pc
0x2001bf06: mov r3, r1
0x2001bf08: bl 0x2001c430
0x2001bf0c: movs r0, #0
0x2001bf0e: add sp, #8
0x2001bf10: pop {r7, pc}
0x2001bf12: nop
End of assembler dump.
(gdb) nexti
0x2001bf06 in ?? ()
(gdb)
0x2001bf08 in ?? ()
(gdb)
0x2001c430 in ?? ()
(gdb) disassemble $pc-0x10,+0x20
Dump of assembler code from 0x2001c420 to 0x2001c440:
0x2001c420: add r1, pc
0x2001c422: bl 0x2001b870
0x2001c426: add sp, #32
0x2001c428: pop {r4, r5, r6, pc}
0x2001c42a: nop
0x2001c42c: lsls r4, r6, #23
0x2001c42e: movs r0, r0
=> 0x2001c430: push {r0, r1, r2, r3}
0x2001c432: ldr r1, [pc, #4] ; (0x2001c438)
0x2001c434: b.w 0x2001a334
0x2001c438: lsls r0, r1, #2
0x2001c43a: movs r0, r0
0x2001c43c: push {r0, r1, r2, r3}
0x2001c43e: ldr r1, [pc, #4] ; (0x2001c444)
End of assembler dump.
(gdb) p/x *(unsigned int *)$sp@2
$40 = {0x6c6c6162, 0x73}
(gdb) nexti
0x2001c432 in ?? ()
(gdb) p/x *(unsigned int *)$sp@2
$41 = {0x1, 0x2001c6ba}
(gdb) p/x *(unsigned int *)$sp@6
$42 = {0x1, 0x2001c6ba, 0x0, 0x2001c6ba, 0x6c6c6162, 0x73}
pub struct UsartInnerDebug;
impl fmt::Write for UsartInnerDebug {
fn write_str(&mut self, s: &str) -> fmt::Result {
unsafe { asm!("BKPT"); }
unsafe { external::app_log(1, b"\0".as_ptr(), 0, b"\0".as_ptr(), s.as_ptr(), s.len()) };
Ok(())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment