public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Error while debugging a program using debugglibc.sh
@ 2019-10-28 21:55 Nisarg Shah
  2019-10-29  2:03 ` Nisarg Shah
  2019-10-29  2:50 ` Carlos O'Donell
  0 siblings, 2 replies; 7+ messages in thread
From: Nisarg Shah @ 2019-10-28 21:55 UTC (permalink / raw)
  To: libc-help

OS: Ubuntu 18.04 64-bit
System glibc: 2.27-3ubuntu1
New glibc: built from master branch

Hi all,
I'm following steps from
https://sourceware.org/glibc/wiki/Testing/Builds to install and use a
new glibc alongside the default system installation. After building it
and compiling a simple multithreaded program against it, when I try to
run it under GDB using the debugglibc.sh, I get the following error -

The multithreaded program is copied from
https://timmurphy.org/2010/05/04/pthreads-in-c-a-minimal-working-example/

Steps to compile the program -

SYSROOT=/home/<user>/glibc-master (this is where I installed glibc
using DESTDIR env variable)
gcc \
  -L${SYSROOT}/usr/lib64 \
  -I${SYSROOT}/include \
  --sysroot=${SYSROOT} \
  -Wl,-rpath=${SYSROOT}/lib64 \
  -Wl,--dynamic-linker=${SYSROOT}/lib64/ld-2.18.90.so\
  -pthread /mnt/hd/pthreads_simple.c

Steps followed to run GDB -

$ cd /mnt/hd/glibc-master-build/
$ ./debugglibc.sh /mnt/hd/a.out
Debugging glibc...
Build directory  : /mnt/hd/glibc-master-build/
Source directory : /mnt/hd/glibc
GLIBC Testcase   : /mnt/hd/a.out
GDB Commands     : /mnt/hd/glibc-master-build/debugglibc.gdb
Env vars         :
Reading symbols from /mnt/hd/glibc-master-build//elf/ld.so...done.
/mnt/hd/glibc-master-build/debugglibc.gdb:5: Error in sourced command file:
***The address where /mnt/hd/a.out has been loaded is missing***

I'm not sure how to resolve this. This is the first time I'm
attempting to build/install glib. Any help would be appreciated.

Nisarg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error while debugging a program using debugglibc.sh
  2019-10-28 21:55 Error while debugging a program using debugglibc.sh Nisarg Shah
@ 2019-10-29  2:03 ` Nisarg Shah
  2019-10-29  2:50 ` Carlos O'Donell
  1 sibling, 0 replies; 7+ messages in thread
From: Nisarg Shah @ 2019-10-29  2:03 UTC (permalink / raw)
  To: libc-help

Here are the results from "make check", if it helps -

UNSUPPORTED: elf/tst-audit10
UNSUPPORTED: elf/tst-avx512
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
FAIL: io/ftwtest
UNSUPPORTED: math/test-double-libmvec-sincos-avx512
UNSUPPORTED: math/test-float-libmvec-sincosf-avx512
UNSUPPORTED: misc/tst-pkey
FAIL: nptl/tst-umask1
FAIL: posix/globtest
FAIL: posix/tst-chmod
FAIL: posix/tst-execl2
FAIL: posix/tst-execle2
FAIL: posix/tst-execlp2
FAIL: posix/tst-execv2
FAIL: posix/tst-execve2
FAIL: posix/tst-execvp2
FAIL: posix/tst-execvpe2
UNSUPPORTED: resolv/tst-resolv-ai_idn
UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
Summary of test results:
     11 FAIL
   5164 PASS
      7 UNSUPPORTED
     17 XFAIL
      2 XPASS

