Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
Line
Count
Source (jump to first uncovered line)
1
//===-- DWARFDefines.cpp --------------------------------------------------===//
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 "DWARFDefines.h"
10
#include "lldb/Utility/ConstString.h"
11
#include <cstdio>
12
#include <cstring>
13
#include <string>
14
15
namespace lldb_private {
16
17
14
const char *DW_TAG_value_to_name(uint32_t val) {
18
14
  static char invalid[100];
19
20
14
  if (val == 0)
21
0
    return "NULL";
22
23
14
  llvm::StringRef llvmstr = llvm::dwarf::TagString(val);
24
14
  if (llvmstr.empty()) {
25
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_TAG constant: 0x%x", val);
26
0
    return invalid;
27
0
  }
28
14
  return llvmstr.data();
29
14
}
30
31
0
const char *DW_AT_value_to_name(uint32_t val) {
32
0
  static char invalid[100];
33
0
  llvm::StringRef llvmstr = llvm::dwarf::AttributeString(val);
34
0
  if (llvmstr.empty()) {
35
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_AT constant: 0x%x", val);
36
0
    return invalid;
37
0
  }
38
0
  return llvmstr.data();
39
0
}
40
41
0
const char *DW_FORM_value_to_name(uint32_t val) {
42
0
  static char invalid[100];
43
0
  llvm::StringRef llvmstr = llvm::dwarf::FormEncodingString(val);
44
0
  if (llvmstr.empty()) {
45
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_FORM constant: 0x%x", val);
46
0
    return invalid;
47
0
  }
48
0
  return llvmstr.data();
49
0
}
50
51
69
const char *DW_OP_value_to_name(uint32_t val) {
52
69
  static char invalid[100];
53
69
  llvm::StringRef llvmstr = llvm::dwarf::OperationEncodingString(val);
54
69
  if (llvmstr.empty()) {
55
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_OP constant: 0x%x", val);
56
0
    return invalid;
57
0
  }
58
69
  return llvmstr.data();
59
69
}
60
61
0
const char *DW_ATE_value_to_name(uint32_t val) {
62
0
  static char invalid[100];
63
0
  llvm::StringRef llvmstr = llvm::dwarf::AttributeEncodingString(val);
64
0
  if (llvmstr.empty()) {
65
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_ATE constant: 0x%x", val);
66
0
    return invalid;
67
0
  }
68
0
  return llvmstr.data();
69
0
}
70
71
0
const char *DW_LANG_value_to_name(uint32_t val) {
72
0
  static char invalid[100];
73
0
  llvm::StringRef llvmstr = llvm::dwarf::LanguageString(val);
74
0
  if (llvmstr.empty()) {
75
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_LANG constant: 0x%x", val);
76
0
    return invalid;
77
0
  }
78
0
  return llvmstr.data();
79
0
}
80
81
0
const char *DW_LNS_value_to_name(uint32_t val) {
82
0
  static char invalid[100];
83
0
  llvm::StringRef llvmstr = llvm::dwarf::LNStandardString(val);
84
0
  if (llvmstr.empty()) {
85
0
    snprintf(invalid, sizeof(invalid), "Unknown DW_LNS constant: 0x%x", val);
86
0
    return invalid;
87
0
  }
88
0
  return llvmstr.data();
89
0
}
90
91
} // namespace lldb_private