home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomeJava and XSLTSearch this book

8.51. DB

The DB module abstracts and provides all of the hooks into Perl internal debugging functionality, so that various implementations of Perl debuggers (or packages that want simply to get at the "privileged" debugging data) can all benefit from the development of this common code. The following "public" global names can be read by clients of this API, but should be considered read-only:

Stores key/data pairs in data files; equivalent to other hashing packages such as DBM, NDBM, ODBM, GDBM, and SDBM.

Name of current executing subroutine.

The keys of this hash are the names of all the known subroutines. Each value is an encoded string that has the sprintf format ("%s:%d-%d", filename, fromline, toline).

Single-step flag. Will be true if the API will stop at the next statement.

Signal flag. Will be true if a signal was caught.

This flag is set to true if the API is tracing through subroutine calls.

Contains the arguments of current subroutine, or the @ARGV array if in the toplevel context.

List of lines in currently loaded file.

Actions in current file (keys are line numbers). The values are strings that have the sprintf format ("%s\000%s", breakcondition, actioncode).

Package namespace of currently executing code.

Currently loaded filename.

Fully qualified name of currently executing subroutine.

Line number that will be executed next.

8.51.1. API Methods

The following are methods in the DB base class. A client must access these methods by inheritance, since the API keeps track of clients through the inheritance mechanism.

CLIENT->register( )
Registers a client object/package

eval s STRING in executing code context

Asks DB not to stop in these packages

CLIENT->run( )
Runs some more (until a breakpt is reached)

CLIENT->step( )
Single step

CLIENT->next( )
Steps over

CLIENT->done( )
Deregisters from the debugging API

8.51.2. Client Callback Methods

The following "virtual" methods are called by the API at appropriate points. The API provides only empty versions of these methods by default, but they can be defined by the client as needed.

CLIENT->init( )
Called after debug API initializes itself.

Usually inherited from DB package. If no arguments are passed, returns the prestop action string.

CLIENT->stop( )
Called when execution stops, with the filename and line number as arguments.

CLIENT->idle( )
Called while stopped, e.g., in a client event loop.

Usually inherited from DB package. If no arguments are passed, returns the poststop action string.

Usually inherited from DB package. Asks for a STRING to be eval ed in executing code context.

CLIENT->cleanup( )
Called just before exit.

Called when API must show a message (warnings, errors etc.).

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.