Backtrace function #1

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
2 participants

These commits introduce a 'backtrace' implementation for x86. For now there there is no way to find the matching symbols (just the backtrace function as defined in glibc).

Gaëtan Morin added some commits May 14, 2012

Gaëtan Morin backtrace: x86 implementation 283539b
Gaëtan Morin backtrace: safer exit condition
The function exits early when a 'null' base pointer is met. If the first
pushed %ebp was 0, we will successfully detect the end of the stack.
cc64f01
Gaëtan Morin backtrace: header f5eb106
Gaëtan Morin backtrace: added function to print a back trace in asserts ee64450

Comments ? Use javadoc or doxygen style.

Owner

gaetmorin replied May 16, 2012

Yes I'll fix that. Laziness is a bad habit... ;-)

Owner

gaetmorin replied May 16, 2012

Also, I wanted to discuss this API with you.

At this stage backtrace_print feels very patchy and tailored for assert only. It is not great to have it in a public header like this. I kind of had to do it because assert is a macro and every function it uses must be public.

Instead, what would you think about having a fail(char *message) API in assert.h that the macro would use ? fail would be implemented in its own file and have its own static backtrace buffer. This way we would have a function for failing without an assert (for example, in unreachable code).

I agree on backtrace_print issue, it must not be public. IMHO it might be part of assert stuff only. You're fail idea looks good to me, do you plan to introduce blocking code into ? like while(1) { hlt(); } ?

Owner

gaetmorin replied May 17, 2012

Great idea! I've implemented that and it works fine. I'm sending e new pull request in a moment.

Could you stash and do a "feature" commit ? This is a small changeset so one commit is enough and simpler to manage.

Owner

gaetmorin replied May 16, 2012

Yes you are right. I will rebase master this evening so don't pull anything now. I'll do proper topic branches in the future.

gaetmorin closed this May 17, 2012

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