[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / packages / Python / lldbsuite / test / commands / settings / main.cpp
blob5159eaa65b5abd2c01e319b39710a6b51a08f908
1 //===-- main.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 //===----------------------------------------------------------------------===//
9 #include <cstdlib>
10 #include <string>
11 #include <fstream>
12 #include <iostream>
14 int numberfn()
16 return 0x5a;
19 int
20 main(int argc, char const *argv[])
22 // The program writes its output to the following file:
24 // o "output1.txt" for test_pass_host_env_vars() test case
25 // o "output2.txt" for test_run_args_and_env_vars_with_dsym() test case
26 // o "output2.txt" for test_run_args_and_env_vars_with_dwarf() test case
27 std::ofstream outfile;
28 if (argc == 1)
29 outfile.open("output1.txt");
30 else
31 outfile.open("output2.txt");
33 for (unsigned i = 0; i < argc; ++i) {
34 std::string theArg(argv[i]);
35 if (i == 1 && "A" == theArg)
36 outfile << "argv[1] matches\n";
38 if (i == 2 && "B" == theArg)
39 outfile << "argv[2] matches\n";
41 if (i == 3 && "C" == theArg)
42 outfile << "argv[3] matches\n";
45 // For passing environment vars from the debugger to the launched process.
46 if (::getenv("MY_ENV_VAR")) {
47 std::string MY_ENV_VAR(getenv("MY_ENV_VAR"));
48 if ("YES" == MY_ENV_VAR) {
49 outfile << "Environment variable 'MY_ENV_VAR' successfully passed.\n";
54 // For passing host environment vars to the launched process.
55 if (::getenv("MY_HOST_ENV_VAR1")) {
56 std::string MY_HOST_ENV_VAR1(getenv("MY_HOST_ENV_VAR1"));
57 if ("VAR1" == MY_HOST_ENV_VAR1) {
58 outfile << "The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.\n";
62 if (::getenv("MY_HOST_ENV_VAR2")) {
63 std::string MY_HOST_ENV_VAR2(getenv("MY_HOST_ENV_VAR2"));
64 if ("VAR2" == MY_HOST_ENV_VAR2) {
65 outfile << "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed.\n";
69 std::cerr << "This message should go to standard error.\n";
70 std::cout << "This message should go to standard out.\n";
72 outfile.close();
73 return numberfn();