{
    "mode": "perldoc",
    "parameter": "DB",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DB/json",
    "generated": "2026-06-11T16:24:22Z",
    "synopsis": "package CLIENT;\nuse DB;\n@ISA = qw(DB);\n# these (inherited) methods can be called by the client\nCLIENT->register()      # register a client package name\nCLIENT->done()          # de-register from the debugging API\nCLIENT->skippkg('hide::hide')  # ask DB not to stop in this package\nCLIENT->cont([WHERE])       # run some more (until BREAK or\n# another breakpointt)\nCLIENT->step()              # single step\nCLIENT->next()              # step over\nCLIENT->ret()               # return from current subroutine\nCLIENT->backtrace()         # return the call stack description\nCLIENT->ready()             # call when client setup is done\nCLIENT->tracetoggle()      # toggle subroutine call trace mode\nCLIENT->subs([SUBS])        # return subroutine information\nCLIENT->files()             # return list of all files known to DB\nCLIENT->lines()             # return lines in currently loaded file\nCLIENT->loadfile(FILE,LINE) # load a file and let other clients know\nCLIENT->lineevents()        # return info on lines with actions\nCLIENT->setbreak([WHERE],[COND])\nCLIENT->settbreak([WHERE])\nCLIENT->clrbreaks([LIST])\nCLIENT->setaction(WHERE,ACTION)\nCLIENT->clractions([LIST])\nCLIENT->evalcode(STRING)  # eval STRING in executing code's context\nCLIENT->prestop([STRING]) # execute in code context before stopping\nCLIENT->poststop([STRING])# execute in code context before resuming\n# These methods will be called at the appropriate times.\n# Stub versions provided do nothing.\n# None of these can block.\nCLIENT->init()          # called when debug API inits itself\nCLIENT->stop(FILE,LINE) # when execution stops\nCLIENT->idle()          # while stopped (can be a client event loop)\nCLIENT->cleanup()       # just before exit\nCLIENT->output(LIST)    # called to print any output that\n# the API must show",
    "sections": {
        "NAME": {
            "content": "DB - programmatic interface to the Perl debugging API\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "package CLIENT;\nuse DB;\n@ISA = qw(DB);\n\n# these (inherited) methods can be called by the client\n\nCLIENT->register()      # register a client package name\nCLIENT->done()          # de-register from the debugging API\nCLIENT->skippkg('hide::hide')  # ask DB not to stop in this package\nCLIENT->cont([WHERE])       # run some more (until BREAK or\n# another breakpointt)\nCLIENT->step()              # single step\nCLIENT->next()              # step over\nCLIENT->ret()               # return from current subroutine\nCLIENT->backtrace()         # return the call stack description\nCLIENT->ready()             # call when client setup is done\nCLIENT->tracetoggle()      # toggle subroutine call trace mode\nCLIENT->subs([SUBS])        # return subroutine information\nCLIENT->files()             # return list of all files known to DB\nCLIENT->lines()             # return lines in currently loaded file\nCLIENT->loadfile(FILE,LINE) # load a file and let other clients know\nCLIENT->lineevents()        # return info on lines with actions\nCLIENT->setbreak([WHERE],[COND])\nCLIENT->settbreak([WHERE])\nCLIENT->clrbreaks([LIST])\nCLIENT->setaction(WHERE,ACTION)\nCLIENT->clractions([LIST])\nCLIENT->evalcode(STRING)  # eval STRING in executing code's context\nCLIENT->prestop([STRING]) # execute in code context before stopping\nCLIENT->poststop([STRING])# execute in code context before resuming\n\n# These methods will be called at the appropriate times.\n# Stub versions provided do nothing.\n# None of these can block.\n\nCLIENT->init()          # called when debug API inits itself\nCLIENT->stop(FILE,LINE) # when execution stops\nCLIENT->idle()          # while stopped (can be a client event loop)\nCLIENT->cleanup()       # just before exit\nCLIENT->output(LIST)    # called to print any output that\n# the API must show\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Perl debug information is frequently required not just by debuggers, but also by modules that\nneed some \"special\" information to do their job properly, like profilers.\n\nThis module abstracts and provides all of the hooks into Perl internal debugging functionality,\nso that various implementations of Perl debuggers (or packages that want to simply get at the\n\"privileged\" debugging data) can all benefit from the development of this common code. Currently\nused by Swat, the perl/Tk GUI debugger.\n\nNote that multiple \"front-ends\" can latch into this debugging API simultaneously. This is\nintended to facilitate things like debugging with a command line and GUI at the same time,\ndebugging debuggers etc. [Sounds nice, but this needs some serious support -- GSAR]\n\nIn particular, this API does not provide the following functions:\n\n*   data display\n\n*   command processing\n\n*   command alias management\n\n*   user interface (tty or graphical)\n\nThese are intended to be services performed by the clients of this API.\n\nThis module attempts to be squeaky clean w.r.t \"use strict;\" and when warnings are enabled.\n",
            "subsections": [
                {
                    "name": "Global Variables",
                    "content": "The following \"public\" global names can be read by clients of this API. Beware that these should\nbe considered \"readonly\".\n\n$DB::sub\nName of current executing subroutine.\n\n%DB::sub\nThe keys of this hash are the names of all the known subroutines. Each value is an\nencoded string that has the sprintf(3) format \"(\"%s:%d-%d\", filename, fromline,\ntoline)\".\n\n$DB::single\nSingle-step flag. Will be true if the API will stop at the next statement.\n\n$DB::signal\nSignal flag. Will be set to a true value if a signal was caught. Clients may check for\nthis flag to abort time-consuming operations.\n\n$DB::trace\nThis flag is set to true if the API is tracing through subroutine calls.\n\n@DB::args\nContains the arguments of current subroutine, or the @ARGV array if in the toplevel\ncontext.\n\n@DB::dbline\nList of lines in currently loaded file.\n\n%DB::dbline\nActions in current file (keys are line numbers). The values are strings that have the\nsprintf(3) format \"(\"%s\\000%s\", breakcondition, actioncode)\".\n\n$DB::package\nPackage namespace of currently executing code.\n\n$DB::filename\nCurrently loaded filename.\n\n$DB::subname\nFully qualified name of currently executing subroutine.\n\n$DB::lineno\nLine number that will be executed next.\n\nAPI Methods\nThe following are methods in the DB base class. A client must access these methods by\ninheritance (*not* by calling them directly), since the API keeps track of clients through the\ninheritance mechanism.\n\nCLIENT->register()\nregister a client object/package\n\nCLIENT->evalcode(STRING)\neval STRING in executing code context\n\nCLIENT->skippkg('D::hide')\nask DB not to stop in these packages\n\nCLIENT->run()\nrun some more (until a breakpt is reached)\n\nCLIENT->step()\nsingle step\n\nCLIENT->next()\nstep over\n\nCLIENT->done()\nde-register from the debugging API\n"
                },
                {
                    "name": "Client Callback Methods",
                    "content": "The following \"virtual\" methods can be defined by the client. They will be called by the API at\nappropriate points. Note that unless specified otherwise, the debug API only defines empty,\nnon-functional default versions of these methods.\n\nCLIENT->init()\nCalled after debug API inits itself.\n\nCLIENT->prestop([STRING])\nUsually inherited from DB package. If no arguments are passed, returns the prestop\naction string.\n\nCLIENT->stop()\nCalled when execution stops (w/ args file, line).\n\nCLIENT->idle()\nCalled while stopped (can be a client event loop).\n\nCLIENT->poststop([STRING])\nUsually inherited from DB package. If no arguments are passed, returns the poststop\naction string.\n\nCLIENT->evalcode(STRING)\nUsually inherited from DB package. Ask for a STRING to be \"eval\"-ed in executing code\ncontext.\n\nCLIENT->cleanup()\nCalled just before exit.\n\nCLIENT->output(LIST)\nCalled when API must show a message (warnings, errors etc.).\n"
                }
            ]
        },
        "BUGS": {
            "content": "The interface defined by this module is missing some of the later additions to perl's debugging\nfunctionality. As such, this interface should be considered highly experimental and subject to\nchange.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Gurusamy Sarathy gsar@activestate.com\n\nThis code heavily adapted from an early version of perl5db.pl attributable to Larry Wall and the\nPerl Porters.\n",
            "subsections": []
        }
    },
    "summary": "DB - programmatic interface to the Perl debugging API",
    "flags": [],
    "examples": [],
    "see_also": []
}