Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 146274 Details for
Bug 223954
unwinding the context in signal handler fails
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
test case
1.c (text/x-csrc), 9.17 KB, created by
Oliver Stabel
on 2007-01-23 09:12:08 UTC
(
hide
)
Description:
test case
Filename:
MIME Type:
Creator:
Oliver Stabel
Created:
2007-01-23 09:12:08 UTC
Size:
9.17 KB
patch
obsolete
>/* > compile with > gcc 1.c -lunwind -ldl >*/ > > >#define _GNU_SOURCE >#include <sys/time.h> >#include <sys/resource.h> >#include <unistd.h> >#include <stdio.h> >#include <signal.h> >#include <string.h> >#include <errno.h> >#include <dlfcn.h> >#include <elf.h> >#include <ucontext.h> > >#define UNW_LOCAL_ONLY >#include <libunwind.h> > >void stackdump(ucontext_t* ucp) >{ > unw_cursor_t cursor; > unw_word_t ip, sp; > int rc; > > fprintf(stderr,"stack dump start (ucontext %p)\n", ucp); > > if (0!= unw_init_local(&cursor, ucp)) { > fprintf(stderr,"unw_init_local failed\n"); > return; > } > > while ( (rc = unw_step(&cursor)) > 0) { > unw_get_reg(&cursor, UNW_REG_IP, &ip); > unw_get_reg(&cursor, UNW_REG_SP, &sp); > fprintf (stderr, "ip = %lx, sp = %lx\n", (long) ip, (long) sp); > } > > if (rc <0) { > fprintf(stderr,"unw_step failed rc = %d\n", rc); > } > > fprintf(stderr,"stack dump end\n"); >} > >void handleSegv(int sig, siginfo_t* info, void* ucpPtr) >{ > struct sigaction sa; > > stackdump((ucontext_t*)ucpPtr); > > sa.sa_handler = SIG_DFL; > sigemptyset(&sa.sa_mask); > sigaction(SIGSEGV, &sa, NULL); >} > >static void (*plemming1)(); >static void (*plemming2)(); > >void lemming2() { > > volatile char* p = 0; > > printf("9999 causes me to crash, for test purposes.\n"); > > *p = 0; > > printf("."); > > printf("I'm still alive, so I guess writing to a NULL pointer is okay... :-)\n"); > exit(-1); > >} > >void lemming1() { > printf("Called with -Xtest="); > plemming2(); > printf("."); >} > > >int main() >{ > // prevent writing of a core file > struct rlimit rl; > if (getrlimit(RLIMIT_CORE, &rl) != 0) { > fprintf(stderr, "Cannot switch off core-files (getrlimit failed, %d (%s)\n", > errno, strerror(errno)); > } else { > rl.rlim_cur = 0; > if (setrlimit(RLIMIT_CORE, &rl) != 0) { > fprintf(stderr, "Cannot switch off core-files (setrlimit failed, %d (%s)\n", > errno, strerror(errno)); > } > } > plemming1 = lemming1; > plemming2 = lemming2; > > { > int signals[] = {SIGSEGV}; > int i; > int result = 0; > > for (i = 0; result != -1 && i < (sizeof signals / sizeof signals[0]); ++i) { > struct sigaction sa; > sa.sa_sigaction = handleSegv; > sa.sa_flags = SA_RESTART | SA_SIGINFO; > sigemptyset(&sa.sa_mask); > result = sigaction(signals[i], &sa, NULL); > } > } > plemming1(); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 223954
: 146274 |
146386