luto at mit dot edu
2015-08-25 23:07:15 UTC
https://sourceware.org/bugzilla/show_bug.cgi?id=18869
Bug ID: 18869
Summary: internal-error: inline_frame_this_id: Assertion
`frame_id_p (*this_id)' failed.
Product: gdb
Version: 7.9
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: luto at mit dot edu
Target Milestone: ---
Build this awful hack with -m32 -O2 -g.
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <sys/user.h>
#include <unistd.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <err.h>
#include <string.h>
#include <sys/auxv.h>
static void *vsyscall32;
static void do_full_vsyscall32(unsigned long *nr,
unsigned long *arg0, unsigned long *arg1,
unsigned long *arg2, unsigned long *arg3,
unsigned long *arg4, unsigned long *arg5)
{
/*
* The asm above is still correct, but GCC can't generate code.
*
* Because we want to preserve the values in all the registers
* after return, we need to spill to the stack. Ideally we'd
* force gcc to generate esp-relative references to some local
* variables, but I don't think that's possible. That means
* that we can't use any memory operands while ebp is arg5
* instead of the base pointer, so we're stuck manually
* spilling.
*/
register unsigned long sp asm("sp"); /* Hack: block fp omission */
unsigned long saved_bx;
asm volatile (
"movl %%ebx, %[saved_bx]\n\t"
"pushl %%ebp\n\t"
"movl %[arg0], %%ebx\n\t"
"movl %[arg5], %%ebp\n\t"
"call *%[vsyscall32]\n\t"
"xchgl %%ebp, (%%esp)\n\t" /* restore BP but keep arg5 */
"popl %[arg5]\n\t"
"movl %%ebx, %[arg0]\n\t"
"movl %[saved_bx], %%ebx"
: "+a" (*nr), [arg0] "+m" (*arg0), "+c" (*arg1), "+d" (*arg2),
"+S" (*arg3), "+D" (*arg4), [arg5] "+m" (*arg5),
[saved_bx] "+m" (saved_bx),
"+r" (sp)
: [vsyscall32] "m" (vsyscall32));
}
int main()
{
unsigned long nr = 224, a0 = 10, a1 = 11, a2 = 12, a3 = 13, a4 = 14, a5
= 15;
vsyscall32 = (void *)getauxval(AT_SYSINFO);
if (vsyscall32) {
nr = SYS_kill;
a0 = getpid();
a1 = SIGUSR1; /* <-- breakpoint here */
do_full_vsyscall32(&nr, &a0, &a1, &a2, &a3, &a4, &a5);
printf("%ld %ld %ld %ld %ld %ld %ld\n",
nr, a0, a1, a2, a3, a4, a5);
}
return 0;
}
$ gdb ./a.out
GNU gdb (GDB) Fedora 7.9.1-17.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) b foo.c:60
Breakpoint 1 at 0x8048411: file foo.c, line 60.
(gdb) r
Starting program: /home/luto/apps/linux-devel/tools/testing/selftests/x86/a.out
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-7.fc22.i686
Program received signal SIGUSR1, User defined signal 1.
0xf7fdac10 in __kernel_vsyscall ()
(gdb) bt
../../gdb/inline-frame.c:167: internal-error: inline_frame_this_id: Assertion
`frame_id_p (*this_id)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
Bug ID: 18869
Summary: internal-error: inline_frame_this_id: Assertion
`frame_id_p (*this_id)' failed.
Product: gdb
Version: 7.9
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: luto at mit dot edu
Target Milestone: ---
Build this awful hack with -m32 -O2 -g.
#include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
#include <sys/user.h>
#include <unistd.h>
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <err.h>
#include <string.h>
#include <sys/auxv.h>
static void *vsyscall32;
static void do_full_vsyscall32(unsigned long *nr,
unsigned long *arg0, unsigned long *arg1,
unsigned long *arg2, unsigned long *arg3,
unsigned long *arg4, unsigned long *arg5)
{
/*
* The asm above is still correct, but GCC can't generate code.
*
* Because we want to preserve the values in all the registers
* after return, we need to spill to the stack. Ideally we'd
* force gcc to generate esp-relative references to some local
* variables, but I don't think that's possible. That means
* that we can't use any memory operands while ebp is arg5
* instead of the base pointer, so we're stuck manually
* spilling.
*/
register unsigned long sp asm("sp"); /* Hack: block fp omission */
unsigned long saved_bx;
asm volatile (
"movl %%ebx, %[saved_bx]\n\t"
"pushl %%ebp\n\t"
"movl %[arg0], %%ebx\n\t"
"movl %[arg5], %%ebp\n\t"
"call *%[vsyscall32]\n\t"
"xchgl %%ebp, (%%esp)\n\t" /* restore BP but keep arg5 */
"popl %[arg5]\n\t"
"movl %%ebx, %[arg0]\n\t"
"movl %[saved_bx], %%ebx"
: "+a" (*nr), [arg0] "+m" (*arg0), "+c" (*arg1), "+d" (*arg2),
"+S" (*arg3), "+D" (*arg4), [arg5] "+m" (*arg5),
[saved_bx] "+m" (saved_bx),
"+r" (sp)
: [vsyscall32] "m" (vsyscall32));
}
int main()
{
unsigned long nr = 224, a0 = 10, a1 = 11, a2 = 12, a3 = 13, a4 = 14, a5
= 15;
vsyscall32 = (void *)getauxval(AT_SYSINFO);
if (vsyscall32) {
nr = SYS_kill;
a0 = getpid();
a1 = SIGUSR1; /* <-- breakpoint here */
do_full_vsyscall32(&nr, &a0, &a1, &a2, &a3, &a4, &a5);
printf("%ld %ld %ld %ld %ld %ld %ld\n",
nr, a0, a1, a2, a3, a4, a5);
}
return 0;
}
$ gdb ./a.out
GNU gdb (GDB) Fedora 7.9.1-17.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.
(gdb) b foo.c:60
Breakpoint 1 at 0x8048411: file foo.c, line 60.
(gdb) r
Starting program: /home/luto/apps/linux-devel/tools/testing/selftests/x86/a.out
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.21-7.fc22.i686
Program received signal SIGUSR1, User defined signal 1.
0xf7fdac10 in __kernel_vsyscall ()
(gdb) bt
../../gdb/inline-frame.c:167: internal-error: inline_frame_this_id: Assertion
`frame_id_p (*this_id)' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
--
You are receiving this mail because:
You are on the CC list for the bug.
You are receiving this mail because:
You are on the CC list for the bug.