FrontEnd GDB for freebasic

User projects written in or related to FreeBASIC.
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

Will do in the morning. (Getting ready for Midnight celebration here)
You mean the Error being , when the "Main.bas content is not shown" ?

Regards
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FrontEnd GDB for freebasic

Post by VANYA »

Dinosaur wrote:You mean the Error being , when the "Main.bas content is not shown" ?
yes
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

I was about to post and tell you that I have not been able to replicate the problem and thought,
lets try once more.
Low & behold it failed.
The listing below shows the first set as system working correctly,
then the second set when it failed.
Can't see a problem in that area.
Source files for which symbols have been read in:

/home/dinosaur/Projects/CguiDemo/Main.c,
/home/dinosaur/Projects/CguiDemo/Win01.bas,
/home/dinosaur/Projects/CguiDemo/Win02.bas,
/home/dinosaur/Projects/CguiDemo/WinHelp.bas,
/home/dinosaur/Projects/CguiDemo/RunMod00.bas,
/home/dinosaur/Projects/CguiDemo/RunMod01.bas,
/home/dinosaur/Projects/CguiDemo/Main.bas,
/home/dinosaur/Projects/CguiDemo/Presets.bi

Source files for which symbols will be read in on demand:

/home/dinosaur/Projects/CguiDemo/Presets.bi,
/home/dinosaur/Projects/CguiDemo/Main.bas,
/home/dinosaur/Projects/CguiDemo/RunMod01.bas,
/home/dinosaur/Projects/CguiDemo/RunMod00.bas,
/home/dinosaur/Projects/CguiDemo/WinHelp.bas,
/home/dinosaur/Projects/CguiDemo/Win02.bas,
/home/dinosaur/Projects/CguiDemo/Win01.bas
(gdb)
Source files for which symbols have been read in:

/home/dinosaur/Projects/CguiDemo/Main.c,
/home/dinosaur/Projects/CguiDemo/Win01.bas,
/home/dinosaur/Projects/CguiDemo/Win02.bas,
/home/dinosaur/Projects/CguiDemo/WinHelp.bas,
/home/dinosaur/Projects/CguiDemo/RunMod00.bas,
/home/dinosaur/Projects/CguiDemo/RunMod01.bas,
/home/dinosaur/Projects/CguiDemo/Main.bas,
/home/dinosaur/Projects/CguiDemo/Presets.bi

Source files for which symbols will be read in on demand:

/home/dinosaur/Projects/CguiDemo/Presets.bi,
/home/dinosaur/Projects/CguiDemo/Main.bas,
/home/dinosaur/Projects/CguiDemo/RunMod01.bas,
/home/dinosaur/Projects/CguiDemo/RunMod00.bas,
/home/dinosaur/Projects/CguiDemo/WinHelp.bas,
/home/dinosaur/Projects/CguiDemo/Win02.bas,
/home/dinosaur/Projects/CguiDemo/Win01.bas
(gdb)
Regards
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

Worked out when it happens.
After a reboot of Mint 19.3 , as soon as the icon is visible, I start Geany.
Once my project has loaded, I click Compile then as soon as compile is finished
I click debug.

That is when this issue happens.
It may load data in Variables window, but most time neither windows have content.
You can run the project by pressing Run/Stop.
Then when I quit my app, the windows still don't have content.
The function get_name_files_from_exe obviously does not get called as there is nothing printed when both windows are empty.

If I now wait a minute or two (without rebooting) I difficulty repeating the error.
Seems to me there is a system function you are relying on, that is not yet available so soon after booting.

Hope this helps.
Let me know if there is something else I can do.

Regards
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FrontEnd GDB for freebasic

Post by VANYA »

Unfortunately, I do not have such a defect on linux. Please help me with this problem.

Only Function load_file() in the file interface.bas:

It is necessary to compare the result when there is an error and when it is not. Namely compare the results of the return value for each call sTemp = readpipe(). If a problem is found, please post the result to me on the forum. Also, if a problem is detected, you can change the numeric values ​​before and after calling readpipe in the functions: Updateinfoxserver, WritePipe. Will you help me?

I know that looking for an error in this case is not the most pleasant experience. So if you do not have the time or desire, then I will understand you.

P.S. On windows, I seem to have solved the problem.
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

I will try to follow it through.

Perhaps the problem is associated with how I am starting Debug.

1: Debug button in Geany has the following command:
/home/dinosaur/Projects/CguiDemo/Debug Main
This is the preferred method but it is the one causing problems.

