FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

User projects written in or related to FreeBASIC.
AGS
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby AGS » Jul 15, 2017 9:49

@St_W and SARG: Thanks for your reactions.

@SARG: yes, your mail did arrive.
AGS
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby AGS » Jul 15, 2017 10:12

@SARG:
I downloaded and used your latest version of the debugger right away. I am using the win api version. Works very well.

I also saw you uploaded an IUP - version. I tried the IUP tree control which was kind of interesting (I think).
The code looks like this (you need to get iuplua https://sourceforge.net/projects/iup/files/3.22/Tools%20Executables/Lua53/to get the example working but the code can be translated easily to FreeBASIC):

Code: Select all

-- IupTree Example in IupLua
-- Creates a tree with some branches and leaves.
-- Two callbacks are registered: one deletes marked nodes when the Del key
-- is pressed, and the other, called when the right mouse button is pressed,
-- opens a menu with options.

require( "iuplua" )
require( "iupluacontrols" )

tree = iup.tree{}

function tree:showrename_cb(id)
  print("SHOWRENAME_CB")
end

function tree:rename_cb(id)
  print("RENAME_CB")
end

function tree:tips_cb(x,y)
  local item = iup.ConvertXYToPos(tree,x, y)
  local label = iup.GetAttributeId(tree,"TITLE",item)
  local i = 0
  iup.SetAttribute(tree,"TIP","")
  while (i < 2) do
    label = label .. " " .. label .. " " .. label .. "\n"
    i = i + 1
  end
  iup.SetAttribute(tree,"TIP",label)
  return 0
end

function tree:k_any(c)
  if c == iup.K_DEL then tree.delnode = "MARKED" end
end

function init_tree_atributes()
  tree.font = "COURIER_NORMAL_10"
  tree.markmode = "MULTIPLE"
  tree.addexpanded = "NO"
  tree.showrename = "YES"
end

function init_tree_nodes()
  tree.name = "Figures"
  tree.addbranch = "3D"
  tree.addbranch = "2D"
  tree.addbranch1 = "parallelogram"
  tree.addleaf2 = "diamond"
  tree.addleaf2 = "square"
  tree.addbranch1 = "triangle"
  tree.addleaf2 = "scalenus"
  tree.addleaf2 = "isoceles"
  tree.value = "6"
end

dlg = iup.dialog{tree; title = "IupTree", size = "QUARTERxTHIRD"}
init_tree_atributes()
dlg:showxy(iup.CENTER,iup.CENTER)
init_tree_nodes()

if (iup.MainLoopLevel()==0) then
  iup.MainLoop()
end


To run the above code save as "tree.lua" and execute using commandline

Code: Select all

lua53 tree.lua


In IupLua you do not need to attach callbacks to widgets explicitly. In FB you'd have to write code not unlike to get the TIPS_CB to work

Code: Select all

   iupSetCallback (tree, "TIPS_CB", Cast(Icallback,@tree_tips_cb))

to set up the TIPS callback (and use similar code to set up other callbacks) but apart from that the code speaks for itself.

Function tree:tips_cb(x,y) which sets the tooltip of a node is the interesting part of the code.

Using the above code it is possible to show the user, when hovering a node in the tree, an arbitrary piece of text or even a window.
The callback (TIPS_CB) fires just before the tip gets shown. Which makes it possible to change the text of the tip inside the callback.

The code

Code: Select all

local item = iup.ConvertXYToPos(tree,x, y)


gets you the id of the item in the tree the mouse is hovering. If it's a leaf fbdebugger could show the content of the variable. If it's not a leaf then nothing should get shown. This is only interesting for variables of (pointers to) user defined type (content of variables of type integer, double etc... get shown anyway). But since I use lots of user defined types in my code it's a good thing if I could see the value of a variable by just hovering it.

The next piece of code

Code: Select all

 local label = iup.GetAttributeId(tree,"TITLE",item)


gets the value of the text associated with the node the mouse is hovering (item is the id of the node). Whether it's easier for fbdebugger to use the id or it's easier to use the text I don't know.

Interestingly enough this callback (TIPS_CB) and IupConvertXYToPos also work with scintilla. When hovering over the text of a scintilla control IupConvertXYToPos can be used to get the position in the text beneath the mouse cursor.

You can also use IupConvertXYToPos to get an item in a list or a cell in a matrix.

The iup page on iupconvertxytopos can be found at the following URL
http://webserver2.tecgraf.puc-rio.br/iu ... topos.html

And the page on TIPS_CB can be found here
http://webserver2.tecgraf.puc-rio.br/iu ... p_tip.html

The iup developers have created their own debugger using scintilla. It's called iupluascripter and they have used a combination of lua and C to create it. The lua code can be found here
https://sourceforge.net/p/iup/iup/HEAD/ ... /scripter/

C code can be found here
https://sourceforge.net/p/iup/iup/HEAD/ ... ascripter/
AGS
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby AGS » Jul 15, 2017 10:18

@SARG
A bug report.

I found some slight problems with the latest version of fbdebugger (not IUP version): the text on some buttons does not show up correctly. The buttons need to be bigger in some places. Especially the buttons on the window you get when choosing Tools->settings . That window (in terms of lay out) does not look right. The text
"Cmdline, parameters for compiling (-g added by default) and for the debuggee when debugging"


simply disappears beneath the button "Color tmp breakpoint" and the button "Color per breakpoint".

Code: Select all

    fb_button("Color keywords",hWnd, 107, 283*scalex, 83*scaley, 35*scalex, 15*scaley)
    fb_button("Color current line",hWnd, 108, 283*scalex, 49*scaley, 35*scalex, 15*scaley)
    fb_button("Color tmp breakpoint",hWnd, 109, 263*scalex, 66*scaley, 35*scalex, 15*scaley)
    fb_button("Color per breakpoint",hWnd, 110, 300*scalex, 66*scaley, 35*scalex, 15*scaley)


The text on almost none of the above buttons on the tools window show up correctly. It has to do with multiline - text. Text on a button is getting clipped both at the top of the button and at the bottom of the button.

The text on the following button (used in show/expand variable)

Code: Select all

  fb_button("New Show/Expand",     hWnd,117,260*scalex, 50*scaley, 60*scalex, 10*scaley)


is not readable. Both the top word (New) and the bottom words (Show/Expand) get clipped.
This is due to the fact that New is positioned too high and Show/Expand too low. Making
the text unreadable. Again it's an issue when creating a button with multiline text.

It's weird as the button just beneath the New Show/Expand button

Code: Select all

  fb_button("Replace Current",     hWnd,118,260*scalex, 60*scaley, 60*scalex, 10*scaley)


looks great. Which is weird as the text on the button ("Replace Current") is as long as the text on the button("New Show/Expand").

I couldn't customize the keyboard shortcuts using settings. I tried to define a shortcut for show/expand variable but it
didn't work. The shortcut - text does get added to the popup - menu (which pops up when you right click when on an item that's part of the the proc/var tree) but that's about it.

