--- a/src/hotspot/share/services/diagnosticCommand.cpp Wed Apr 11 20:56:56 2018 +0300
+++ b/src/hotspot/share/services/diagnosticCommand.cpp Wed Mar 28 22:03:57 2018 +0200
@@ -137,9 +137,15 @@
_dcmdparser.add_dcmd_argument(&_cmd);
};
+
+static int compare_strings(const char** s1, const char** s2) {
+ return ::strcmp(*s1, *s2);
+}
+
void HelpDCmd::execute(DCmdSource source, TRAPS) {
if (_all.value()) {
GrowableArray<const char*>* cmd_list = DCmdFactory::DCmd_list(source);
+ cmd_list->sort(compare_strings);
for (int i = 0; i < cmd_list->length(); i++) {
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
strlen(cmd_list->at(i)));
@@ -180,6 +186,7 @@
} else {
output()->print_cr("The following commands are available:");
GrowableArray<const char *>* cmd_list = DCmdFactory::DCmd_list(source);
+ cmd_list->sort(compare_strings);
for (int i = 0; i < cmd_list->length(); i++) {
DCmdFactory* factory = DCmdFactory::factory(source, cmd_list->at(i),
strlen(cmd_list->at(i)));