Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gdb ./a.out
GNU gdb 6.3.50-20050815 (Apple version gdb-1820) (Sat Jun 16 02:40:11 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .. done
(gdb) run
Starting program: /private/tmp/y/a.out
Reading symbols for shared libraries +.............................. done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000000100000f00
0x0000000100000f20 in f ()
(gdb) disassemble
Dump of assembler code for function f:
0x0000000100000f20 <f+0>: add DWORD PTR [rax],eax
0x0000000100000f22 <f+2>: add BYTE PTR [rax],al
0x0000000100000f24 <f+4>: ret
0x0000000100000f25 <f+5>: nop WORD PTR cs:[rax+rax+0x0]
End of assembler dump.
(gdb)
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
@i = linkonce_odr global i32 1
; CHECK: f:
; CHECK-NEXT: .long 1
define void @f() prefix i32 1 {
ret void
}
; CHECK: g:
; CHECK-NEXT: .quad i
define void @g() prefix i32* @i {
ret void
}
.section __TEXT,__text,regular,pure_instructions
.globl _f
.align 4, 0x90
_f: ## @f
.long 1 ## 0x1
## BB#0:
ret
.globl _g
.align 4, 0x90
_g: ## @g
.quad _i
## BB#0:
ret
.section __DATA,__datacoal_nt,coalesced
.globl _i ## @i
.weak_definition _i
.align 2
_i:
.long 1 ## 0x1
.subsections_via_symbols
void f();
void g();
int main()
{
f();
g();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.