1 package body dbms_debug_jdwp_custom is
2
3 -- This is the default implementation of the custom package
4 -- procedure that will be invoked to process a debug connection request
5 -- that arrives in the form of an ORA_DEBUG_JDWP environment variable.
6 -- This default implemenation is owned by SYS and is made available
7 -- to public via a public synonym.
8 --
9 -- The default implementation of this procedure does not perform any
10 -- additional security checks. A request to connect the session to a
11 -- debugger will be controlled only by the DEBUG CONNECT privilege
12 -- requirements. A database user who wants to perform custom security
13 -- checks as well can override this default implementation by defining
14 -- this same package in his or her own schema and implementing the
15 -- check in that local copy.
16
17 -- The arguments to the custom package procedure must all be of varchar2
18 -- type or of types which PL/SQL can implicitly convert to varchar2.
19 --
20 -- A programmer who wants to customize the handling of the debug connection
21 -- request may override this default implementation of the package procedure
22 -- by installing the same package (specification and body) with a procedure
23 -- of the same name in his own schema. He may customize the number and
24 -- names of the arguments to the package procedure. Only the names of
25 -- the package and of the procedure need to remain the same (namely
26 -- (DBMS_DEBUG_JDWP_CUSTOM and CONNECT_DEBUGGER respectively). The
27 -- programmer's customized version of the package may contain overloaded
28 -- versions of the procedure CONNECT_DEBUGGER with different arguments.
29 --
30 procedure connect_debugger(host varchar2,
31 port varchar2,
32 debug_role varchar2 := NULL,
33 debug_role_pwd varchar2 := NULL,
34 option_flags pls_integer := 0,
35 extensions_cmd_set pls_integer := 128)
36 is
37 begin
38
39 -- Connects the database session to the debugger.
40 --
41 -- A programmer who wants to perform added security checks to decide if
42 -- the debug connection request is granted (for example, by verifying
43 -- that the debugger is running on a trusted host) may do so with code
44 -- like
45 --
46 -- if (utl_inaddr.get_host_address(host) != '123.45.67.89') then
47 -- raise_application_error(-20000,
48 -- 'debug connection to ' || host || ' no permitted');
49 -- else
50 -- dbms_debug_jdwp.connect_tcp(host => host,
51 -- port => port,
52 -- debug_role => debug_role,
53 -- debug_role_pwd => debug_role_pwd,
54 -- option_flags => option_flags,
55 -- extensions_cmd_set =>
56 -- extensions_cmd_set);
57 -- end if;
58 --
59 dbms_debug_jdwp.connect_tcp(host => host,
60 port => port,
61 debug_role => debug_role,
62 debug_role_pwd => debug_role_pwd,
63 option_flags => option_flags,
64 extensions_cmd_set => extensions_cmd_set);
65 end;
66
67 end;