This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Cant debug on Gentoo 64
On Wed, Aug 6, 2008 at 1:48 AM, Eran Ifrah <eran.ifrah@gmail.com> wrote:
> warning: no loadable sections found in added symbol-file
> system-supplied DSO at <some address goes here>
I have just debugged this warning on our newer systems.
Are you using kernel 2.6.24 or above?
64-bit kernels that have VDSO, but are built with "old" binutils,
will trigger that warning.
You can verify whether your kernel is built correctly by compiling
and running this program:
--- cut ---
#include <elf.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
void dump_vdso(void *ptr)
{
int fd = open("vdso64.so", O_WRONLY|O_CREAT, 755);
if (-1 == fd) {
perror("open2"); exit(1);
}
printf("vdso at %p\n", ptr);
if (write(fd, ptr, 4096) != 4096) {
perror("write"); exit(1);
}
}
int main()
{
int fd = open("/proc/self/auxv", O_RDONLY, 0);
if (-1 == fd) {
perror("open"); exit(1);
}
Elf64_auxv_t auxv;
while (0 < read(fd, &auxv, sizeof(auxv))) {
switch (auxv.a_type) {
case AT_NULL: break;
case AT_SYSINFO_EHDR:
dump_vdso(auxv.a_un.a_ptr);
return 0;
}
}
printf("No AT_SYSINFO_EHDR found\n");
return 0;
}
--- cut ---
If it finds a kernel VDSO, it will dump it to disk.
Then do 'readelf -l vdso64.so'.
If you see this:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
LOAD 0x0000000000000000 0xffffffffff700000 0xffffffffff700000
0x0000000000000a50 0x0000000000000a50 R E 100000
(alignment other than 1000), your kernel build is bad.
> placing a breakpoint at main does not work and program simply executes
> until it terminates (return 0).
I didn't see that problem (but I am using gdb-6.8).
Cheers,
--
Paul Pluzhnikov