Skip to content

Instantly share code, notes, and snippets.

@Superlokkus
Created September 13, 2016 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Superlokkus/3c4201893b4c51e154e2a0afdf78fef0 to your computer and use it in GitHub Desktop.
Save Superlokkus/3c4201893b4c51e154e2a0afdf78fef0 to your computer and use it in GitHub Desktop.
try and catch arm dissasembly
173 void just_throw_n_catch() {
just_throw_n_catch():
00009c40: push {r4, r5, r7, lr}
00009c42: sub sp, #8
00009c44: add r7, sp, #0
175 throw std::runtime_error("wut");
00009c46: movs r0, #8
00009c48: bl 0x171c8 <__cxa_allocate_exception>
00009c4c: mov r4, r0
00009c4e: adds r3, r7, #4
00009c50: mov r0, r3
00009c52: bl 0x179f8 <_ZNSaIcEC2Ev>
00009c56: mov r2, r7
00009c58: adds r3, r7, #4
00009c5a: mov r0, r2
00009c5c: ldr r1, [pc, #92] ; (0x9cbc <just_throw_n_catch()+124>)
00009c5e: mov r2, r3
00009c60: bl 0x17fe4 <_ZNSsC2EPKcRKSaIcE>
00009c64: mov r3, r7
00009c66: mov r0, r4
00009c68: mov r1, r3
00009c6a: bl 0x17a30 <_ZNSt13runtime_errorC2ERKSs>
00009c6e: mov r3, r7
00009c70: mov r0, r3
00009c72: bl 0x17d08 <_ZNSsD2Ev>
00009c76: adds r3, r7, #4
00009c78: mov r0, r3
00009c7a: bl 0x179fa <_ZNSaIcED2Ev>
00009c7e: mov r0, r4
00009c80: ldr r1, [pc, #60] ; (0x9cc0 <just_throw_n_catch()+128>)
00009c82: ldr r2, [pc, #64] ; (0x9cc4 <just_throw_n_catch()+132>)
00009c84: bl 0x170d8 <__cxa_throw>
00009c88: mov r5, r0
00009c8a: mov r3, r7
00009c8c: mov r0, r3
00009c8e: bl 0x17d08 <_ZNSsD2Ev>
00009c92: b.n 0x9c96 <just_throw_n_catch()+86>
00009c94: mov r5, r0
00009c96: adds r3, r7, #4
00009c98: mov r0, r3
00009c9a: bl 0x179fa <_ZNSaIcED2Ev>
00009c9e: mov r0, r4
00009ca0: bl 0x17220 <__cxa_free_exception>
00009ca4: mov r3, r5
00009ca6: b.n 0x9caa <just_throw_n_catch()+106>
00009ca8: mov r3, r0
176 } catch (...) {
00009caa: mov r0, r3
00009cac: bl 0x16ff8 <__cxa_begin_catch>
00009cb0: bl 0x1704a <__cxa_end_catch>
178 }
00009cb4: adds r7, #8
00009cb6: mov sp, r7
00009cb8: pop {r4, r5, r7, pc}
00009cba: nop
00009cbc: add r0, sp, #864 ; 0x360
00009cbe: movs r1, r0
00009cc0: ; <UNDEFINED> instruction: 0xf5f00002
00009cc4: ldrb r1, [r0, #8]
00009cc6: movs r1, r0
void just_throw_n_catch() {
try {
throw std::runtime_error("wut");
} catch (...) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment