idebug(3tk)

πŸ’… idebug β€” the manual page, but make it make sense

okay so bestie, welcome to idebug(3tk). yes that's the manual name, we're keeping it, it's iconic. this whole page is about one lil Tcl command that turns your sad little debugging era into a whole main character moment. let's get into it 🫢


✨ NAME ✨

idebug β€” an interactive debugging environment in TkCon

like. it's a debugger. but it lives inside TkCon. and it's lowkey cute about it.


🌈 SYNOPSIS 🌈

idebug body ?level?

idebug break ?id?

idebug {echo ?id?} ?args?

idebug id ?id?

idebug off

idebug on ?id?

idebug {puts ?id?} args

idebug show type ?level? ?VERBOSE?

idebug trace ?level?

nine whole entry points. she's versatile. we love that for her. πŸ’–


πŸŽ€ DESCRIPTION πŸŽ€

okay so here's the vibe: the idebug command gives you a whole interactive debugging environment for procedures, and it does it via TkCon. no cap.

the way it works is you drop idebug break commands straight into your procedure and boom πŸ’₯ β€” you've made breakpoints. when one hits, it pops up the TkCon console and drops you into a "debugging" mode. very demure, very mindful, very breakpoint.

now, real talk: the body, show & trace methods? those are intended for internal use only. don't go playing with them, they're not for you. πŸ™ˆ

also important: this procedure works for minimal debugging sessions. that's the whole scope, bestie. and comments are encouraged β€” the original author said so, and honestly, they're right.


πŸ’œ the methods, one by one

  • idebug body ?level? β€” prints out the body of the command, but only if it's a procedure, at the level you specify. level defaults to the current level. she's nosy and we support her.
  • idebug break ?id? β€” creates a breakpoint inside a procedure. here's the catch: it will only trigger if idebug is on AND the id matches the pattern. when both line up, TkCon pops to the front and the prompt changes to an idebug prompt. from there you get the basic ability to observe the call stack and query/set variables or execute Tcl commands at any level. also, a separate history is maintained while you're in debugging mode. and to see the special commands available at the debug prompt? type ? and hit return. that's it. that's the move. ✨
  • idebug {echo ?id?} ?args? β€” behaves just like echo, EXCEPT it only triggers when idebug is on. you can pass an optional id to restrict triggering even further. if you don't specify an id, it defaults to the name of the command in which the call was made. defaults doing the work so you don't have to πŸ’…
  • idebug id ?id? β€” query or set the idebug id. this id is what the other idebug methods check to decide whether they should trigger or not. fun fact: the idebug id can be a glob pattern, and it defaults to *. so yes, she accepts wildcards. she's flexible like that.
  • idebug off β€” turns idebug off. that's it. that's the whole method. goodbye πŸ‘‹
  • idebug on ?id? β€” turns idebug on. and if you pass an id, it sets the id to it. two birds, one iconic command.
  • idebug {puts ?id?} args β€” behaves just like puts, except (you guessed it) it only triggers when idebug is on. optional id restricts triggering further. no id? it defaults to the name of the command in which the call was made. same energy as echo, different energy output. πŸ“
  • idebug show type ?level? ?VERBOSE? β€” here type must be one of vars, locals or globals. this method outputs the variables/locals/globals present at a particular level. and if you add VERBOSE, then it actually dumps out the values as well β€” like, the real values, not just the names. level defaults to the level in which this method was called. (remember: internal use only, bestie, don't @ me.)
  • idebug trace ?level? β€” prints out the stack trace from the specified level all the way up to the top level. level defaults to the current level. it's giving "here's how we got here" and honestly? relatable.

πŸ‘€ SEE ALSO πŸ‘€

dump(3tk), observe(3tk), tkcon(1), tkcon(3tk), tkconrc(5)

the whole friend group. go say hi. 🌸


⭐ KEYWORDS ⭐

Tk, console, debug

three words. all bangers.


Copyright (c) Jeffrey Hobbs <jeff at hobbs.org>

respect the author, she ate. πŸ’–


heads up: body, show & trace are for internal use only β€” that's not me being dramatic, that's literally in the description. iykyk. πŸ™ˆ

and that's the whole page, bestie!! this was TkCon version 2.5, served fresh from the idebug(3tk) manual. now go set a breakpoint and slay βœ¨πŸ’…πŸ¦‹

πŸ“¦ where this page comes from