Unix Programming - Fishing information from Core file

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > August 2004 > Fishing information from Core file





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Fishing information from Core file
Anoop Kumar

2004-08-17, 7:59 am

How do i get information (location of the error ) from a core file ,
assuming that the program which created the core was optimized build.

when i invoke gdb with -c option with the core files
and run backtrace command in gdb
all i see are memory locations . Is there any way i could find out
which function corresponds to the memory location ???
Nils O. Selåsdal

2004-08-17, 7:59 am

Anoop Kumar wrote:

> How do i get information (location of the error ) from a core file ,
> assuming that the program which created the core was optimized build.
>
> when i invoke gdb with -c option with the core files
> and run backtrace command in gdb
> all i see are memory locations . Is there any way i could find out
> which function corresponds to the memory location ???

Did you specify the binary ? ;
gdb --core=/path/to/core /path/to/binary
Karthick S.

2004-08-17, 5:54 pm

anoop_kn@yahoo.com (Anoop Kumar) wrote in message news:<31fe3fb2.0408170228.748776d@posting.google.com>...
> How do i get information (location of the error ) from a core file ,
> assuming that the program which created the core was optimized build.
>
> when i invoke gdb with -c option with the core files
> and run backtrace command in gdb
> all i see are memory locations . Is there any way i could find out
> which function corresponds to the memory location ???


By "Optimized Build" I assume you mean without -g. This would mean
there is no debugging info and hence there is no chance of gdb to have
the function related information for it to print it.
use the -g option while compiling to get the info. man gcc and man gdb
will be helpful.
Rgds,
Karthick S.
Fletcher Glenn

2004-08-17, 5:54 pm



Karthick S. wrote:
> anoop_kn@yahoo.com (Anoop Kumar) wrote in message news:<31fe3fb2.0408170228.748776d@posting.google.com>...
>
>
>
> By "Optimized Build" I assume you mean without -g. This would mean
> there is no debugging info and hence there is no chance of gdb to have
> the function related information for it to print it.
> use the -g option while compiling to get the info. man gcc and man gdb
> will be helpful.
> Rgds,
> Karthick S.


A debugger will at least translate addresses into function names on an
unstripped binary. Other clues will tell you where in the function you
are. Although type information may be missing, you can examine sections
of memory in the core file to determine if the data is valid.
I've taken apart many core files, and although it is difficult to pin
down a specific code line under these circumstances, you can often get
a surprising amount of information.

--

Fletcher Glenn

Billy N. Patton

2004-08-18, 2:48 am

Nils O. Selåsdal wrote:
> Anoop Kumar wrote:
>
>
> Did you specify the binary ? ;
> gdb --core=/path/to/core /path/to/binary


and did you compile with the debug option turned on ?

--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, b-patton@ti.com
Anoop Kumar

2004-08-18, 5:57 pm

Fletcher Glenn <fletcher@removethisfoglight.com> wrote in message news:<412275B1.5000401@removethisfoglight.com>...
> Karthick S. wrote:

[vbcol=seagreen]
>
> A debugger will at least translate addresses into function names on an
> unstripped binary. Other clues will tell you where in the function you
> are. Although type information may be missing, you can examine sections
> of memory in the core file to determine if the data is valid.
> I've taken apart many core files, and although it is difficult to pin
> down a specific code line under these circumstances, you can often get
> a surprising amount of information.



It is not a debug build , that is -g option hasn't been set while compiling.
gdb --core=path_to_core path_to_program doesn't help either.
Fletcher Glenn

2004-08-18, 5:57 pm



Anoop Kumar wrote:
> Fletcher Glenn <fletcher@removethisfoglight.com> wrote in message news:<412275B1.5000401@removethisfoglight.com>...
>
>
>
>
>
>
> It is not a debug build , that is -g option hasn't been set while compiling.
> gdb --core=path_to_core path_to_program doesn't help either.


I'm guessing that your binary that produced the core file is stripped.
You can take an unstripped version of the same binary file and use
it with gdb to examine the core file. This will provide more
information about the core file.

--

Fletcher Glenn

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com