How to access Debug menu tools? theyre always disabled

Working on new editor enhancements?
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

How to access Debug menu tools? theyre always disabled

Post by Keya »

How do I get access to the Debug menu tools? they're always disabled/grayed out.

Im using PB v5.31 x86 with mostly default settings, and nothing ive tried in Preferences has enabled the Debugger tools. Checking "Use Debugger" makes no difference. The "Integrated Debugger" is the one ive selected, but the other two dont allow enabled tools either, and I cant find anything in the Help file about it. Can't even use Step. I just checked my Mac-64 version and it's the same. Sorry for newbie question but i couldnt find a solution and would've thought these would all be enabled by default
Image
User avatar
ostapas
Enthusiast
Enthusiast
Posts: 192
Joined: Thu Feb 18, 2010 11:10 pm

Re: How to access Debug menu tools? theyre always disabled

Post by ostapas »

Just set a breakpoint somewhere (F9) or stop your program(F6) after running it.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: How to access Debug menu tools? theyre always disabled

Post by Keya »

thats the Easter Egg i was after, thankyou

Im not sure how i was meant to ascertain that from the helpfile though, the word "breakpoint" doesn't even exist!

I wish Fred would open up the helpfile using Wiki format so users can contribute to it. So many times I go to the helpfile only to find it hasn't answered a question it should've because it only offers minimal details.
Using the debugger

PureBasic provides a powerful debugger that helps you find mistakes and bugs in your source code. It lets you control the program execution, watch your variables, arrays or lists or display debug output of your programs. It also provides advanced features for assembly programmer to examine and modify the CPU registers or view the program stack, or the Memory of your program. It also provides the possibility to debug a program remotely over the network.

To enable the debugger for your program, you can select "Use Debugger" from the debugger menu, or set it in your programs Compiler options. By using the "Compile with Debugger" command from the Compiler menu, you can enable the debugger for just one compilation.

You can directly use debugger commands in your source, such as CallDebugger, Debug, DebugLevel, DisableDebugger and EnableDebugger.

The PureBasic debugger comes in 3 forms:

A Debugger integrated directly with the IDE, for an easy to use, quick way to debug your programs directly from the programming environment. This debugger also provides the most features.

A separate, standalone debugger, that is useful for some special purposes (for example, when the same program must be executed and debugged several times at once) or to be used with third party code Editors. It provides most of the features of the integrated IDE debugger, but because it is separate from the IDE, some of the efficiency of the direct access from the IDE is lost. The standalone debugger can be used to debug programs remotely through a network connection.

A console only debugger. This debuggers primary use is for testing non-graphical environment like on Linux systems without an X server, or to remotely develop through ssh.

The type of debugger that is used can be selected in the preferences.

All this debugging functionality however comes at a price. Running a program in debug mode is significantly slower in its execution that running it without the debugger. This should be no problem however, since this is for testing only anyway.
If you need to use the debugger, but have some parts in you program that require the full execution speed, you can disable the debugger in just that section with the DisableDebugger / EnableDebugger keywords.
Last edited by Keya on Sun Aug 30, 2015 8:54 am, edited 3 times in total.
User avatar
ostapas
Enthusiast
Enthusiast
Posts: 192
Joined: Thu Feb 18, 2010 11:10 pm

Re: How to access Debug menu tools? theyre always disabled

Post by ostapas »

Or call debugging tools manually(ShowWatchlist(), ShowVariableViewer(), etc.) :)
User avatar
ostapas
Enthusiast
Enthusiast
Posts: 192
Joined: Thu Feb 18, 2010 11:10 pm

Re: How to access Debug menu tools? theyre always disabled

Post by ostapas »

It is mentioned at "Included debugging tools":
These tools provide many features to inspect your program while it is running. They can not be used while you are editing the source code.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: How to access Debug menu tools? theyre always disabled

Post by IdeasVacuum »

IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: How to access Debug menu tools? theyre always disabled

Post by Keya »

Ok, I just would've thought that "Using the Debugger" would be the place to go to learn how to use the debugger... not "Line Break-points" (i was never even able to get that far!!) :)

And ostapas, that line you pasted still doesn't say anything about how to enable them, it just tells you when you can't use them, which doesn't really help :)
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: How to access Debug menu tools? theyre always disabled

Post by IdeasVacuum »

If you could just take a minute to see what's there Keya, you will see that Break Points are indeed under the title of Using the Debugger, as per my link :wink:
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: How to access Debug menu tools? theyre always disabled

Post by Dude »

Keya wrote:How do I get access to the Debug menu tools? they're always disabled/grayed out.
That's because you can't debug an app that isn't running. ;)
User avatar
Keya
Addict
Addict
Posts: 1891
Joined: Thu Jun 04, 2015 7:10 am

Re: How to access Debug menu tools? theyre always disabled

Post by Keya »

Dude wrote:
Keya wrote:How do I get access to the Debug menu tools? they're always disabled/grayed out.
That's because you can't debug an app that isn't running. ;)
I would've thought you'd be able to Step Into it to start debugging, i didnt realise you had to set a Breakpoint on the first line. Again not clarified in the helpfile.
Post Reply