|
From: Ghassan H. <gha...@no...> - 2006-04-06 14:41:17
|
We are running a multi-threaded application on Linux 2.4 for PowerPC
(with valgrind 3.1.1) and we're getting the valgrind error shown below.
valgrind: m_coredump/coredump-elf.c:267 (fill_prstatus): Assertion
'sizeof(*regs) =3D=3D sizeof(prs->pr_reg)' failed.
=3D=3D8227=3D=3D at 0x70014CF8: report_and_quit (m_libcassert.c:122)
=3D=3D8227=3D=3D by 0x70014F48: vgPlain_assert_fail =
(m_libcassert.c:185)
=3D=3D8227=3D=3D by 0x70051A8C: fill_prstatus (coredump-elf.c:267)
=3D=3D8227=3D=3D by 0x70051C90: make_elf_coredump =
(coredump-elf.c:369)
=3D=3D8227=3D=3D by 0x70051F78: vgPlain_make_coredump =
(coredump-elf.c:440)
=3D=3D8227=3D=3D by 0x70023864: default_action (m_signals.c:1147)
=3D=3D8227=3D=3D by 0x700239D0: deliver_signal (m_signals.c:1205)
=3D=3D8227=3D=3D by 0x70024AAC: vgPlain_poll_signals =
(m_signals.c:1818)
=3D=3D8227=3D=3D by 0x7005107C: vgPlain_post_syscall =
(syswrap-main.c:897)
=3D=3D8227=3D=3D by 0x70050D9C: vgPlain_client_syscall =
(syswrap-main.c:799)
=3D=3D8227=3D=3D by 0x7003BD80: handle_syscall (scheduler.c:623)
=3D=3D8227=3D=3D by 0x7003C188: vgPlain_scheduler (scheduler.c:726)
=3D=3D8227=3D=3D by 0x70052040: thread_wrapper (syswrap-linux.c:86)
=3D=3D8227=3D=3D by 0x70052174: run_a_thread_NORETURN =
(syswrap-linux.c:119)
We did some research and found that in
<valgrind>/coregrind/m_coredump/coredump-elf.c, the statement
vg_assert(sizeof(*regs) =3D=3D sizeof(prs->pr_reg));
fails because the following two data structures in
<valgrind>/include/vki-ppc32-linux.h do not have the same size:
1. struct vki_pt_regs {
unsigned long gpr[32];
unsigned long nip;
unsigned long msr;
unsigned long orig_gpr3; /* Used for restarting system
calls */
unsigned long ctr;
unsigned long link;
unsigned long xer;
unsigned long ccr;
unsigned long mq; /* 601 only (not used at
present) */
/* Used on APUS to hold IPL
value. */
unsigned long trap; /* Reason for being here */
/* N.B. for critical exceptions on 4xx, the dar and dsisr
fields are overloaded to hold srr0 and srr1. */
unsigned long dar; /* Fault registers */
unsigned long dsisr; /* on 4xx/Book-E used for ESR */
unsigned long result; /* Result of a system call */
};
2. typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
To make them the same size, I added unsigned long pad[4] to the struct
(see below) and the problem went away.
struct vki_pt_regs {
unsigned long gpr[32];
unsigned long nip;
unsigned long msr;
unsigned long orig_gpr3; /* Used for restarting system
calls */
unsigned long ctr;
unsigned long link;
unsigned long xer;
unsigned long ccr;
unsigned long mq; /* 601 only (not used at
present) */
/* Used on APUS to hold IPL
value. */
unsigned long trap; /* Reason for being here */
/* N.B. for critical exceptions on 4xx, the dar and dsisr
fields are overloaded to hold srr0 and srr1. */
unsigned long dar; /* Fault registers */
unsigned long dsisr; /* on 4xx/Book-E used for ESR */
unsigned long result; /* Result of a system call */
unsigned long pad[4]; // <--- fix
};
|
|
From: Julian S. <js...@ac...> - 2006-04-14 11:15:59
|
> unsigned long pad[4]; // <--- fix Thanks. Committed (svn r5852). Fix will be in 3.2.0. J |