debuggers.hg

changeset 21209:b4fce8f4ec37

xentrace: Add an option not to enable tracing

Add an option that will set up the buffers and listen for updates,
but will not enable tracing. This is useful if you have hacks
in Xen to enable tracing at key points (for example, debugging a
shadow bug).

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 13 18:19:10 2010 +0100 (2010-04-13)
parents e2ec5cd8b396
children c02cc832cb2d
files tools/xentrace/xentrace.c
line diff
     1.1 --- a/tools/xentrace/xentrace.c	Tue Apr 13 18:18:36 2010 +0100
     1.2 +++ b/tools/xentrace/xentrace.c	Tue Apr 13 18:19:10 2010 +0100
     1.3 @@ -58,7 +58,8 @@ typedef struct settings_st {
     1.4      unsigned long timeout;
     1.5      unsigned long memory_buffer;
     1.6      uint8_t discard:1,
     1.7 -        disable_tracing:1;
     1.8 +        disable_tracing:1,
     1.9 +        start_disabled:1;
    1.10  } settings_t;
    1.11  
    1.12  struct t_struct {
    1.13 @@ -659,6 +660,10 @@ static int monitor_tbufs(void)
    1.14  
    1.15      /* setup access to trace buffers */
    1.16      get_tbufs(&tbufs_mfn, &tinfo_size);
    1.17 +
    1.18 +    if ( opts.start_disabled )
    1.19 +        disable_tbufs();
    1.20 +    
    1.21      tbufs = map_tbufs(tbufs_mfn, num, tinfo_size);
    1.22  
    1.23      size = tbufs->t_info->tbuf_size * XC_PAGE_SIZE;
    1.24 @@ -791,6 +796,9 @@ static void usage(void)
    1.25  "                          it exits. Selecting this option will tell it to\n" \
    1.26  "                          keep tracing on.  Traces will be collected in\n" \
    1.27  "                          Xen's trace buffers until they become full.\n" \
    1.28 +"  -X  --start-disabled    Setup trace buffers and listen, but don't enable\n" \
    1.29 +"                          tracing. (Useful if tracing will be enabled by\n" \
    1.30 +"                          else.)\n" \
    1.31  "  -T  --time-interval=s   Run xentrace for s seconds and quit.\n" \
    1.32  "  -?, --help              Show this message\n" \
    1.33  "  -V, --version           Print program version\n" \
    1.34 @@ -914,12 +922,13 @@ static void parse_args(int argc, char **
    1.35          { "memory-buffer",  required_argument, 0, 'M' },
    1.36          { "discard-buffers", no_argument,      0, 'D' },
    1.37          { "dont-disable-tracing", no_argument, 0, 'x' },
    1.38 +        { "start-disabled", no_argument,       0, 'X' },
    1.39          { "help",           no_argument,       0, '?' },
    1.40          { "version",        no_argument,       0, 'V' },
    1.41          { 0, 0, 0, 0 }
    1.42      };
    1.43  
    1.44 -    while ( (option = getopt_long(argc, argv, "t:s:c:e:S:r:T:M:Dx?V",
    1.45 +    while ( (option = getopt_long(argc, argv, "t:s:c:e:S:r:T:M:DxX?V",
    1.46                      long_options, NULL)) != -1) 
    1.47      {
    1.48          switch ( option )
    1.49 @@ -957,6 +966,10 @@ static void parse_args(int argc, char **
    1.50              opts.disable_tracing = 0;
    1.51              break;
    1.52  
    1.53 +        case 'X': /* Start disabled */
    1.54 +            opts.start_disabled = 1;
    1.55 +            break;
    1.56 +
    1.57          case 'T':
    1.58              opts.timeout = argtol(optarg, 0);
    1.59              break;
    1.60 @@ -993,6 +1006,7 @@ int main(int argc, char **argv)
    1.61      opts.cpu_mask = 0;
    1.62      opts.disk_rsvd = 0;
    1.63      opts.disable_tracing = 1;
    1.64 +    opts.start_disabled = 0;
    1.65      opts.timeout = 0;
    1.66  
    1.67      parse_args(argc, argv);