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

Added cygwin_backtrace() with behaviour like in Linux BACKTRACE(3) #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions winsup/cygwin/common.din
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ cygwin_posix_path_list_p NOSIGFE
cygwin_set_impersonation_token SIGFE
cygwin_split_path NOSIGFE
cygwin_stackdump SIGFE
cygwin_backtrace SIGFE
cygwin_umount SIGFE
cygwin_winpid_to_pid SIGFE
daemon SIGFE
Expand Down
15 changes: 15 additions & 0 deletions winsup/cygwin/exceptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,21 @@ cygwin_stackdump ()
exc.dumpstack ();
}

extern "C" int
cygwin_backtrace (void **array, int size)
{
CONTEXT c;
c.ContextFlags = CONTEXT_FULL;
RtlCaptureContext (&c);

thestack.init ((PUINT_PTR) c._GR(bp), 0, &c);
int i;
for (i = 0; i < size && thestack++; i++)
array[i] = (void*)thestack.sf.AddrPC.Offset;

return i;
}

#define TIME_TO_WAIT_FOR_DEBUGGER 10000

extern "C" int
Expand Down