I am using fbdebugger version 2.91 (32bit).
SARG
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jul 15, 2017 21:57

Hi AGS,

No issue here with the display : all texts are visible and well framed. Could you send me or upload somewhere screen copies.

About shortcuts
In some cases a notification is sent to the treeview's parent but was not processed.
Problem solved but I'm not happy with few details. So not immediately a new version.

IUP is a good tool (easy to use and linux/win compatible) and the developer (Scuri) is open to requests. Unfortunately I did not use it since a long time... Maybe one day I'll restart to develope with it.
SARG
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jul 18, 2017 15:44

For now just the source code. Version 2.92 Beta

http://users.freebasic-portal.de/sarg/FBdebugger.bas

@AGS test it and say me if it's OK for you.

NB The shortcuts are active everywhere. It doesn't matter which treview is visible/has the focus.

Edit, version updated : action of shortcuts a bit more limited if there is a treeview displayed.
AGS
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby AGS » Jul 26, 2017 21:14

@SARG
Sorry for the very, very late reply. I will download and test the new version asap.

In my bug report I forgot to mention the OS I am using: Win 7 pro 64bit.

The screencopies:
Image
Image

I will be using your debugger very soon to debug a large project (4000+ lines of code). Without the use of your debugger it would be quite hard to get my code anywhere near bug - free. Merci beaucoup for creating and maintaining fbdebugger, SARG.
AGS
Posts: 1283
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby AGS » Jul 27, 2017 11:01

@SARG

I tested the new version but alas, the problem of clipped text on buttons is still there. If it works on your machine but not on mine then the problem could be with the OS I am using.

The shortcut - keys work like a charm. No problem assigning the letter y to show/expand variable.

I thought a bit about ways to pop up a window when the user hovers a variable (eliminating the need for a shortcut key).
IUP uses a callback that fires just before the tooltip gets shown. IUP is a wrapper around the windows api.
If they can manage to call some function just before a tip is shown then so can everyone else.

