diff options
author | Sean Callanan <scallanan@apple.com> | 2016-06-02 17:59:47 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2016-06-02 17:59:47 +0000 |
commit | 34ab28a470630bcf87d6199bf2844d17305cdeff (patch) | |
tree | d4ad4dd047116f3eb876b48bc9f224f1a50eb7d3 /lldb/packages/Python/lldbsuite/test | |
parent | b9c80fd8b5426514259ae552dfb71b5cdd61a097 (diff) | |
download | bcm5719-llvm-34ab28a470630bcf87d6199bf2844d17305cdeff.tar.gz bcm5719-llvm-34ab28a470630bcf87d6199bf2844d17305cdeff.zip |
Fixed a problem where we couldn't call extern "C" functions.
Some compilers do not mark up C++ functions as extern "C" in the DWARF, so LLDB
has to fall back (if it is about to give up finding a symbol) to using the base
name of the function.
This fix also ensures that we search by full name rather than "auto," which
could cause unrelated C++ names to be found. Finally, it adds a test case.
<rdar://problem/25094302>
llvm-svn: 271551
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 36 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/Makefile new file mode 100644 index 00000000000..cd9ca5c86d8 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/Makefile @@ -0,0 +1,3 @@ +LEVEL = ../../../make +C_SOURCES := main.c +include $(LEVEL)/Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py new file mode 100644 index 00000000000..f08c0dcbda9 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py @@ -0,0 +1,4 @@ +from lldbsuite.test import lldbinline +from lldbsuite.test import decorators + +lldbinline.MakeInlineTest(__file__, globals(), []) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/main.cpp new file mode 100644 index 00000000000..a4006c2f7ed --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/extern_c/main.cpp @@ -0,0 +1,29 @@ +//===-- main.cpp ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <stdio.h> +#include <stdint.h> + +extern "C" +{ + int foo(); +}; + +int foo() +{ + puts("foo"); + return 2; +} + +int main (int argc, char const *argv[], char const *envp[]) +{ + foo(); + return 0; //% self.expect("expression -- foo()", substrs = ['2']) +} + |