Use elfcore_write_linux_prstatus in gdb

H.J. Lu hjl.tools@gmail.com
Thu Jan 21 14:17:00 GMT 2016


On Thu, Jan 21, 2016 at 6:05 AM, Pedro Alves <palves@redhat.com> wrote:
> On 01/21/2016 01:24 PM, H.J. Lu wrote:
>> On Thu, Jan 21, 2016 at 5:11 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 01/21/2016 12:25 PM, Pedro Alves wrote:
>>>> On 01/21/2016 09:28 AM, Alan Modra wrote:
>>>>> The gdb side.  Nothing fancy here, and no support for targets that
>>>>> need gdbarch_elfcore_write_linux_prstatus, mips n32, sparc64 if
>>>>> writing any of pr_{u,s,cu,cs}time, and probably x86-64 x32.
>>>>
>>>> Thanks a lot for doing all this!  I don't have spare cycles either to
>>>> drive this all the way to completion for all archs, I think we can still
>>>> move forward with it, by adding a stop-gap implementation those
>>>> archs, which just calls elfcore_write_prstatus.  I'll send it along
>>>> in a bit.
>>>
>>> Like this.  I've pushed this to the users/palves/core-prstatus-rework
>>> branch.  I've tested on x86_64 with:
>>>
>>>  make check RUNTESTFLAGS="--target_board unix/-m32" TESTS="*/*core*.exp"
>>>  make check RUNTESTFLAGS="--target_board unix/-m64" TESTS="*/*core*.exp"
>>
>> It failed
>>
>>  make check RUNTESTFLAGS="--target_board unix/-mx32" TESTS="*/*core*.exp"
>>
>> Please take a look at bfd/hosts/x86-64linux.h to see how to dump core
>> x86-64.
>
> I don't have x32 setup on my machine.  AFAICS, elf_prstatusx32 is exactly
> like elf_prstatus32, except it takes a 64-bit regset.
> Given gdbarch_ptr_bit==32 on x32, and:
>
>       else if (gdbarch_ptr_bit (data->gdbarch) == 64)
>         data->note_data = elfcore_write_linux_prstatus64 (data->obfd,
>                                                           data->note_data,
>                                                           data->note_size,
>                                                           &prstatus);
>       else
>         data->note_data = elfcore_write_linux_prstatus32 (data->obfd,
>                                                           data->note_data,
>                                                           data->note_size,
>                                                           &prstatus);
>
> elfcore_write_linux_prstatus32 should be reached.  Other than that,
> I have no idea (other than installing the stop gap on x32 too).
>

x32 has different core types (core layout) from m32 and m64.
See bfd/hosts/x86-64linux.h for details.  You need
elfcore_write_linux_prstatusx32 or change
elfcore_write_linux_prstatus32 to suport x32.


-- 
H.J.



More information about the Gdb-patches mailing list