l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Sep 20 11:00

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] gdb conditional breaking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] gdb conditional breaking

On Thu, 19 Sep 2002, Peter Jay Salzman wrote:

> hi lugod,
> the gdb user's manual doesn't have a lot to say about conditional
> breaking, but i think i'm beginning to understand it more thoroughly.
> first of all, you can use all the boolean expressions you'd expect to be
> able to use.
> break 1 if x > 0
> break 2 if y <= x
> parenthesis seem to be purely optional.
> break 3 if (! x >= -1)
> but there's more to the story.  you can use functions too.  here's a
> test program:
> #include <math.h>
> int main(void)
> {
>    double i = 0.0;
>    double j = M_PI;
>    double k = -1;
>    double l = cos(i);
>    double m = y0(i);
>    return 0;
> }
> where y0 is a bessel function of the 2nd kind (a von neumann function)
> of the zeroth order.  it's a solution to one of the angular equations
> that comes out of separation of variables of laplace's equation in
> spherical coordinates.
> but anyway...
> you can use functions, like math functions.  but with a privisio.
>    (gdb) break main if cos(3) == 0
>    Breakpoint 1 at 0x8048456: file math.c, line 5.
>    (gdb) break main if sin(3) == 0
>    No symbol "sin" in current context.
>    (gdb) break main if exp(3) == 0
>    No symbol "exp" in current context.
>    (gdb) break main if y0(3) == 0
>    Note: breakpoint 1 also set at pc 0x8048456.
>    Breakpoint 2 at 0x8048456: file math.c, line 5.
>    (gdb) break main if y1(3) == 0
>    No symbol "y1" in current context.
> so it appears that here's the rule:
> you're allowed to use any function, even library functions, provided that:
> 1. the library is linked to your application
> 2. you actually _use_ the function somewhere in your code.
> to be honest, i'm not the least surprised by condition 1, but i'm
> very surprised by condition 2.


For static linking: Modules are the code units that compile into object
files. Libraries are archives of object files.  During the linking
process, only those object files with symbols that are needed for your
program, or to support routines already extracted from the library, are
actually extracted from the library.  Typically, libraries will be broken
down into one function per object file to minimize unnecessary loading of
code.  Thus, linking against a library does not necessarily jglom the
whole library into your program.

For dynamic linking (shared libraries), only symbol information for those
functions that you use (directly or indirectly) will be present in your
compiled program, since there is no need to store unused symbols
there.  Lacking symbol information in the obvious place, why should gdb go
looking elsewhere for information that is not likely to be used?

Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.