comparison src/share/vm/services/nmtDCmd.cpp @ 7412:3f84e17b6bca

8004802: jcmd VM.native_memory baseline=false crashes VM Summary: NMT has to check option's value also to determine which command to execute Reviewed-by: acorn, coleenp, hseigel
author zgu
date Mon, 17 Dec 2012 13:14:02 -0500
parents d2a62e0f25eb
children 06db4c0afbf3
comparison
equal deleted inserted replaced
7396:4a2ed49abd51 7412:3f84e17b6bca
82 output()->print_cr("Incorrect scale value: %s", scale_value); 82 output()->print_cr("Incorrect scale value: %s", scale_value);
83 return; 83 return;
84 } 84 }
85 85
86 int nopt = 0; 86 int nopt = 0;
87 if(_summary.is_set()) { ++nopt; } 87 if(_summary.is_set() && _summary.value()) { ++nopt; }
88 if(_detail.is_set()) { ++nopt; } 88 if(_detail.is_set() && _detail.value()) { ++nopt; }
89 if(_baseline.is_set()) { ++nopt; } 89 if(_baseline.is_set() && _baseline.value()) { ++nopt; }
90 if(_summary_diff.is_set()) { ++nopt; } 90 if(_summary_diff.is_set() && _summary_diff.value()) { ++nopt; }
91 if(_detail_diff.is_set()) { ++nopt; } 91 if(_detail_diff.is_set() && _detail_diff.value()) { ++nopt; }
92 if(_shutdown.is_set()) { ++nopt; } 92 if(_shutdown.is_set() && _shutdown.value()) { ++nopt; }
93 #ifndef PRODUCT 93 #ifndef PRODUCT
94 if(_debug.is_set()) { ++nopt; } 94 if(_debug.is_set() && _debug.value()) { ++nopt; }
95 #endif 95 #endif
96 96
97 if(nopt > 1) { 97 if(nopt > 1) {
98 output()->print_cr("At most one of the following option can be specified: " \ 98 output()->print_cr("At most one of the following option can be specified: " \
99 "summary, detail, baseline, summary.diff, detail.diff, shutdown" 99 "summary, detail, baseline, summary.diff, detail.diff, shutdown"
100 #ifndef PRODUCT 100 #ifndef PRODUCT
101 " ,debug" 101 ", debug"
102 #endif 102 #endif
103 ); 103 );
104 return; 104 return;
105 } 105 } else if (nopt == 0) {
106 106 if (_summary.is_set()) {
107 if(nopt == 0) { 107 output()->print_cr("No command to execute");
108 return;
109 } else {
108 _summary.set_value(true); 110 _summary.set_value(true);
111 }
109 } 112 }
110 113
111 #ifndef PRODUCT 114 #ifndef PRODUCT
112 if (_debug.value()) { 115 if (_debug.value()) {
113 output()->print_cr("debug command is NOT thread-safe, may cause crash"); 116 output()->print_cr("debug command is NOT thread-safe, may cause crash");