dll_hash_main.cc revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// This is a utility executable used for generating hashes for dll names
6// for inclusion in tools/metrics/histograms/histograms.xml. Every
7// dll name must have a corresponding entry in the enum there.
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <string.h>
12
13#include "chrome_elf/dll_hash/dll_hash.h"
14
15int main(int argc, char** argv) {
16  if (argc < 2) {
17    fprintf(stderr, "Usage: %s <dll name> <dll name> <...>\n", argv[0]);
18    fprintf(stderr, "\n");
19    fprintf(stderr, "Prints hashes for dll names.\n");
20    fprintf(stderr, "Example: %s \"my_dll.dll\" \"user32.dll\"\n", argv[0]);
21    return 1;
22  }
23  for (int i = 1; i < argc; i++) {
24    int hash = DllNameToHash(std::string(argv[i]));
25    printf("<int value=\"%d\" label=\"%s\"/>\n", hash, argv[i]);
26  }
27  return 0;
28}
29