UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C++
  • » debugging techniques for final application?

#1 2006-05-02 03:05 PM

thinking
Member
Registered: 2005-09-15
Posts: 103

Re: debugging techniques for final application?

Offline

#2 2006-05-02 03:18 PM

Lloyd
Member
Registered: 2006-02-13
Posts: 53

Re: debugging techniques for final application?

Though I am a beginner I dont understand the things you mentioned. Segmentation fault occurs frequently for me. It is mainly due to refering to the invalid memory. It could be due to invalid pointers. (Especially pointers which are not initialized).

I thing the debugger is enough to find out the problem. Run the program in debugger and let it crash. When it crashes check the Memory, Disassemble, Libraries (From viewers button).

In libraries you will see the function which have caused the proble. The disassembled code too will be useful. From there you will be able to guess the problem.

Note: I am using the GUI based debugger (gdb) available along with the Kdevelop

Offline

#3 2006-05-02 03:44 PM

thinking
Member
Registered: 2005-09-15
Posts: 103

Re: debugging techniques for final application?

excuse, i did forget to mention
i have no debugger on the system i'm working on
and i know what you mean, i had many segfaults until now

but NOW i want to implement a "segfault" handler which reports where the problem is

i'm asking the questions cause until now (i mean without gdb) i use printf to isolate the problem

another problem with gdb
in big app's gdb gets very complicated
for example, if i have about 10 seperate processes (i don't have now, but in productive system i think i will and on the client side of my app i will have around 100 or more forked processes)
where each process will have it's own threads, ....

well, this architecture becomes complex
but this doesn't mean it's a bad architecture
for the problem which i want to solve it's good, but it's big, difficult and complex

and that's why i want to implement debugging functions in my prog
to know "in case of", what the problem is/was
i mean, application's crash (even apache or *lol* windows crashes) so i want a method, to get a hint, what caused the problem and the line where it occured is the optimal solution for this

hope this helps to understand the motivation (and what i really want to i achieve)

Offline

#4 2006-05-02 04:31 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: debugging techniques for final application?

Offline

#5 2006-05-03 11:57 AM

thinking
Member
Registered: 2005-09-15
Posts: 103

Re: debugging techniques for final application?

thx RobSeace
that's what i meant
i found a possible solution to create my own stacktrace using
__builtin_return_address and dladdr

btw: is it possible to compile 2 versions of my prog
one with "-g" option enabled and one with "-g" disabled
the disabled version is shipped and the enabled version is used to analyse backtraces
i'm not sure, but does this work, or is there a problem with the offset's printed by the backtrace function, cause debug option enabled version offset is different than disabled version?

Offline

#6 2006-05-03 02:51 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,847
Website

Re: debugging techniques for final application?

Offline

#7 2006-05-03 05:03 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,239

Re: debugging techniques for final application?

I think you can run a coredump of a stripped debugging binary through gdb with the unstripped binary and get full information.

Offline

  • Index
  • » C++
  • » debugging techniques for final application?

Board footer

Powered by FluxBB