Silverfrost Forums

Welcome to our forums

sdbg: setting conditional breakpoints

3 Feb 2021 10:53 #27026

I would like to set conditional breakpoints in Salford's debugger sdbg. Unfortunately the documentation I found about this topic contains only one logical expression, namely eps >1

I would like to use equaltiy in such a logical expresion and I would like to combine two logical expressions via 'or'. E.g.

x == 16 || x == 13

seemed to work. Is there more information about the logical expressions which may be used for setting conditional expressions in sdbg?

I would appreciate any further information concerning this 😃

Regards, Dietmar

3 Feb 2021 5:12 #27033

You can use anything that the print command will evaluate. If you choose Tools->Command Prompt then you can type 'p' plus an expression. Any expression you can type in there can be used

4 Feb 2021 1:54 #27044

Robert,

thanks for your quick answer, unfortunately, it does not work completely as I would expect 😦

I may proceed as you said, but unfortunately the Tools utility succeeds if I type

p x = 5

printing something which is not of Type LOGICAL, but of type INTEGER (or INTEGER*4 etc).

And if typing this condition when trying to set a conditional breakpoint this is accepted but the conditional breakpoint does **not **work as I would expect (it does not stop correctly with the condition specified, but with a value different from x=5). I know that the logical expression is valid for C but if I don't know this I am lost 😉

However, typing

p x == 5 

within the Tools utility displays a Logical*4 value (.TRUE. e.g.) and using this condition for setting a conditional breakpoint works as expected stopping with the value specified i.e. x=5.

I suspect the utility uses C-Syntax for logical expressions. But in order to use a logical expression when debugging **Fortran **sources I should know the syntax used by the utility. Unfortunately the syntax

p x .eq. 5

does not work either for the Tools utility (producing a syntax error) nor when trying to set a conditional breakpoint (stopping with an unexcpected value).

Hence I suspect that setting conditional breakpoints is not intended using Fortran syntax.

I am not sure if || is alway working corretly as logical or. Somtimes it seems yes somtimes not (I cannot reproduce that).

Regards, Dietmar

4 Feb 2021 10:43 #27046

I'll have to take a closer look at this. It looks like

p x=5

it stops at the '=' and so just returns x (in sdbg). The evaluator is supposed to take both C and Fortran syntax and there is code for handling operators like .eq., but as you say it doesn't seem to work.

5 Feb 2021 3:26 #27047

The answer for why .eq. doesn't work is .... it has to be .EQ. 😃

Obviously I have fixed it!

I looked at || (or .OR.) and it seem to work okay when I tested it.

8 Feb 2021 10:14 #27061

Thanks Robert,

I can confirm that both logical expressions

j .EQ. 5 .OR. j .EQ.8

and j == 5 || j == 8

work as expected for 32 bit executables 😃

However, both do not work for 64 bit executables and sdbg64: sdbg64 does not stop at all.

Conditions j .EQ. 5 and j == 5

work for both 32 and 64 bit executables.

Regards, Dietmar

11 Mar 2021 1:15 #27265

I would like to set conditional breakpoints for strings, as well. I tried with conditions

str(1:2) .EQ. '10'
str(1:2) == '10'

in program

      integer*4 j
      character*32 str
      do j=1,32
        write(str,'(I2)') j
      enddo      
      end
11 Mar 2021 1:30 #27266

Sorry, my last post was accidently posted too early 😦

Both logical expressions mentioned in the previous post did **not **work. The debugged programme stops for all indices j if setting a conditional breakpoint at line 4 of the programme.

Typing e.g.

p str(1:2) .EQ. '10'

to the print utility (Tools->Command Prompt) results in a syntax error.

I do not know if there is a logical expression in C syntax (you would need to make use of strcmp would't you) which I could use instead.

Regards, Dietmar

Please login to reply.