forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sdbg: setting conditional breakpoints

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 260

PostPosted: Wed Feb 03, 2021 11:53 am    Post subject: sdbg: setting conditional breakpoints Reply with quote

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.

Code:
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 Smile

Regards,
Dietmar
Back to top
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 375
Location: Manchester

PostPosted: Wed Feb 03, 2021 6:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 260

PostPosted: Thu Feb 04, 2021 2:54 pm    Post subject: Reply with quote

Robert,

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

I may proceed as you said, but unfortunately the Tools utility succeeds if I type
Code:
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 Wink

However, typing
Code:
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
Code:
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
Back to top
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 375
Location: Manchester

PostPosted: Thu Feb 04, 2021 11:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Robert



Joined: 29 Nov 2006
Posts: 375
Location: Manchester

PostPosted: Fri Feb 05, 2021 4:26 pm    Post subject: Reply with quote

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

Obviously I have fixed it!

I looked at || (or .OR.) and it seem to work okay when I tested it.
Back to top
View user's profile Send private message Visit poster's website
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 260

PostPosted: Mon Feb 08, 2021 11:14 am    Post subject: Reply with quote

Thanks Robert,

I can confirm that both logical expressions
Code:
j .EQ. 5 .OR. j .EQ.8

and
Code:
j == 5 || j == 8

work as expected for 32 bit executables Smile

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

Conditions
Code:
j .EQ. 5
and
Code:
j == 5

work for both 32 and 64 bit executables.

Regards,
Dietmar
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 260

PostPosted: Thu Mar 11, 2021 2:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 260

PostPosted: Thu Mar 11, 2021 2:30 pm    Post subject: Reply with quote

Sorry, my last post was accidently posted too early Sad

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group