Re: gdb and PIE binaries

2016-11-11 Thread Roland McGrath
AFAIK gdb does not use fancy information like file-mapping stuff.
NT_FILE is probably hard to support on the Hurd, since we don't have
a way to go backwards from a memory object port to a file (let alone
a file name).

All GDB needs is to know where the PIE was loaded, so it can find the
DT_DEBUG and bootstrap the link_map list from there.  On Linux, NT_AUXV
in a core file has AT_ENTRY and from that and the ELF file, you can
figure out where the PIE was loaded.  In a live process, you read the
same info from /proc/$pid/auxv.

On the Hurd, we don't really have auxv at all.  But to simplify things
with GDB, we could have our core dumps include an NT_AUXV containing
just an AT_ENTRY value synthesized by other means.  Off hand I don't
recall anything we store that can be used to compute such a value.

Probably the right thing is to have the proc server keep that state like
it does arg_locations, with the exec server writing it and the debugger
and core-writer reading it.



Re: Time for another round of releases

2016-11-11 Thread Manolis Ragkousis
Hello Samuel

On 11/09/16 13:54, Samuel Thibault wrote:
> Manolis Ragkousis, on Wed 09 Nov 2016 13:02:14 +0200, wrote:
>> Now I only have problems with linking http://paste.lisp.org/display/330765
> 
> __gsync_wait and __gsync_wake are gnumach RPCs. They have been added to
> gnumach quite a long time ago, don't you have them in
> gnumach/include/mach/gnumach.defs?
> 
> Samuel
> 

Yes I do have them in gnumach/include/mach/gnumach.defs.

The linking errors appears both when building from Guix and on debian/hurd.

But I have managed to bypass the linking by first running make
mach/subdir_lib, make hurd/subdir_lib, make libpthread/subdir_lib and
then make all. It seems there is an issue with the order of subdirs
building.

Manolis





Re: gdb and PIE binaries

2016-11-11 Thread Samuel Thibault
Samuel Thibault, on Fri 11 Nov 2016 18:17:43 +0100, wrote:
> AIUI, what gdb misses is simply the name of the files being mapped:
> since the mappings may be random, it can't invent the file names.

I forgot to mention: on Linux, its provided in the core file through an
NT_FILE note.

Samuel



gdb and PIE binaries

2016-11-11 Thread Samuel Thibault
Hello,

Debian is pushing more and more PIE builds, so that address
randomization can be done. However, on GNU/Hurd, gdb can't work with
core files from processes running PIE programs, so one has to pass
CFLAGS=-no-pie etc. to be able to debug programs, it'll become more and
more problematic.

AIUI, what gdb misses is simply the name of the files being mapped:
since the mappings may be random, it can't invent the file names.  It
has been also raised several times that it'd be nice that running vminfo
$pid (and /proc/$pid/maps) would show file names. AIUI, it'd be a matter
of adding a char[] field to struct vm_object inside mach, that the
creator of the VM object would set to whatever it seems fit, here the
file name.

What do people think about it?  Could somebody have a look at
implementing it?

Samuel