CyberPsychotic wrote:

>  This might be slightly offtopic, but c-related anyway..
> I wonder if anyone could explain me abit
> things, which generates gdb when prints
>  why code died :
>  consider following example:
> 
> (example is taken from Bugtraq list.)
> [root@blackstar coding]# /usr/sbin/smbmount //a/b /
> Segmentation fault (core dumped)
> [root@blackstar coding]# gdb /usr/sbin/smbmount core
> GDB is free software and you are welcome to distribute copies of it
>  under certain conditions; type "show copying" to see the conditions.
> There is absolutely no warranty for GDB; type "show warranty" for details.
> GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation,
> Inc...
> (no debugging symbols found)...
> Core was generated by `AAAAAAAAAAAAAAAAAAAAAAAAAAA'.
> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /lib/libc.so.5.3.12...(no debugging symbols
> found)...done.
> Reading symbols from /lib/ld-linux.so.1...(no debugging symbols
> found)...done.
> #0  0x400775d7 in strncmp ()
> (gdb)
> -----------------------------
> questions:
> Core was generated by 'AAAAA...'
>  what does it mean?  core generated when gdb tried to execute this piece
> of code? or, just this piece of string went out the segment?

It probably means that the core dump is bogues, e.g. because the
relevant part of memory has been corrupted. The string following the
`Core was generated by' message should be the name of the program.

>  and: in  strncmp.......
> means that this happens while executing strncmp () at 0x400775d7 offset?

0x400775d7 is the program counter (EIP register) value.

> right? .. is there any way to figure out what exactly piece of code
> generates this without recompiling the code with debugging mode?

You can get more info by typing `where'. This will show the saved
return address of all of the stack frames from main() downwards.

However, you can't get much useful information out of a core file
unless the program was built with debugging info. And if you want to
get details of the execution context for code that is part of a
library, then the library needs to be built with debug info also.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to