On Mon, Oct 28, 2019 at 4:54 PM Nisarg Shah <nisargshah323@gmail.com> wrote:
>
> OS: Ubuntu 18.04 64-bit
> System glibc: 2.27-3ubuntu1
> New glibc: built from master branch
>
> Hi all,
> I'm following steps from
> https://sourceware.org/glibc/wiki/Testing/Builds to install and use a
> new glibc alongside the default system installation. After building it
> and compiling a simple multithreaded program against it, when I try to
> run it under GDB using the debugglibc.sh, I get the following error -
>
> The multithreaded program is copied from
> https://timmurphy.org/2010/05/04/pthreads-in-c-a-minimal-working-example/
>
> Steps to compile the program -
>
> SYSROOT=/home/<user>/glibc-master (this is where I installed glibc
> using DESTDIR env variable)
> gcc \
>   -L${SYSROOT}/usr/lib64 \
>   -I${SYSROOT}/include \
>   --sysroot=${SYSROOT} \
>   -Wl,-rpath=${SYSROOT}/lib64 \
>   -Wl,--dynamic-linker=${SYSROOT}/lib64/ld-2.18.90.so\
>   -pthread /mnt/hd/pthreads_simple.c
>
> Steps followed to run GDB -
>
> $ cd /mnt/hd/glibc-master-build/
> $ ./debugglibc.sh /mnt/hd/a.out
> Debugging glibc...
> Build directory  : /mnt/hd/glibc-master-build/
> Source directory : /mnt/hd/glibc
> GLIBC Testcase   : /mnt/hd/a.out
> GDB Commands     : /mnt/hd/glibc-master-build/debugglibc.gdb
> Env vars         :
> Reading symbols from /mnt/hd/glibc-master-build//elf/ld.so...done.
> /mnt/hd/glibc-master-build/debugglibc.gdb:5: Error in sourced command file:
> ***The address where /mnt/hd/a.out has been loaded is missing***
>
> I'm not sure how to resolve this. This is the first time I'm
> attempting to build/install glib. Any help would be appreciated.
>
> Nisarg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error while debugging a program using debugglibc.sh
  2019-10-28 21:55 Error while debugging a program using debugglibc.sh Nisarg Shah
  2019-10-29  2:03 ` Nisarg Shah
@ 2019-10-29  2:50 ` Carlos O'Donell
  2019-10-29  3:18   ` Nisarg Shah
  1 sibling, 1 reply; 7+ messages in thread
From: Carlos O'Donell @ 2019-10-29  2:50 UTC (permalink / raw)
  To: Nisarg Shah, libc-help

On 10/28/19 5:54 PM, Nisarg Shah wrote:
> OS: Ubuntu 18.04 64-bit
> System glibc: 2.27-3ubuntu1
> New glibc: built from master branch
> 
> Hi all,
> I'm following steps from
> https://sourceware.org/glibc/wiki/Testing/Builds to install and use a
> new glibc alongside the default system installation. After building it
> and compiling a simple multithreaded program against it, when I try to
> run it under GDB using the debugglibc.sh, I get the following error -
> 
> The multithreaded program is copied from
> https://timmurphy.org/2010/05/04/pthreads-in-c-a-minimal-working-example/
> 
> Steps to compile the program -
> 
> SYSROOT=/home/<user>/glibc-master (this is where I installed glibc
> using DESTDIR env variable)
> gcc \
>   -L${SYSROOT}/usr/lib64 \
>   -I${SYSROOT}/include \
>   --sysroot=${SYSROOT} \
>   -Wl,-rpath=${SYSROOT}/lib64 \
>   -Wl,--dynamic-linker=${SYSROOT}/lib64/ld-2.18.90.so\
>   -pthread /mnt/hd/pthreads_simple.c
> 
> Steps followed to run GDB -
> 
> $ cd /mnt/hd/glibc-master-build/
> $ ./debugglibc.sh /mnt/hd/a.out

OK.

> Debugging glibc...
> Build directory  : /mnt/hd/glibc-master-build/
> Source directory : /mnt/hd/glibc
> GLIBC Testcase   : /mnt/hd/a.out
> GDB Commands     : /mnt/hd/glibc-master-build/debugglibc.gdb
> Env vars         :
> Reading symbols from /mnt/hd/glibc-master-build//elf/ld.so...done.
> /mnt/hd/glibc-master-build/debugglibc.gdb:5: Error in sourced command file:
> ***The address where /mnt/hd/a.out has been loaded is missing***

This indicates that gdb had a problem determining where a.out should be lodaed.

This isn't normal.

Where did the toolchain you are using come from? Is the gcc you are using
part of your distribution? What distribution are you using?

> I'm not sure how to resolve this. This is the first time I'm
> attempting to build/install glib. Any help would be appreciated.

Can you try this?

./debugglibc.sh ./nptl/tst-align

And see if debugging a normal glibc test case works?

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error while debugging a program using debugglibc.sh
  2019-10-29  2:50 ` Carlos O'Donell
