Skip to content

Instantly share code, notes, and snippets.

@mepcotterell
Created February 6, 2019 20:45
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 mepcotterell/3477d6631c207fd7ffb850d79ef6ba76 to your computer and use it in GitHub Desktop.
Save mepcotterell/3477d6631c207fd7ffb850d79ef6ba76 to your computer and use it in GitHub Desktop.

main.s

	.text
	.globl main
	.type main, @function
main:
	pushq 	%rbp		;
	movq	%rsp, %rbp	;
	pushq	%rbx		;
	pushq	%rcx		;

	movq	$0xFFFFFFFFFFFFFFFF, %rbx ;
	movb	%bl, %cl		  ;
	movw	%bx, %cx		  ;
	movl	%ebx, %ecx		  ;
	movq	%rbx, %rcx		  ;
	
	xorq	%rax, %rax	;

	popq	%rcx		;
	popq	%rbx		;
	movq	%rbp, %rsp	;
	popq 	%rbp		;
	ret			;

Makefile

main: main.o
	gcc -o main main.o

main.o: main.s
	as --gstabs+ -o main.o main.s

clean:
	rm -f main
	rm -f main.o

Custom .gdbinit

If you want to use the custom .gdbinit, you can download it using wget, then move/rename/copy it to ~/.gdbinit:

$ wget http://cobweb.cs.uga.edu/~mec/csx730/gdbinit
$ cp gdbinit ~/.gdbinit

If you would rather go back to regular GDB, then simply remove ~/.gdbinit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment