Segfault

From GnokiiWiki
Jump to: navigation, search

A segfault (segmentation fault) is a fatal error that happens when a program tries to access an illegal memory location.

You can get useful information if your system is configured to create a core dump or if you can run gnokii (or xgnokii) inside a debugger and libgnokii and the faulting program have the debugging symbols.

Both the core dump and the debugger are useless if the debugging symbols are missing.

The examples below are valid both for gnokii and xgnokii.

Contents

How can I tell if gnokii/xgnokii has got debugging symbols?

Use the file program:

$ file $(which gnokii)
/usr/bin/gnokii: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

If you read "not stripped" then it has debugging symbols. If you read "stripped" then it has not.

What's a core dump?

A core dump is a copy of the memory in use by a program when it crashed.

If the crashed program is not stripped then it has debugging symbols which can be used to understand why it misbehaves.

If is stripped then those symbols were removed and the core dump is almost useless, so you should recompile the program.

I have a core dump

Run gdb on it and issue the backtrace command.

Example:

$ gdb $(which gnokii) core
(gdb) backtrace
[...]

I don't have a core dump

Run gnokii inside gdb and issue the backtrace command after the error has occurred.

Try to reproduce the error giving the same exact command line to gnokii or clicking the same exact sequence of menus or buttons in xgnokii. If you have a problem with a phonebook entry or with a SMS, make sure that you are using the same entry while debugging.

For example if you are getting a segfault using the "identify" command, your debugging session would look like this:

$ gdb --args gnokii --identify
[...]
(gdb) run
Starting program: /usr/bin/gnokii --identify
[...]
Program received signal SIGSEGV, Segmentation fault.
(gdb) backtrace
[...]

Why I see all those question marks?

Because the program or the libraries were stripped; this means that functions names are not available (a recompilaton is needed if you want to debug).

Names of libgnokii functions are needed for debugging. If they are missing don't bother posting the backtrace.

Posting the backtrace

The backtrace shouldn't contain your personal information, so you can post it to the gnokii mailing list with the following information:

  • phone model
  • connection type (Bluetooth, irda/cable with its type)
  • gnokii version (gnokii --version or "About" menu in xgnokii) and where you got it from: CVS, tarball, binary package
  • a copy of your gnokiirc without unnecessary comments:
grep "^#" -v /etc/gnokiirc | grep -v "^$"

or, if you put it in your home directory:

grep "^#" -v $HOME/gnokiirc | grep -v "^$"

Attaching the debug output could be useful, but try to cut unneeded stuff. Note that the debug output could contain information like IMEI, phone numbers and SMS text. Sometimes

To enable debugging, set the debug switch in gnokiirc:

   [logging]
   # for gnokii
   debug = on
   # for xgnokii and smsd
   xdebug = on

For more information