[LCP]debugging?

Zachary Uram netrek at gmail.com
Mon Feb 7 12:21:02 UTC 2005


On Sun, 6 Feb 2005 17:11:27 -0800, Bill Rausch <BRausch at owt.com> wrote:
>
> Stub is a replacement function that you use to test a program. For
> example, if a program calls a function that does lots of complex
> stuff, you could replace the function with something really simple
> that takes the same parameters but skips the calculation. This allows
> you to test the calling routine without worrying about the details of
> the called function.

Hi Bill,

I see. Can I put a function's stub in a .h file? Sometimes I see
functions defined after main and they have no stub before main. How do
I determine if I need a stub or not?

> Segmentation fault is almost always a bad pointer or bad parameter
> passed to a function.  For example, you malloc some space for a
> pointer x, later you free it, and then even later you use x as though
> you hadn't freed it. It will compile ok, and might even run ok most
> of the time but once in a while you'll get in trouble because once
> you've freed it you are never supposed to refer to it again until you
> malloc some new space.

Oh, could you perhaps give some code snippets to document these error
conditions and how to fix them?

Regards!
Zach




More information about the linuxCprogramming mailing list