Re: Are ppc*_elf_write_core_note Os-specific?

Alan Modra
2016-01-20T03:07:37Z

On Tue, Jan 19, 2016 at 10:52:33PM +0000, Pedro Alves wrote:
> I think that ideally we'd give the same treatment to
> elfcore_write_prstatus; it's just that nobody ever did the leg work.

Some leg work. For all linux targets except mips n32 which has a
64-bit pr_sigpend and pr_sighold, we have

struct elf_prstatus
{
struct elf_siginfo pr_info;
short int pr_cursig;
unsigned long int pr_sigpend;
unsigned long int pr_sighold;
__pid_t pr_pid;
__pid_t pr_ppid;
__pid_t pr_pgrp;
__pid_t pr_sid;
struct timeval pr_utime;
struct timeval pr_stime;
struct timeval pr_cutime;
struct timeval pr_cstime;
elf_gregset_t pr_reg;
int pr_fpvalid;
};

struct elf_siginfo is three ints, struct timeval is two longs except
for sparc where tv_usec is an int, __pid_t is an int. elf_gregset_t
of course varies. Unless I'm missing some odd target struct alignment
rule, I think that means linux needs a 32-bit and 64-bit variant of
elfcore_write_linux_prprstatus with parameters similar to
elfcore_write_linux_prpsinfo*, and special cases for mips n32 and
sparc64. I'd assume gdb's new elf_internal_linux_prstatus struct
would contain a pointer to and size of regs in target format. Host
format would be messy since some 64-bit targets have the odd 32-bit
reg hidden away in elf_gregset_t.

--
Alan Modra
Australia Development Lab, IBM