aboutsummaryrefslogtreecommitdiffstats
path: root/lib/odbc/src/odbc_debug.erl
blob: a2e5e5dff32228f55a166de11a617772c23e6487 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
%%%-------------------------------------------------------------------
%%% File    : odbc_debug.erl
%%% Author  : Ingela Anderton Andin <[email protected]>
%%% Description : Issuse standard tracing on an odbc connection process
%%%
%%% Created : 12 Dec 2003 by Ingela Anderton Andin <[email protected]>
%%%-------------------------------------------------------------------
-module(odbc_debug).

-export([trace_odbc/2]).

%%%========================================================================
%%% Debug functions
%%%========================================================================

%%--------------------------------------------------------------------------
%% trace_odbc(Process, OnOff, <Level>) -> ok
%%	Process  - pid() | Name | {global, Name} | {Name, Node} 
%%	OnOff   - on | off
%%      Level   - exported | all
%% Description: Turns on tracing of messages sent and recived by
%%              the server <Process> and tracing on all, or all exported 
%%              functions, according to level <Level>, in this module.
%%              Result will be printed on stdout.
%%--------------------------------------------------------------------------
trace_odbc(Process, OnOff) ->
    trace_odbc(Process, OnOff, exported).

trace_odbc(Process, on, exported) ->
    dbg:tracer(),
    dbg:tp(odbc, [{'_', [], [{return_trace}]}]),
    dbg:p(Process, [call, m]),
    ok; 

trace_odbc(Process, on, all) ->
    dbg:tracer(),
    dbg:tpl(odbc, [{'_', [], [{return_trace}]}]),
    dbg:p(Process, [call, m]),
    ok;

trace_odbc(_Process, off, _Level) ->
    dbg:stop(),
    ok.