* Beginner question regarding gdb symbol files
@ 2008-02-21 13:47 luca regini
2008-02-21 16:53 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: luca regini @ 2008-02-21 13:47 UTC (permalink / raw)
To: gdb
I have a project that is organized like the Makefile that follows. I
have an executable that links two shared objects. I separate debug
symbols from shared libraries and executable files. I would like to
debug the stripped executable using the stripped symbols. Sadly i am
not able to view any debug information. I tryed to use both the
symbol-file and add-symbol-file to read the stripped symbols.
Any help is very appreciated.
libbellac.so: bellaclib.c
gcc -g -c bellaclib.c -o bellac.o
gcc -g -s -shared -Wl,-soname,libbellac.so -o libbellac.so bellac.o
strip bellac.o --only-keep-debug -o clib.dbg
libbellacpp.so: bellacpplib.cpp
g++ -g -c bellacpplib.cpp -o bellacpp.o
g++ -g -s -shared -Wl,-soname,libbellacpp.so -o libbellacpp.so bellacpp.o
strip bellacpp.o --only-keep-debug -o cpplib.dbg
all: main.cpp libbellac.so libbellacpp.so
g++ -g -c main.cpp -o main.o
g++ -s main.o libbellac.so libbellacpp.so -o test
strip main.o --only-keep-debug -o test.dbg
clean:
rm -f *.so *.o *.dbg
Greets,
Luca
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-21 13:47 Beginner question regarding gdb symbol files luca regini
@ 2008-02-21 16:53 ` Daniel Jacobowitz
2008-02-28 16:13 ` luca regini
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2008-02-21 16:53 UTC (permalink / raw)
To: luca regini; +Cc: gdb
On Thu, Feb 21, 2008 at 02:43:58PM +0100, luca regini wrote:
> I have a project that is organized like the Makefile that follows. I
> have an executable that links two shared objects. I separate debug
> symbols from shared libraries and executable files. I would like to
> debug the stripped executable using the stripped symbols. Sadly i am
> not able to view any debug information. I tryed to use both the
> symbol-file and add-symbol-file to read the stripped symbols.
> Any help is very appreciated.
If you use --only-keep-debug, also use objcopy --add-gnu-debuglink to
create the final executable. GDB needs that pointer from your program
to the debug file.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-21 16:53 ` Daniel Jacobowitz
@ 2008-02-28 16:13 ` luca regini
2008-02-28 16:53 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: luca regini @ 2008-02-28 16:13 UTC (permalink / raw)
To: luca regini, gdb
I have another question regarding gdb and debugging.
I would like to debug a plug-in written for a server application. This
plugin is compiled as a shared library that includes symbols.
The server application doesn't come with symbols neither source code.
I have problems debugging my plugin code in these conditions.
I tried to use the --add-gnu-debuglink option to link in the server's
symbols but i am still unable to debug my module. Do i need both the
server symbols and source files? Is it possibile to debug the pluging
using only it's symbols and sources?
Thanks in advance.
Luca
How does gdb behaves when it doesn't see all the source files of a
process? I have this situation
On Thu, Feb 21, 2008 at 2:47 PM, Daniel Jacobowitz <drow@false.org> wrote:
> On Thu, Feb 21, 2008 at 02:43:58PM +0100, luca regini wrote:
> > I have a project that is organized like the Makefile that follows. I
> > have an executable that links two shared objects. I separate debug
> > symbols from shared libraries and executable files. I would like to
> > debug the stripped executable using the stripped symbols. Sadly i am
> > not able to view any debug information. I tryed to use both the
> > symbol-file and add-symbol-file to read the stripped symbols.
> > Any help is very appreciated.
>
> If you use --only-keep-debug, also use objcopy --add-gnu-debuglink to
> create the final executable. GDB needs that pointer from your program
> to the debug file.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-28 16:13 ` luca regini
@ 2008-02-28 16:53 ` Daniel Jacobowitz
2008-02-28 17:00 ` luca regini
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2008-02-28 16:53 UTC (permalink / raw)
To: luca regini; +Cc: gdb
On Thu, Feb 28, 2008 at 04:57:02PM +0100, luca regini wrote:
> I have another question regarding gdb and debugging.
> I would like to debug a plug-in written for a server application. This
> plugin is compiled as a shared library that includes symbols.
> The server application doesn't come with symbols neither source code.
> I have problems debugging my plugin code in these conditions.
> I tried to use the --add-gnu-debuglink option to link in the server's
> symbols but i am still unable to debug my module. Do i need both the
> server symbols and source files? Is it possibile to debug the pluging
> using only it's symbols and sources?
--add-gnu-debuglink is not related to this situation. GDB should
automatically load symbols for your plugin when the application loads
it. What doesn't work?
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-28 16:53 ` Daniel Jacobowitz
@ 2008-02-28 17:00 ` luca regini
2008-02-28 17:13 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: luca regini @ 2008-02-28 17:00 UTC (permalink / raw)
To: luca regini, gdb
>
> --add-gnu-debuglink is not related to this situation. GDB should
> automatically load symbols for your plugin when the application loads
> it. What doesn't work?
>
The plug-in is loaded dynamically by the server application so it runs
in the server application address space. When i try to attach to the
server application gdb displays a message about a successeful load of
the symbols but then complains about missing source files, then i am
not able to set a breakpoint in the source of the plug-in.
Luca
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-28 17:00 ` luca regini
@ 2008-02-28 17:13 ` Daniel Jacobowitz
2008-02-29 1:10 ` Michael Snyder
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2008-02-28 17:13 UTC (permalink / raw)
To: luca regini; +Cc: gdb
On Thu, Feb 28, 2008 at 05:52:42PM +0100, luca regini wrote:
> >
> > --add-gnu-debuglink is not related to this situation. GDB should
> > automatically load symbols for your plugin when the application loads
> > it. What doesn't work?
> >
>
> The plug-in is loaded dynamically by the server application so it runs
> in the server application address space. When i try to attach to the
> server application gdb displays a message about a successeful load of
> the symbols but then complains about missing source files, then i am
> not able to set a breakpoint in the source of the plug-in.
Sorry, this is not enough information. We need the exact output from
GDB to help you.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-28 17:13 ` Daniel Jacobowitz
@ 2008-02-29 1:10 ` Michael Snyder
2008-02-29 13:40 ` luca regini
0 siblings, 1 reply; 9+ messages in thread
From: Michael Snyder @ 2008-02-29 1:10 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: luca regini, gdb
On Thu, 2008-02-28 at 11:59 -0500, Daniel Jacobowitz wrote:
> On Thu, Feb 28, 2008 at 05:52:42PM +0100, luca regini wrote:
> > >
> > > --add-gnu-debuglink is not related to this situation. GDB should
> > > automatically load symbols for your plugin when the application loads
> > > it. What doesn't work?
> > >
> >
> > The plug-in is loaded dynamically by the server application so it runs
> > in the server application address space. When i try to attach to the
> > server application gdb displays a message about a successeful load of
> > the symbols but then complains about missing source files, then i am
> > not able to set a breakpoint in the source of the plug-in.
>
> Sorry, this is not enough information. We need the exact output from
> GDB to help you.
Yes, please attach a log of your gdb session.
Thanks.
You say you're using attach?
What happens if you launch the server under gdb?
What happens if you attach to the server before it dlopens the plugin?
(I assume you're using dlopen...)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-29 1:10 ` Michael Snyder
@ 2008-02-29 13:40 ` luca regini
2008-02-29 18:19 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: luca regini @ 2008-02-29 13:40 UTC (permalink / raw)
To: gdb; +Cc: Daniel Jacobowitz
The server is an openldap server. The binary comes directly from the
fedora package for it. My plugin is a custom openldap backend that is
loaded into the server using a libtool facility: lt_dlopenext.
This is the output that i get when i try run gdb slapd immediatly:
gdb slapd
(gdb) start
Breakpoint 1 at 0x14bc7: file ../../../servers/slapd/main.c, line 304.
Starting program: /opt/six/sbin/slapd
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x14bc7: Input/output error.
This is what i got when i try to attach to the process:
(gdb) attach 29764
Attaching to process 29764
Reading symbols from /opt/six/sbin/slapd...Reading symbols from
/opt/six/sbin/slapd.dbg...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
done.
0x00116c68 in hex ()
(gdb)
.
If i compile openldap directly from the sources i don't have any
problem. These problems show up when i use the fedora openldap rpm
also with the debug-info package is installed.
Thanks in advance.
Luca
On Thu, Feb 28, 2008 at 8:35 PM, Michael Snyder <msnyder@specifix.com> wrote:
>
> On Thu, 2008-02-28 at 11:59 -0500, Daniel Jacobowitz wrote:
> > On Thu, Feb 28, 2008 at 05:52:42PM +0100, luca regini wrote:
> > > >
> > > > --add-gnu-debuglink is not related to this situation. GDB should
> > > > automatically load symbols for your plugin when the application loads
> > > > it. What doesn't work?
> > > >
> > >
> > > The plug-in is loaded dynamically by the server application so it runs
> > > in the server application address space. When i try to attach to the
> > > server application gdb displays a message about a successeful load of
> > > the symbols but then complains about missing source files, then i am
> > > not able to set a breakpoint in the source of the plug-in.
> >
> > Sorry, this is not enough information. We need the exact output from
> > GDB to help you.
>
> Yes, please attach a log of your gdb session.
> Thanks.
>
> You say you're using attach?
> What happens if you launch the server under gdb?
> What happens if you attach to the server before it dlopens the plugin?
> (I assume you're using dlopen...)
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Beginner question regarding gdb symbol files
2008-02-29 13:40 ` luca regini
@ 2008-02-29 18:19 ` Daniel Jacobowitz
0 siblings, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2008-02-29 18:19 UTC (permalink / raw)
To: luca regini; +Cc: gdb
On Fri, Feb 29, 2008 at 12:13:13PM +0100, luca regini wrote:
> The server is an openldap server. The binary comes directly from the
> fedora package for it. My plugin is a custom openldap backend that is
> loaded into the server using a libtool facility: lt_dlopenext.
> This is the output that i get when i try run gdb slapd immediatly:
>
> gdb slapd
> (gdb) start
> Breakpoint 1 at 0x14bc7: file ../../../servers/slapd/main.c, line 304.
> Starting program: /opt/six/sbin/slapd
> Warning:
> Cannot insert breakpoint 1.
> Error accessing memory address 0x14bc7: Input/output error.
This probably means that Fedora builds slapd as a PIE
(position-independent executable). GDB doesn't support those.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-02-29 13:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-21 13:47 Beginner question regarding gdb symbol files luca regini
2008-02-21 16:53 ` Daniel Jacobowitz
2008-02-28 16:13 ` luca regini
2008-02-28 16:53 ` Daniel Jacobowitz
2008-02-28 17:00 ` luca regini
2008-02-28 17:13 ` Daniel Jacobowitz
2008-02-29 1:10 ` Michael Snyder
2008-02-29 13:40 ` luca regini
2008-02-29 18:19 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox