Re: Are ppc*_elf_write_core_note Os-specific?
Pedro Alves <[email protected]>
| Newsgroups | gmane.comp.gdb.devel,gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
On 01/19/2016 09:20 PM, H.J. Lu wrote: > On Tue, Jan 19, 2016 at 12:54 PM, Pedro Alves <[email protected]> wrote: >> Can this be made to work along the lines of 70a38d42c5b3 ? >> > > Probably. See: > > https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=0b1b9b0935de0f6d97540d80dfb698444cb07072 > The thing is that GDB always knows the target ABI/OS it wants the core note to be generated for, so there should be no need to go through the bfd target vector to generate an OS-specific note, or to stuff everything through a crippling varargs interface such as elf_backend_write_core_note's. Instead, bfd can export OS-specific variants of the note generation functions, and GDB can call those directly. By avoiding the varargs-style strangling of elf_backend_write_core_note, it's also MUCH easier to pass down note-specific info. The original motivation of 70a38d42c5b3 (elfcore_write_linux_prpsinfo*) was so that we could fill in all fields of the Linux prpsinfo structure. (Note how elfcore_write_prpsinfo only takes a few parameters; it's missing a lot of others bits.) The gdb-side counterpart of 70a38d42c5b3 is b3ac9c77560a. All the Linux-specific NT_PRPSINFO handling in the different elf_backend_write_core_note implementations in bfd are dead code, I think, since GDB always calls elfcore_write_linux_prpsinfo* directly, and only GDB calls the elfcore_write_pr* functions. I think that ideally we'd give the same treatment to elfcore_write_prstatus; it's just that nobody ever did the leg work. Thanks, Pedro Alves