@ 2019-10-29  3:18   ` Nisarg Shah
  2019-10-29 17:13     ` Nisarg Shah
  2019-10-29 17:35     ` Florian Weimer
  0 siblings, 2 replies; 7+ messages in thread
From: Nisarg Shah @ 2019-10-29  3:18 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: libc-help

Hi Carlos,

> Where did the toolchain you are using come from? Is the gcc you are using
> part of your distribution? What distribution are you using?

I'm using Ubuntu 18.04.3 64-bit.
Toolchain is the default provided by Ubuntu. gcc is part of the distribution.
$ gcc --version
gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

libc-bin package provided by distribution is at 2.27-3ubuntu1

> Can you try this?
>
> ./debugglibc.sh ./nptl/tst-align
>
> And see if debugging a normal glibc test case works?

I get the same error on trying the above command.

$ ./debugglibc.sh ./nptl/tst-align
Debugging glibc...
Build directory  : /mnt/hd/glibc-master-build/
Source directory : /mnt/hd/glibc
GLIBC Testcase   : ./nptl/tst-align
GDB Commands     : /mnt/hd/glibc-master-build/debugglibc.gdb
Env vars         :
Reading symbols from /mnt/hd/glibc-master-build//elf/ld.so...done.
/mnt/hd/glibc-master-build/debugglibc.gdb:5: Error in sourced command file:
The address where ./nptl/tst-align has been loaded is missing

Thanks
Nisarg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error while debugging a program using debugglibc.sh
  2019-10-29  3:18   ` Nisarg Shah
@ 2019-10-29 17:13     ` Nisarg Shah
  2019-10-29 17:29       ` Carlos O'Donell
  2019-10-29 17:35     ` Florian Weimer
  1 sibling, 1 reply; 7+ messages in thread
From: Nisarg Shah @ 2019-10-29 17:13 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: libc-help

If I run the same program under normal GDB, it works as expected -

$ gdb ./a.out
GNU gdb (Ubuntu 8.1-0ubuntu3.1) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...done.

On Mon, Oct 28, 2019 at 10:17 PM Nisarg Shah <nisargshah323@gmail.com> wrote:
>
> Hi Carlos,
>
> > Where did the toolchain you are using come from? Is the gcc you are using
> > part of your distribution? What distribution are you using?
>
> I'm using Ubuntu 18.04.3 64-bit.
> Toolchain is the default provided by Ubuntu. gcc is part of the distribution.
> $ gcc --version
> gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
>
> libc-bin package provided by distribution is at 2.27-3ubuntu1
>
> > Can you try this?
> >
> > ./debugglibc.sh ./nptl/tst-align
> >
> > And see if debugging a normal glibc test case works?
>
> I get the same error on trying the above command.
>
> $ ./debugglibc.sh ./nptl/tst-align
> Debugging glibc...
> Build directory  : /mnt/hd/glibc-master-build/
> Source directory : /mnt/hd/glibc
> GLIBC Testcase   : ./nptl/tst-align
> GDB Commands     : /mnt/hd/glibc-master-build/debugglibc.gdb
> Env vars         :
> Reading symbols from /mnt/hd/glibc-master-build//elf/ld.so...done.
> /mnt/hd/glibc-master-build/debugglibc.gdb:5: Error in sourced command file:
> The address where ./nptl/tst-align has been loaded is missing
>
> Thanks
> Nisarg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error while debugging a program using debugglibc.sh
  2019-10-29 17:13     ` Nisarg Shah
