Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

something went wrong with Listing 16-2. stack_unwind.asm #44

Closed
kneoyskw opened this issue Oct 12, 2017 · 2 comments
Closed

something went wrong with Listing 16-2. stack_unwind.asm #44

kneoyskw opened this issue Oct 12, 2017 · 2 comments

Comments

@kneoyskw
Copy link
Contributor

I built an executable file with the following Makefile in listings/chap16/stack_unwind. When executed, the program printed 14 lines (not 10) and caused Segmentation fault. I think something is wrong with the loop termination logic in stack_unwind.asm. I don't know how rbx register value become zero. Any suggestion?

all: main

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

stack_unwind.o: stack_unwind.asm
	nasm -felf64 stack_unwind.asm -o stack_unwind.o

main.o: stack_unwind.c
	gcc -c -O0 stack_unwind.c -o main.o
@kneoyskw
Copy link
Contributor Author

kneoyskw commented Oct 25, 2017

I figured out another way to stop looping and made a pull request #45 of my solution. I believe that a better solution could be found but I just wanted to show what is the problem.

@sayon
Copy link
Collaborator

sayon commented Dec 10, 2017

Fixed in #45. Thank you again!

@sayon sayon closed this as completed Dec 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants