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 147002 Details for
Bug 225531
ia64 PTRACE_GETREGS touches pt_all_user_regs words that should be left alone
[?]
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
pt-ia64-getregs-test.c (text/plain), 3.48 KB, created by
Roland McGrath
on 2007-01-31 05:40:54 UTC
(
hide
)
Description:
test case
Filename:
MIME Type:
Creator:
Roland McGrath
Created:
2007-01-31 05:40:54 UTC
Size:
3.48 KB
patch
obsolete
>/** > * A process attach it's child, if success , try to getregs use PTRACE_GETREGS, > * in EL5 beta, this failed with errno=EIO > */ > >#include <stdio.h> >#include <sys/ptrace.h> >#include <sys/types.h> >#include <sys/wait.h> >#include <unistd.h> >#include <errno.h> >#include <time.h> >#include <signal.h> >#include <assert.h> >#include <string.h> > >#define DUMMY_VALUE 12345 >static void fill_dummp (unsigned long *addr) { > int i, size; > > size = sizeof(struct pt_all_user_regs)/sizeof(unsigned long); > for (i=0; i<size; i++) { > *addr = DUMMY_VALUE; > addr++; > } >} > >static int start=-1; >static int len=0; >static void print_register_name(int index) { > int min; > > if (len == 0) { > start = index; > len =1; > } else if (index == (start+len)) > len++; > else while (len) { > switch (start) { > case 0 ... 4: > if (start == 0) > printf(" nat \n"); > else if (start == 1) > printf(" cr_iip \n"); > else if (start == 2) > printf(" cfm \n"); > else if (start == 3) > printf(" cr_ipsr \n"); > else if (start == 4) > printf(" pr \n"); > start++; > len--; > break; > case 5 ... 36: > min = 37 - start; > if (min > len) min = len; > printf(" gr%d --- gr%d \n", start-5, start+min-1-5); > start += min; > len -= min; > break; > case 37 ... 44: > min = 45 - start; > if (min > len) min = len; > printf(" br%d --- br%d \n", start-37, start+min-1-37); > start += min; > len -= min; > break; > case 45 ... 172: > min = 173 - start; > if (min > len) min = len; > printf(" ar%d --- ar%d \n", start-45, start+min-1-45); > start += min; > len -= min; > break; > /* this is padding space in pt_all_user_regs */ > case 173: > start++; > len--; > break; > case 174 ... 429: > printf(" fr%d --- fr%d \n", (start - 174)/2, (start - 174 + len -1)/2); > start += len; > len = 0; > break; > default: > break; > } > } >} > >static void print_unchanged_register(unsigned long *addr) { > int i, size; > > size = sizeof(struct pt_all_user_regs)/sizeof(unsigned long); > printf("Unmodified register by PTRACE_GETREGS request \n"); > for (i=0; i<size; i++) { > if (*addr == DUMMY_VALUE) { > print_register_name(i); > } > addr++; > } > /* To flush last register area */ > print_register_name(0x40000); > printf("\n"); >} > >int main(int argc, char ** argv, char ** envp) >{ > int pid; > long ret; > int i; > > if ((pid = fork()) == -1) { > perror ("fork"); > return -1; > } else if (pid == 0) { > //child process, an infinite loop > while(1){ > sleep(1); > } > return 0; > } else { > //parent process > int tmp_pid, status; > int err = 0; > char note=0; > struct pt_all_user_regs ptregs; > unsigned long *p; > /* > * attach child process > */ > ret = ptrace (PTRACE_ATTACH, pid, 0, 0); > if (ret != 0) { > perror ("PTRACE_ATTACH"); > return 0; > } > tmp_pid = wait4(pid, &status, WUNTRACED, NULL); > if (tmp_pid < 0) { > perror ("wait4 failed"); > return -1; > } > > /* > * use ptrace to get debugee's regs value > */ > fill_dummp((unsigned long*)&ptregs); > ret = ptrace( PTRACE_GETREGS, pid, 0, (unsigned long)&ptregs); > if( ret!=0){ > printf("Error code %d\n", ret); > perror("ptrace_getregs"); > return -1; > } > print_unchanged_register((unsigned long*)&ptregs); > /* > * detach from child prcoess > */ > ret = ptrace (PTRACE_KILL, pid, 0, 0); > if (ret != 0) { > perror ("ptrace_kill"); > return -1; > } > tmp_pid = wait4(pid, &status, WUNTRACED, NULL); > if (tmp_pid < 0) { > perror ("wait4 failed"); > return -1; > } > } > return 0; >} >
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 225531
: 147002 |
154319