xref: /freebsd/contrib/llvm-project/lldb/tools/argdumper/argdumper.cpp (revision 17c328b6aebfa03cd1c2cbfbbc617e3b341bf1e4)
1 //===-- argdumper.cpp --------------------------------------------*- C++-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "lldb/Utility/JSON.h"
10 #include "lldb/Utility/StreamString.h"
11 
12 #include <iostream>
13 
14 using namespace lldb_private;
15 
16 int main(int argc, char *argv[]) {
17   JSONArray::SP arguments(new JSONArray());
18   for (int i = 1; i < argc; i++) {
19     arguments->AppendObject(JSONString::SP(new JSONString(argv[i])));
20   }
21 
22   JSONObject::SP object(new JSONObject());
23   object->SetObject("arguments", arguments);
24 
25   StreamString ss;
26 
27   object->Write(ss);
28 
29   std::cout << ss.GetData() << std::endl;
30 
31   return 0;
32 }
33