I found this on MSDN:
MSDN wrote:When you apply the TVS_INFOTIP style to a tree-view control, it generates TVN_GETINFOTIP notifications when the cursor is over an item in the tree view. By responding to this notification you can set the text that appears in the infotip.


You can set the text of the infotip if you want but you could also do various other things. Bascically TVN_GETINFOTIP fires when the mouse is hovering over an item in the tree. It's (almost) the same as the tip - callback used by IUP.

I think popping up the window you get when choosing show/expand variable when hovering over an item in the tree could be an option.
And then use a key to close the window.

And as not every user wants the "show/expand variable" to pop - up when the mouse is over a variable it could/should be an option.
Problem is that you set the tree - style when creating the tree so I don't know how 'dynamic' you can make this. You cannot simply add styles after the tree has been created. Perhaps it's the kind of option that, when toggled, requires a restart of the debugger?

The value of the variable shown should be the most recent value of the variable (eg the pop up must show the value of the variable as if the user has just pushed the update button in the show/expand variable window).
SARG
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jul 27, 2017 17:47

AGS wrote:Sorry for the very, very late reply. I will download and test the new version asap.
No problem, everybody has his/her own life.

AGS wrote:I will be using your debugger very soon to debug a large project (4000+ lines of code). Without the use of your debugger it would be quite hard to get my code anywhere near bug - free. Merci beaucoup for creating and maintaining fbdebugger, SARG.
De rien, You are welcome, thanks for using it :-)

AGS wrote:In my bug report I forgot to mention the OS I am using: Win 7 pro 64bit.
W10 family and before W7 without any problem.
If other users could report about that. Thanks in advance.

AGS wrote:I tested the new version but alas, the problem of clipped text on buttons is still there. If it works on your machine but not on mine then the problem could be with the OS I am using.
No change in the last version so obviously same result.....
2 remarks about screencopies: the dialog box is greater and also the size of the characters than I get.
I have searched with Google and the only thing I could find : DPI scaling level in Windows's parameters. Did you change something like that ?

AGS wrote:The shortcut - keys work like a charm. No problem assigning the letter y to show/expand variable.
Good to know. I was sure but bugs are often well hidden...

AGS wrote:I thought a bit about ways to pop up a window when the user hovers a variable (eliminating the need for a shortcut key).

I think popping up the window you get when choosing show/expand variable when hovering over an item in the tree could be an option.
And then use a key to close the window.

And as not every user wants the "show/expand variable" to pop - up when the mouse is over a variable it could/should be an option.
Problem is that you set the tree - style when creating the tree so I don't know how 'dynamic' you can make this. You cannot simply add styles after the tree has been created. Perhaps it's the kind of option that, when toggled, requires a restart of the debugger?

The value of the variable shown should be the most recent value of the variable (eg the pop up must show the value of the variable as if the user has just pushed the update button in the show/expand variable window).
Done using your advice about TVS.., etc. http://users.freebasic-portal.de/sarg/FBdebugger.bas
Though a bit differently : use CTRL when hovering an item in the variables tree to display the show/expand dialog box.
Doing this way to avoid too many unwanted selections as window closing is a bit boring and no option needed ;-)
NB when hovering with CTRL pressed the selected item is changed. Like this not a lot of work for me....
Tell me your opinion.
sancho2
Posts: 547
Joined: May 17, 2015 6:41

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby sancho2 » Jul 28, 2017 3:22

Hi Sarg:
I can confirm that my settings menu looks like the one AGS posted. Most of the buttons are sized incorrectly for the text.
On the line for setting shortcut keys, the up/down for the key does nothing. I put a 'w' in it and it didn't go forward or backward.
There is a button to the right of that displaying an 'A'. It doesn't seem to do anything either.
The shortcut change itself works, but only on the left pane. It works when you select a variable in the debugged code and use the new short cut.
It does not work on the right hand pane. There if you select a variable and the use the shortcut, no expand window is created.

Windows 10, 64 bit, 1440x900.
Version 2.91 b1 of your excellent debugger.

Thanks Sarg.
EDIT:
I just noticed the instruction above the shortcut menu item that explains what the 'A' button does.
SARG
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jul 28, 2017 12:09

Hi Sancho2,

Thanks for your reply and your comment about fbdebugger.
For testing better to use the last version 2.92

