Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I get info about SUB inside SUB?
#6
(05-08-2023, 07:18 PM)SMcNeill Wrote: Wouldn't the easiest way just be to assign a global variable for debug tracing?

Code: (Select All)
DIM SHARED ProgFlow$

SUB Foo
   ProgFlow$ = "Foo Start"
   .... sub stuff
   ProgFlow$ = "Foo Clean Exit"
END SUB

Go further and write a QB64 program that creates a copy of QB64 source code that does this. It wouldn't be very difficult, easier because QB64PE (yet) doesn't support nested subprogram definitions. Only detect "SUB" or "FUNCTION" header and place a line right after it. Then set a flag indicating the processor is inside a subprogram, so it doesn't get confused with "main module" level code. Then when "END SUB" or "END FUNCTION is encountered put a line before that saying the subprogram is about to exit. Also have to check "EXIT SUB" and "EXIT FUNCTION" for it.

With "FUNCTION" get even fancier and even report what type it returns. "Entered function ''Zeroes'' which returns STRING."

It takes more effort to use such an utility, that's why some people expected the IDE to be able to do it.
Reply


Messages In This Thread
RE: Can I get info about SUB inside SUB? - by mnrvovrfc - 05-08-2023, 08:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  More info about Random Access files PhilOfPerth 28 962 02-25-2026, 01:50 PM
Last Post: ahenry3068
  Exiting sub while inside a loop PhilOfPerth 5 525 12-05-2025, 09:40 AM
Last Post: PhilOfPerth
  Making the content list of files inside a Zip ? euklides 13 2,407 02-08-2024, 03:52 PM
Last Post: euklides
  0.71 Info on compilation error krovit 7 1,762 06-11-2022, 04:28 PM
Last Post: DSMan195276

Forum Jump:


Users browsing this thread: 1 Guest(s)