diff options
author | Kevin Enderby <enderby@apple.com> | 2011-12-09 18:09:40 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2011-12-09 18:09:40 +0000 |
commit | 94c2e85bea1ab1b837a4c055ccc83d5cd32dd027 (patch) | |
tree | 2439394068bac231063b5bd6d977167d65e29ebf /tools/llvm-mc | |
parent | bf67a99c35412db4bf6c1e2fd511d9044d6acc71 (diff) | |
download | external_llvm-94c2e85bea1ab1b837a4c055ccc83d5cd32dd027.zip external_llvm-94c2e85bea1ab1b837a4c055ccc83d5cd32dd027.tar.gz external_llvm-94c2e85bea1ab1b837a4c055ccc83d5cd32dd027.tar.bz2 |
The second part of support for generating dwarf for assembly source files. This
generates the dwarf Compile Unit DIE and a dwarf subprogram DIE for each
non-temporary label.
The next part will be to get the clang driver to enable this when assembling
a .s file. rdar://9275556
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 1139e36..4281259 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -234,6 +234,17 @@ static tool_output_file *GetOutputStream() { return Out; } +static std::string DwarfDebugFlags; +static void setDwarfDebugFlags(int argc, char **argv) { + if (!getenv("RC_DEBUG_OPTIONS")) + return; + for (int i = 0; i < argc; i++) { + DwarfDebugFlags += argv[i]; + if (i + 1 < argc) + DwarfDebugFlags += " "; + } +} + static int AsLexInput(const char *ProgName) { OwningPtr<MemoryBuffer> BufferPtr; if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr)) { @@ -382,6 +393,8 @@ static int AssembleInput(const char *ProgName) { Ctx.setAllowTemporaryLabels(false); Ctx.setGenDwarfForAssembly(GenDwarfForAssembly); + if (!DwarfDebugFlags.empty()) + Ctx.setDwarfDebugFlags(StringRef(DwarfDebugFlags)); // Package up features to be passed to target/subtarget std::string FeaturesStr; @@ -508,6 +521,7 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n"); TripleName = Triple::normalize(TripleName); + setDwarfDebugFlags(argc, argv); switch (Action) { default: |