2: Using a Desktop Icon with the following command, starts Debug BUT never loads a file.
Note that I have copied the executable Debug to this folder.
This does not allow execution of file, as nothing is loaded.
/home/dinosaur/Projects/CguiDemo/Debug Main

3: Opening a Terminal in /home/dinosaur/Projects/CguiDemo
and then using the command ./Debug Main works everytime.

I inserted print statements after each "sTemp = readpipe()" and also the nearest Line number.
What was odd, that some calls didnt print any content other than my line number statement, but judge for yourself
with the "edited" detail below.


Code: Select all

dinosaur@dinosaur-GA-MA78LMT-S2:~/Projects/CguiDemo$ ./Debug Main
1640
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Main...done.
(gdb) 
1672
Source files for which symbols have been read in:

/home/dinosaur/Projects/CguiDemo/Main.c, /home/dinosaur/Projects/CguiDemo/Win01.bas, /home/dinosaur/Projects/CguiDemo/Win02.bas, /home/dinosaur/Projects/CguiDemo/WinHelp.bas, /home/dinosaur/Projects/CguiDemo/RunMod00.bas, 
/home/dinosaur/Projects/CguiDemo/RunMod01.bas, /home/dinosaur/Projects/CguiDemo/Main.bas, /home/dinosaur/Projects/CguiDemo/Presets.bi

Source files for which symbols will be read in on demand:

/home/dinosaur/Projects/CguiDemo/Presets.bi, /home/dinosaur/Projects/CguiDemo/Main.bas, /home/dinosaur/Projects/CguiDemo/RunMod01.bas, /home/dinosaur/Projects/CguiDemo/RunMod00.bas, /home/dinosaur/Projects/CguiDemo/WinHelp.bas, 
/home/dinosaur/Projects/CguiDemo/Win02.bas, /home/dinosaur/Projects/CguiDemo/Win01.bas
(gdb) 
1687
All defined variables:

File Main.bas:
struct $5ACCUM ACCUM$;
struct $3ADC ADC$;
etc
etc
etc

Non-debugging symbols:
0x0000000000426340  _IO_stdin_used
0x0000000000427fa0  messages
etc
etc
etc

(gdb) 
1705
All defined functions:

File /home/dinosaur/Projects/CguiDemo/RunMod00.bas:
void GETMSTATUS(void);
void PUTMSTATUS(void);
void TASKSCAN(void);

File /home/dinosaur/Projects/CguiDemo/RunMod01.bas:
void CLKUPDATE(void);
void EMERGENCY(void);
void FILEREAD(void);
void FILESAVE(void);
void NEWFILE(void);
void SYSTEMSTATUS(void);

File /home/dinosaur/Projects/CguiDemo/Win01.bas:
void CLOSE_EDIT(void *);
void CLOSE_USERS(void *);
void COPY_FILES(void *);
void DRAW_KEYBOARD(void *);
void DRAW_NUMPAD(void *);
void GETIMAGES(void);
void GET_USERNBR(void *, int32);
void INITIALIZE(void);
void KEY_ASSIGN(void);
void KEY_BOARD(void *);
void KILLFILE(void);
void LOADIMAGES(void);
void MAKENEW(void);
void NUM_PAD(void *);
void READ_SETTINGS(void);
void READ_USERS(void);
void RECIPE_SELECT(void *);
void SAVE_USERS(void *);
void SIGN_IN(void *);
void UPDATE_TEXT(void *);
void WRITE_SETTINGS(void *);

File /home/dinosaur/Projects/CguiDemo/Win02.bas:
void BUTTON10(void *);
void BUTTON11(void *);
void BUTTON12(void *);
void BUTTON13(void *);
void BUTTON14(void *);
void BUTTON15(void *);
void BUTTON16(void *);
void BUTTON17(void *);
void BUTTON18(void *);
void BUTTON2(void *);
void BUTTON3(void *);
void BUTTON4(void *);
void BUTTON5(void *);
void BUTTON6(void *);
void BUTTON7(void *);
void BUTTON8(void *);
void BUTTON9(void *);
void CLOSE_WINDOW(void *);
void PLEASEWAIT(void);

