summaryrefslogtreecommitdiff
path: root/src/ToolBox/superpmi/mcs/verbdump.cpp
blob: 7a04abced68e20e6bd3ab15bf30a246ea7328bc8 (plain)
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
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

#include "standardpch.h"
#include "verbdump.h"
#include "logging.h"
#include "methodcontext.h"
#include "methodcontextiterator.h"
#include "errorhandling.h"

int verbDump::DoWork(const char* nameOfInput, int indexCount, const int* indexes)
{
    LogVerbose("Dumping '%s' to console", nameOfInput);

    MethodContextIterator mci(indexCount, indexes);
    if (!mci.Initialize(nameOfInput))
        return -1;

    int dumpedCount = 0;

    while (mci.MoveNext())
    {
        MethodContext* mc = mci.Current();
        mc->dumpToConsole(mci.MethodContextNumber());
        dumpedCount++;
    }

    LogVerbose("Dumped %d methodContexts", dumpedCount);

    if (!mci.Destroy())
        return -1;

    return 0;
}