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

User projects written in or related to FreeBASIC.
Posts: 1271
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.
Posts: 1271
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

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)

function tree:rename_cb(id)

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

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

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

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"

dlg = iup.dialog{tree; title = "IupTree", size = "QUARTERxTHIRD"}

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

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/
Posts: 1271
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

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).
Posts: 784
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


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.
Posts: 784
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


@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.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 3 guests