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 575976 Details for
Bug 810668
ptrace: GDB inferior calls with floats fail
[?]
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.
Attempt for a reproducer; nothing is reproduced.
fpregs-getset.c (text/plain), 4.23 KB, created by
Jan Kratochvil
on 2012-04-07 22:28:57 UTC
(
hide
)
Description:
Attempt for a reproducer; nothing is reproduced.
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2012-04-07 22:28:57 UTC
Size:
4.23 KB
patch
obsolete
>/* This software is provided 'as-is', without any express or implied > warranty. In no event will the authors be held liable for any damages > arising from the use of this software. > > Permission is granted to anyone to use this software for any purpose, > including commercial applications, and to alter it and redistribute it > freely. */ > >#define _GNU_SOURCE 1 >#ifdef __ia64__ >#define ia64_fpreg ia64_fpreg_DISABLE >#define pt_all_user_regs pt_all_user_regs_DISABLE >#endif /* __ia64__ */ >#include <sys/ptrace.h> >#ifdef __ia64__ >#undef ia64_fpreg >#undef pt_all_user_regs >#endif /* __ia64__ */ >#include <linux/ptrace.h> >#include <sys/types.h> >#include <sys/user.h> >#if defined __i386__ || defined __x86_64__ >#include <sys/debugreg.h> >#endif > >#include <unistd.h> >#include <assert.h> >#include <stdlib.h> >#include <signal.h> >#include <errno.h> >#include <error.h> >#include <stdio.h> >#include <sys/types.h> >#include <sys/wait.h> >#include <sys/procfs.h> >#include <string.h> >#include <stddef.h> > >#define LOOPS 10000 > >static pid_t child; > >static void >cleanup (void) >{ > if (child > 0) > kill (child, SIGKILL); >} > >static void >handler_fail (int signo) >{ > cleanup (); > signal (SIGABRT, SIG_DFL); > assert (0); >} > >static void __attribute__ ((noinline, noclone)) >f (volatile double pi) >{ > static double expect = 0; > >#if 0 > printf ("child pi = %f\n",pi); >#endif > > expect += 3.14; > assert (pi == expect); >} > >static void __attribute__ ((noinline, noclone)) >g (volatile double e) >{ > assert (e == 2.71); >} > >int main (void) >{ > int i, status, loop; > volatile double pi; > long l, f_long_orig, f_long_bpt; > > setbuf (stdout, NULL); > atexit (cleanup); > signal (SIGABRT, handler_fail); > signal (SIGINT, handler_fail); > signal (SIGALRM, handler_fail); >// alarm (1); > > child = fork(); > switch (child) > { > case -1: > perror ("fork()"); > exit (1); > /* NOTREACHED */ > case 0: > l = ptrace (PTRACE_TRACEME, 0, NULL, NULL); > assert (l == 0); > > raise (SIGSTOP); > > for (loop = 0; loop < LOOPS; loop++) > { > f (0); > g (2.71); > } > assert (0); > /* NOTREACHED */ > default:; > /* PASSTHRU */ > } > /* Parent. */ > > i = waitpid (child, &status, 0); > assert_perror (errno); > assert (i == child); > assert (WIFSTOPPED (status)); > assert (WSTOPSIG (status) == SIGSTOP); > > f_long_orig = ptrace (PTRACE_PEEKTEXT, child, f, NULL); > assert_perror (errno); > > f_long_bpt = (f_long_orig & ~0xFFL) | 0xcc; > > pi = 0; > for (loop = 0; loop < LOOPS; loop++) > { > elf_fpregset_t fpregs; > > l = ptrace (PTRACE_POKETEXT, child, f, (void *) f_long_bpt); > assert_perror (errno); > assert (l == 0); > > l = ptrace (PTRACE_CONT, child, NULL, NULL); > assert_perror (errno); > assert (l == 0); > > i = waitpid (child, &status, 0); > assert_perror (errno); > assert (i == child); > assert (WIFSTOPPED (status)); > assert (WSTOPSIG (status) == SIGTRAP); > > l = ptrace (PTRACE_PEEKUSER, child, > (void *) offsetof (struct user_regs_struct, rip), NULL); > assert_perror (errno); > assert (l == 1 + (long) f); > > l = ptrace (PTRACE_POKEUSER, child, > (void *) offsetof (struct user_regs_struct, rip), f); > assert_perror (errno); > assert (l == 0); > > l = ptrace (PTRACE_POKETEXT, child, f, (void *) f_long_orig); > assert_perror (errno); > assert (l == 0); > > pi += 3.14; > > l = ptrace (PTRACE_GETFPREGS, child, NULL, &fpregs); > assert_perror (errno); > assert (l == 0); > > assert (sizeof (pi) == 8); > assert (sizeof (fpregs.xmm_space) == 16 * 16); > assert (sizeof (fpregs.xmm_space[0]) == 4); > memcpy (&fpregs.xmm_space[0], (void *) &pi, 8); > memset (&fpregs.xmm_space[2], 0, 8); > > l = ptrace (PTRACE_SETFPREGS, child, NULL, &fpregs); > assert_perror (errno); > assert (l == 0); > > l = ptrace (PTRACE_SINGLESTEP, child, NULL, NULL); > assert_perror (errno); > assert (l == 0); > > i = waitpid (child, &status, 0); > assert_perror (errno); > assert (i == child); > assert (WIFSTOPPED (status)); > assert (WSTOPSIG (status) == SIGTRAP); > > l = ptrace (PTRACE_PEEKUSER, child, > (void *) offsetof (struct user_regs_struct, rip), NULL); > assert_perror (errno); > assert (l == 1 + (long) f); > } > > 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 810668
:
575976
|
577270
|
577491
|
578300