sancho2 wrote:The shortcut change itself works, but only on the left pane. It works when you select a variable in the debugged code and use the new short cut.
It does not work on the right hand pane. There if you select a variable and the use the shortcut, no expand window is create.
Not sure to understand. 2.91 version used ?

I have tested on an other PC 1366x768 and no problem ?????

You and AGS please just run this version version of fbdebugger http://users.freebasic-portal.de/sarg/FBdebugger_settings.bas , select Settings and tell me what are the values displayed in the console window
"baseunits=" ???
"right=" ??? "bottom=" ???
"scale x y = ??? ???

@AGS what is the size of your screen ?
St_W
Posts: 1000
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby St_W » Jul 28, 2017 13:43

Looks like a problem with high-DPI displays. We had some discussions about that topic on the forums a few months ago.

@SARG: try to enable scaling (a value <> 100%) to reproduce the problem (search for "DPI" in control panel or windows search and select "Make text and other items larger or smaller" (Win7) - it may read differently on other windows versions)

@AGS and other users: try to disable scaling in the compatibility settings. Open file properties of the FBdebugger executable: select the .exe in explorer and press Alt+Enter. Then navigate to the "Compatibility" tab and tick the checkbox "Disable display scaling on high DPI settings". Again, Win7, it may read differently on other windows versions.
//edit: in Win10 it reads "Override high DPI behaviour", try selecting "Scaling performed by Application"

Everything is just a guess, though - I'm not sure whether that's actually the issue, but I think it's worth a try.
SARG
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jul 28, 2017 14:15

St_W wrote:Looks like a problem with high-DPI displays. We had some discussions about that topic on the forums a few months ago.

@SARG: try to enable scaling (a value <> 100%) to reproduce the problem (search for "DPI" in control panel or windows search and select "Make text and other items larger or smaller" (Win7) - it may read differently on other windows versions).
Yesterday after googling I tried that but "unluckily" every element was resized...... so no visible difference. Anyway thanks for your help.

The special fbdebugger version displays values used when calculating the dimensions of the controls. Maybe with them I could understand the issue.
St_W
Posts: 1000
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby St_W » Jul 28, 2017 14:34

SARG wrote:Yesterday after googling I tried that but "unluckily" every element was resized...... so no visible difference. Anyway thanks for your help.
hmm, another guess:
On Win7 you can change the text scaling separately. Follow the steps "Make text and other items larger or smaller" control panel page described above and then click the "Set custom text size (DPI)" link on the navigation pane on the left. Try using a value > 100% there and there's also a checkbox "Use Windows XP style DPI scaling" - I don't know the effects of that, though, just try both states. IIRC all those settings were removed for later Windows versions; they do not exist for Win10, I don't know about Win8.
//edit: as far as I've read the described settings disappeared in Windows 10 build 15019.
Unfortunately the DPI handling implementation and APIs changed several times from XP to Win10 - it's a big mess ...
Last edited by St_W on Jul 28, 2017 14:45, edited 1 time in total.
SARG
Posts: 796
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby SARG » Jul 28, 2017 14:44

St_W wrote:On Win7 you can change the text scaling separately. Follow the steps "Make text and other items larger or smaller" control panel page described above and then click the "Set custom text size (DPI)" on the navigation pane on the left. Try using a value > 100% there and there's also a checkbox "Use Windows XP style DPI scaling" - I don't know the effects of that, though. IIRC those settings were removed for later Windows versions; they do not exist for Win10, I don't know about Win8.
I saw that also but as Sancho2 uses W10......
sancho2
Posts: 547
Joined: May 17, 2015 6:41

Re: FB debugger : 2.91 32/64 BIT ..... (Aug 20th, 2016)

Postby sancho2 » Jul 29, 2017 3:36

I am definitely using scaling here on Win 10. I disabled it for fbDebugger as per St. W. but the problem still exists.
I will try to shut of scaling completely, if I can find the setting, and report back.

I downloaded and compiled that settings version you linked Sarg. It doesn't print anything to the console. Did I miss something.

I will try to describe the short cut not working a little better.
If you debug this code:

Code: Select all

Dim x As Integer

Do
   x += 1
   Print x
Loop While x < 100


Image
If you have created a shortcut for expand variable and select the blue circled x and use your short cut key combo, it works as it should and pops up the window showing the variable.
If you select the red circled x and use your shortcut, it does not expand the variable (it does not pop un the window).
If you use the mouse right-click context menu and select expand variable, it works on both.
Note that I have doctored and resized the image to be smaller for this post.

But don't be too upset Sarg, these are minor issues in my opinion.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest