This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

rules for conditional breakpoints


hi all,

what exactly are the rules for conditional breakpoints?  clearly the
condition can use the standard boolean operators, along with the logical
qualifiers:

   break main if i > 3
   break test.c:3 if i !=0 && j <=0

but libc functions linked to the code also seem to work:

   break 40 if *(string + strlen(string)) != '\0'

from a previous email i sent to this list, i gather that strlen() works
"by accident", and only functions that return an int work.  so this
won't work, even with typecasting:

   break 1 if (double)cos(0) == 1.0L

so, this seems to be the rule for conditional breakpoints:

1. equality/inequality operators. ie:
       <, >, <=, >=

2. logic operators.  ie:
      &&, ||

3. libc functions linked to code but ONLY if they return an int.  ie:
      strlen(), abs()

is this correct?

thanks!
pete

-- 
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]