@ 2019-10-29 17:29       ` Carlos O'Donell
  0 siblings, 0 replies; 7+ messages in thread
From: Carlos O'Donell @ 2019-10-29 17:29 UTC (permalink / raw)
  To: Nisarg Shah; +Cc: libc-help

On 10/29/19 1:12 PM, Nisarg Shah wrote:
> If I run the same program under normal GDB, it works as expected -

That doesn't setup the debugger correctly and it will fail to debug
mulit-threaded binaries.
 
> $ gdb ./a.out
> GNU gdb (Ubuntu 8.1-0ubuntu3.1) 8.1.0.20180409-git
> Copyright (C) 2018 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "x86_64-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
> <http://www.gnu.org/software/gdb/documentation/>.
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from ./a.out...done.

If debugglibc.sh doesn't work for you because of the way your system
compiler operates then you will have to follow the manual instructions.

You will debug the application as you did above, but you have to configure
the other settings by hand as documented in the wiki.

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Error while debugging a program using debugglibc.sh
  2019-10-29  3:18   ` Nisarg Shah
  2019-10-29 17:13     ` Nisarg Shah
@ 2019-10-29 17:35     ` Florian Weimer
  1 sibling, 0 replies; 7+ messages in thread
From: Florian Weimer @ 2019-10-29 17:35 UTC (permalink / raw)
  To: Nisarg Shah; +Cc: Carlos O'Donell, libc-help

* Nisarg Shah:

> Hi Carlos,
>
>> Where did the toolchain you are using come from? Is the gcc you are using
>> part of your distribution? What distribution are you using?
>
> I'm using Ubuntu 18.04.3 64-bit.
> Toolchain is the default provided by Ubuntu. gcc is part of the distribution.
> $ gcc --version
> gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
>
> libc-bin package provided by distribution is at 2.27-3ubuntu1
>
>> Can you try this?
>>
>> ./debugglibc.sh ./nptl/tst-align
>>
>> And see if debugging a normal glibc test case works?
>
> I get the same error on trying the above command.
>
> $ ./debugglibc.sh ./nptl/tst-align
> Debugging glibc...
> Build directory  : /mnt/hd/glibc-master-build/
> Source directory : /mnt/hd/glibc
> GLIBC Testcase   : ./nptl/tst-align
> GDB Commands     : /mnt/hd/glibc-master-build/debugglibc.gdb
> Env vars         :
> Reading symbols from /mnt/hd/glibc-master-build//elf/ld.so...done.
> /mnt/hd/glibc-master-build/debugglibc.gdb:5: Error in sourced command file:
> The address where ./nptl/tst-align has been loaded is missing

I'm not sure if anyone has got this working with the Debian or Ubuntu
GDB version.  For this kind of debugging of an explicit loader
invocation, I had reasonably good debugging experience on Fedora
(since basically forever), but GDB 8.2.1 on Debian does not find
debugging information even though it's there.  I'm beginning to
suspect this is due to one of the many Fedora downstream-only patches.
 8-/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-10-29 17:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 21:55 Error while debugging a program using debugglibc.sh Nisarg Shah
2019-10-29  2:03 ` Nisarg Shah
2019-10-29  2:50 ` Carlos O'Donell
2019-10-29  3:18   ` Nisarg Shah
2019-10-29 17:13     ` Nisarg Shah
2019-10-29 17:29       ` Carlos O'Donell
2019-10-29 17:35     ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).