* Backtrace library?
@ 2009-08-20 21:17 John Yates
2009-08-21 7:48 ` Paul Pluzhnikov
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: John Yates @ 2009-08-20 21:17 UTC (permalink / raw)
To: gdb
Assuming I have an elf image compiled with full debugging information is there any library I can use to get a gdb-style backtrace with sourc path and line number rather than the C library's rather Spartan version?
/john
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: Backtrace library? 2009-08-20 21:17 Backtrace library? John Yates @ 2009-08-21 7:48 ` Paul Pluzhnikov 2009-08-21 15:46 ` paawan oza 2009-08-28 15:54 ` Pierre Muller 2 siblings, 0 replies; 8+ messages in thread From: Paul Pluzhnikov @ 2009-08-21 7:48 UTC (permalink / raw) To: John Yates; +Cc: gdb On Thu, Aug 20, 2009 at 1:27 PM, John Yates<jyates@netezza.com> wrote: > Assuming I have an elf image compiled with full debugging information > is there any library I can use to get a gdb-style backtrace with sourc > path and line number rather than the C library's rather Spartan version? I am not aware of any such library, but you can pipe the "spartan" output through addr2line and get desired result. Cheers, -- Paul Pluzhnikov ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Backtrace library? 2009-08-20 21:17 Backtrace library? John Yates 2009-08-21 7:48 ` Paul Pluzhnikov @ 2009-08-21 15:46 ` paawan oza 2009-08-27 14:35 ` Christophe-Marie Duquesne 2009-08-28 15:54 ` Pierre Muller 2 siblings, 1 reply; 8+ messages in thread From: paawan oza @ 2009-08-21 15:46 UTC (permalink / raw) To: gdb, John Yates I think backtrace function of glibc internally use unwind library interface to get backtrace. unwind library interface may be used. I am not sure exactly how gdb reads stack (just walk through esp/ebp or some other way) Regards, Oza. --- On Fri, 8/21/09, John Yates <jyates@netezza.com> wrote: > From: John Yates <jyates@netezza.com> > Subject: Backtrace library? > To: "gdb@sourceware.org" <gdb@sourceware.org> > Date: Friday, August 21, 2009, 1:57 AM > Assuming I have an elf image compiled > with full debugging information is there any library I can > use to get a gdb-style backtrace with sourc path and line > number rather than the C library's rather Spartan version? > > /john > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Backtrace library? 2009-08-21 15:46 ` paawan oza @ 2009-08-27 14:35 ` Christophe-Marie Duquesne 2009-08-27 15:45 ` John Yates 0 siblings, 1 reply; 8+ messages in thread From: Christophe-Marie Duquesne @ 2009-08-27 14:35 UTC (permalink / raw) To: paawan oza; +Cc: gdb, John Yates Hello, Maybe I'm arriving a bit late, but yesterday, I saw there was a C library libbacktrace which is supposed to replicate gdb's backtrace. I found it by chance while browsing the archlinux users repository : http://aur.archlinux.org/packages.php?ID=24369 This may help... -- Christophe-Marie Duquesne ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Backtrace library? 2009-08-27 14:35 ` Christophe-Marie Duquesne @ 2009-08-27 15:45 ` John Yates 2009-08-27 17:56 ` Christophe-Marie Duquesne 0 siblings, 1 reply; 8+ messages in thread From: John Yates @ 2009-08-27 15:45 UTC (permalink / raw) To: 'Christophe-Marie Duquesne', paawan oza; +Cc: gdb Christophe-Marie Duquesne writes: > I saw there was a C library libbacktrace which is supposed > to replicate gdb's backtrace. I found it by chance while > browsing the archlinux users repository : > http://aur.archlinux.org/packages.php?ID=24369 Thanks for the suggestion. Sadly this only maintains a stack in which code compiled with function entry and exit macros can explicitly push and pop file/lineno/function triples. It does not decode the contents of the image. /john ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Backtrace library? 2009-08-27 15:45 ` John Yates @ 2009-08-27 17:56 ` Christophe-Marie Duquesne 0 siblings, 0 replies; 8+ messages in thread From: Christophe-Marie Duquesne @ 2009-08-27 17:56 UTC (permalink / raw) To: John Yates; +Cc: paawan oza, gdb Not as good as it looked from the outside. I was wondering why nobody had mentioned it :) Sorry! -- Christophe-Marie Duquesne ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Backtrace library? 2009-08-20 21:17 Backtrace library? John Yates 2009-08-21 7:48 ` Paul Pluzhnikov 2009-08-21 15:46 ` paawan oza @ 2009-08-28 15:54 ` Pierre Muller 2009-08-28 16:03 ` Eli Zaretskii 2 siblings, 1 reply; 8+ messages in thread From: Pierre Muller @ 2009-08-28 15:54 UTC (permalink / raw) To: 'John Yates', gdb; +Cc: 'Eli Zaretskii' You could probably try to use Eli's work called bfdsymify.c This is based on GNU bfd library, but for DJGPP stack dumps written on a Dos console. But it can also handle a stack trace stored in a file. The version I have came with GDB 6.1.1 for DJGPP and BFD version is 2.15.90, but it might be easy to update. The sources are available ftp://ftp.univie.ac.at/applications/djgpp/v2gnu/gdb611s.zip To compile it for DJGPP on current CVS HEAD I had to change only a little, patch is below. To use it on other platform you might need to remove DJGPP specific stuff... Hope this can help you. Pierre Muller Pascal language support maintainer for GDB PS: Eli, is this source in any CVS tree? Pierre@d620-muller ~/gdbcvs/djbuild/bfdsymify $ diff -up ../../src/bfdsymify/bfdsymify.c bfdsymify.c --- ../../src/bfdsymify/bfdsymify.c 2009-08-28 17:00:44.781250000 +0200 +++ bfdsymify.c 2009-08-28 17:27:08.812500000 +0200 @@ -393,7 +393,8 @@ find_address_in_section (bfd *bfdp, asec if (pc < vma) return; - size = bfd_get_section_size_before_reloc (section); +// size = bfd_get_section_size_before_reloc (section); + size = bfd_get_section_size (section); if (pc >= vma + size) return; @@ -575,7 +576,8 @@ int main(int argc, char **argv) fputs(line, ofile); if (progname) { - char *arg_base = basename(progname), *prog_base = basename(line+9); + char *arg_base = lbasename(progname); + char *prog_base = lbasename(line+9); if (strcasecmp(prog_base, arg_base) && strncasecmp(prog_base, arg_base, strlen(prog_base)-4)) fprintf(stderr, @@ -675,7 +677,7 @@ int main(int argc, char **argv) } if (progname) { - char *arg_base = basename(progname), *prog_base = basename(prog); + char *arg_base = lbasename(progname), *prog_base = lbasename(prog); if (strcasecmp(prog_base, arg_base) && (strncasecmp(prog_base, arg_base, strlen(prog_base)-4) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Backtrace library? 2009-08-28 15:54 ` Pierre Muller @ 2009-08-28 16:03 ` Eli Zaretskii 0 siblings, 0 replies; 8+ messages in thread From: Eli Zaretskii @ 2009-08-28 16:03 UTC (permalink / raw) To: Pierre Muller; +Cc: jyates, gdb > From: "Pierre Muller" <muller@ics.u-strasbg.fr> > Cc: "'Eli Zaretskii'" <eliz@gnu.org> > Date: Fri, 28 Aug 2009 17:35:19 +0200 > > PS: Eli, is this source in any CVS tree? Not that I know of, no. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-28 15:54 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-08-20 21:17 Backtrace library? John Yates 2009-08-21 7:48 ` Paul Pluzhnikov 2009-08-21 15:46 ` paawan oza 2009-08-27 14:35 ` Christophe-Marie Duquesne 2009-08-27 15:45 ` John Yates 2009-08-27 17:56 ` Christophe-Marie Duquesne 2009-08-28 15:54 ` Pierre Muller 2009-08-28 16:03 ` Eli Zaretskii
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox