View previous topic :: View next topic |
Author |
Message |
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Wed Feb 03, 2021 11:53 am Post subject: sdbg: setting conditional breakpoints |
|
|
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.
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 |
|
Back to top |
|
|
Robert
Joined: 29 Nov 2006 Posts: 445 Location: Manchester
|
Posted: Wed Feb 03, 2021 6:12 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Thu Feb 04, 2021 2:54 pm Post subject: |
|
|
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
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
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
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 |
|
Back to top |
|
|
Robert
Joined: 29 Nov 2006 Posts: 445 Location: Manchester
|
Posted: Thu Feb 04, 2021 11:43 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Robert
Joined: 29 Nov 2006 Posts: 445 Location: Manchester
|
Posted: Fri Feb 05, 2021 4:26 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Mon Feb 08, 2021 11:14 am Post subject: |
|
|
Thanks Robert,
I can confirm that both logical expressions
Code: | j .EQ. 5 .OR. j .EQ.8 |
and
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 and
work for both 32 and 64 bit executables.
Regards,
Dietmar |
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Thu Mar 11, 2021 2:15 pm Post subject: |
|
|
I would like to set conditional breakpoints for strings, as well. I tried with conditions
Code: | str(1:2) .EQ. '10'
str(1:2) == '10' |
in program
Code: | integer*4 j
character*32 str
do j=1,32
write(str,'(I2)') j
enddo
end
|
|
|
Back to top |
|
|
DietmarSiepmann
Joined: 03 Jun 2013 Posts: 279
|
Posted: Thu Mar 11, 2021 2:30 pm Post subject: |
|
|
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.
Code: | 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 |
|
Back to top |
|
|
|