File /home/dinosaur/Projects/CguiDemo/WinHelp.bas:
void ABOUT_INFO(void *, int32);
void ADJUST_INFO(void *, int32);
void BACKUP_INFO(void *, int32);
void CREDITS_INFO(void *, int32);
void DEBUG_INFO(void *, int32);
void DUMMY(void *);
void ERR_INFO(void *, int32);
void ERR_MESSAGE(void);
void HELP_MAIN(void *, int32);
void HELP_WINDOW0(void *);
void HELP_WINDOW1(void *);
void RECIPE_INFO(void *, int32);
void RESTORE_INFO(void *, int32);
void RUN_INFO(void *, int32);
void SETTING_INFO(void *, int32);
void SHOW_PHOTO(void *);
void SIGNIN_INFO(void *, int32);

File Main.bas:
void CREATESTATUSFIELDTEXT(void *, uint8 *);
void ERRER_STATUS(void);
void GET_NEWFONT(void);
void MACHINEPROCESS(void *);
void MAIN_WINDOW0(void);
void MAIN_WINDOW1(void *);
void MAIN_WINDOW2(void *);
void QUIT(void *);
void SHUT_DOWN(void);
void TIMESHOW(void);
void WIN_STARTUP(void);
void WRITEREPORT(void);
int32 main(int32, char **);

Non-debugging symbols:
0x0000000000402a70  _init
0x0000000000402aa0  tcsetattr@plt
0x0000000000402ab0  AddTextBox@plt

(gdb) 

The output below is when using method 1 above and failing to show content.(Note: No source files loaded)

Code: Select all

/home/dinosaur/Projects/CguiDemo/Debug Main (in directory: /home/dinosaur/Projects/CguiDemo)
1640
1672
1687
GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from Main...
1705
All defined functions:
File /home/dinosaur/Projects/CguiDemo/RunMod00.bas:
void GETMSTATUS(void);
void PUTMSTATUS(void);
void TASKSCAN(void);
File /home/dinosaur/Projects/CguiDemo/RunMod01.bas:
void CLKUPDATE(void);
void EMERGENCY(void);
void FILEREAD(void);
void FILESAVE(void);
void NEWFILE(void);
void SYSTEMSTATUS(void);
File /home/dinosaur/Projects/CguiDemo/Win01.bas:
void CLOSE_EDIT(void *);
void CLOSE_USERS(void *);
void COPY_FILES(void *);
void DRAW_KEYBOARD(void *);
void DRAW_NUMPAD(void *);
void GETIMAGES(void);
void GET_USERNBR(void *, int32);
void INITIALIZE(void);
void KEY_ASSIGN(void);
void KEY_BOARD(void *);
void KILLFILE(void);
void LOADIMAGES(void);
void MAKENEW(void);
void NUM_PAD(void *);
void READ_SETTINGS(void);
void READ_USERS(void);
void RECIPE_SELECT(void *);
void SAVE_USERS(void *);
void SIGN_IN(void *);
void UPDATE_TEXT(void *);
void WRITE_SETTINGS(void *);
File /home/dinosaur/Projects/CguiDemo/Win02.bas:
void BUTTON10(void *);
void BUTTON11(void *);
void BUTTON12(void *);
void BUTTON13(void *);
void BUTTON14(void *);
void BUTTON15(void *);
void BUTTON16(void *);
void BUTTON17(void *);
void BUTTON18(void *);
void BUTTON2(void *);
void BUTTON3(void *);
void BUTTON4(void *);
void BUTTON5(void *);
void BUTTON6(void *);
void BUTTON7(void *);
void BUTTON8(void *);
void BUTTON9(void *);
void CLOSE_WINDOW(void *);
void PLEASEWAIT(void);
File /home/dinosaur/Projects/CguiDemo/WinHelp.bas:
void ABOUT_INFO(void *, int32);
void ADJUST_INFO(void *, int32);
void BACKUP_INFO(void *, int32);
void CREDITS_INFO(void *, int32);
void DEBUG_INFO(void *, int32);
void DUMMY(void *);
void ERR_INFO(void *, int32);
void ERR_MESSAGE(void);
void HELP_MAIN(void *, int32);
void HELP_WINDOW0(void *);
void HELP_WINDOW1(void *);
void RECIPE_INFO(void *, int32);
void RESTORE_INFO(void *, int32);
void RUN_INFO(void *, int32);
void SETTING_INFO(void *, int32);
void SHOW_PHOTO(void *);
void SIGNIN_INFO(void *, int32);
File Main.bas:
void CREATESTATUSFIELDTEXT(void *, uint8 *);
void ERRER_STATUS(void);
void GET_NEWFONT(void);
void MACHINEPROCESS(void *);
void MAIN_WINDOW0(void);
void MAIN_WINDOW1(void *);
void MAIN_WINDOW2(void *);
void QUIT(void *);
void SHUT_DOWN(void);
void TIMESHOW(void);
void WIN_STARTUP(void);
void WRITEREPORT(void);
int32 main(int32, char **);
Non-debugging symbols:
0x0000000000402a70  _init
0x0000000000402aa0  tcsetattr@plt
0x0000000000402ab0  AddTextBox@plt
0x0000000000402ac0  fileno@plt
etc
etc
etc

