[PB5.22LTSX86] Problem with debugger to Exe

Just starting out? Need help? Post your questions and find answers here.
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

[PB5.22LTSX86] Problem with debugger to Exe

Post by Falko »

Sorry for this link in germany, but freak can read this :)

http://forums.purebasic.com/german/view ... 9d#p321319

My curl-program, if compiled to an exe with "debug" in every lines, makes problems for me.
it seems, into the exe are all lines with debug erased.

is it a bug?

(sorry my english, i hope you understand this)

Regards,
Falko
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by Shield »

Well, of course the "Debug foo" lines are excluded from the final exe (i.e. without debug information).
That's how it has always been and I'm sure it's mentioned in the help.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by Falko »

Okay, you're right. In the help it is. This is me before never noticed until now. :?
:idea: Fred could just remove the command "debug" for the exe instead of a functioning line yet. But it seems not to go, I think.

Translated with google
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by Shield »

Well, it does make sense to remove the entire line. Of course there are some arguments
against that behavior, but I'd say it's safer to remove the entire line than to risk
having debug code in the final executable. :)

Also, to change this in PB would break way too many sources.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by PB »

> Fred could just remove the command "debug" for the exe instead of a functioning line

No, because that breaks apps. The following would give a syntax error for line 4:

Code: Select all

OpenWindow(0,200,200,200,100,"test",#PB_Window_SystemMenu)
Repeat
  ev=WaitWindowEvent()
  Debug ev
Until ev=#PB_Event_CloseWindow
Don't use Debug for actual code. Use it to display debug info, as intended.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by Falko »

But here you can remove the entire line of the compiler because it makes no sense
to leave alone a variable.
I can already imagine that the compiler could distinguish whether a variable or a command is checked with debug.

Otherwise, I mus agree with you.

(translate with google)
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by Shield »

So...

Code: Select all

CompilerIf #PB_Compiler_Debugger
	Macro DebugAny
		Debug 
	EndMacro
CompilerElse
	Macro DebugAny
		
	EndMacro
CompilerEndIf

Procedure.i Foo()
	PrintN("Test")
EndProcedure

Define var.i = 10

DebugAny OpenConsole()
DebugAny Foo()
Debug 10
Debug var

Input()
Add 'DebugAny' as a custom keyword and you're all set.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Falko
Enthusiast
Enthusiast
Posts: 271
Joined: Sat Oct 04, 2003 12:57 pm
Location: Germany
Contact:

Re: [PB5.22LTSX86] Problem with debugger to Exe

Post by Falko »

Hehe...

Thank you for the virtual Debugger :).
www.falko-pure.de
Win11 Pro 64-Bit, PB_6.11b1
Post Reply