(gdb)
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FrontEnd GDB for freebasic

Post by VANYA »

Hi Dinosaur!
Perhaps the problem is associated with how I am starting Debug.
I think so too. Try to run with the full path for the debugger and the executable:

Code: Select all

/home..../Debug /home..../Main
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

Seeing as I am the only one with the problem (which is not really a problem if I wait at least 30secs after boot)
so will leave it as is.
I will simply copy Debug into each project folder as each project has Main.bas.
I am happy with the functionality.

May thanks for your work on this.

Regards
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FrontEnd GDB for freebasic

Post by VANYA »

Dinosaur wrote:I will simply copy Debug into each project folder as each project has Main.bas.
A strange decision. Why can't you just give the full path in GEANY for the debugger and the executable? Or is it not possible in GEANY?
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

No, not possible.
Adding functionality to Geany is usually only done by writing "Addon's", something I won't get involved with.

Regards
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FrontEnd GDB for freebasic

Post by VANYA »

Try my editor, it has a built in function to run with debugger: viewtopic.php?f=8&t=26030
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi VANYA

I use Geany in Debian32 bit, Mint 64 bit, Debian on Beaglebone, Windows7 (just as support only for old projects), but use PWB on Dos (once again for support only).

Previously I tried Poseidon , but notice yours is also using iup, which IMHO is a nightmare to install and maintain for different applications and versions of Linux.
I am not even sure if it will install on ARM based systems.
I am sure you have done a great job of the Editor, but will stick with what I am using.

Regards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: FrontEnd GDB for freebasic

Post by TJF »

Dinosaur wrote:No, not possible.
Adding functionality to Geany is usually only done by writing "Addon's", something I won't get involved with.
Beside addons you can also use custom commands to extend Geany functionality. But this sounds like a simple configuration task. How exactly do you start the debugger?
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: FrontEnd GDB for freebasic

Post by Dinosaur »

Hi All

On Geany next to the "Compile Current File" is a "Brick" icon.
By adding a Command in "Build/Set Build Commands" I have placed a title "Debug" with the command "/home/dinosaur/Projects/CguiDemo/Debug Main"
Then setting File/Preferences/Keybindings "Build Current File" to F9 somehow assigned the "Brick" icon to the Debug command.

I never use that Icon normally, always compile the "Main.bas" which has all the includes with a Project.bi file.

With every project (if I have to debug) I simply change the path in the "Set Build Commands"
I guess if I were more proficient with Linux I could change the command to pick the current path and the current file (Main.bas)

In an ideal world I should have been able to put a new Icon on the toolbar and assign a command to it.

Regards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: FrontEnd GDB for freebasic

Post by TJF »

I never used the tool bar, it's simply too slow. Instead I use keyboard shortcuts, ie:
  • F8: normal compile
  • F9: run
  • <shrift>F8: debug compile
  • <shrift>F9: debug run
You can set a filetype specific build-menu in file geany/filedefs/filetypes.freebasic like

Code: Select all

[build-menu]
FT_00_LB=_Compile
FT_00_CM=fbc -exx -w all "%f"
FT_00_WD=%d
FT_01_LB=Debug Compile
FT_01_CM=fbc -exx -g -w all "%f"
FT_01_WD=%d
NF_00_LB=Debug Run
NF_00_CM="/full_path_to_Debugger ./%e"
NF_00_WD=%d
EX_00_LB=_Run
EX_00_CM="./%e"
EX_00_WD=%d
This will set two compile commands and the normal run command. And it miss-uses the 'make' entry for the 'run in debugger' mode.

Finally adapt the keyboard shortcuts to your needs in menu

Edit -> Preferences -> Keyboard (Section build)

An other solution for the debug mode is to compile and run in a single step by a command in FT_01_CM like (not sure if it works on wodniws)

fbc -exx -g -w all "%f" && /full_path_to_Debugger %e
Post Reply