New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expressions fail when calling varargs functions on FreeBSD 9.2 (built with GCC 4.2.1) #17557
Comments
assigned to @emaste |
This is on FreeBSD 9.2, with libc.so built with the default system compiler GCC 4.2.1. I suspect this is an issue with the DWARF generated by that old GCC and that newer GCC or clang will not demonstrate this problem. |
A related failure is that I'm seeing on my FreeBSD 9.2 test system is test/expression_command/test/TestExprs.py, also a failing printf expression: (lldb) expr printf("\t\x68\n") The expression parser produces: Function disassembly: without detecting printf as a varargs function it can't be called correctly |
Ed: I would check your DWARF for debug info for "printf". If there is a function prototype, LLDB could either be parsing it wrong, or it might be wrong in the DWARF. If you can attach the executable that contains the DWARF for "printf", I can probably tell you more. |
Looks like you need to attach the ELF file for libc.so.7 that contains the DWARF debug info. |
vararg test |
It looks like there is more to this issue than I thought. Simple varargs test attached. Building with the system compiler on my laptop, FreeBSD 11-CURRENT / clang 3.4 gives me: joule% cc --version (lldb) expr sum(2, 1, 1) DWARF output from our old GCC is somewhat different: joule% gcc -g -Wall vararg.c Looks like DW_TAG_unspecified_parameters should report that this is a vararg fn, but lldb reports the same error for this case. |
This is a clang bug. It should be emitting a DW_TAG_unspecified_parameters tag after the DW_TAG_formal_parameter children in a DW_TAG_subprogram, DW_TAG_inlined_subroutine, or DW_TAG_subroutine_type. There is a long standing bug tracking this in clang at apple: 13690847 If you file a bug on Bugzilla, you should reference the apple bug number. I fixed LLDB to be ready for the clang change with: % svn commit source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp So now if you file a bugzilla bug on clang, you can track when it gets fixed on the clang side. Marking as fixed because LLDB is ready for the clang changes. |
Works w/ gcc after r202061 (http://llvm.org/viewvc/llvm-project?rev=202061&view=rev) Unfortunately Clang does not (yet) emit DW_TAG_unspecified_parameters, so still fails when built w/ Clang |
Clang bug: http://llvm.org/bugs/show_bug.cgi?id=18950 |
Extended Description
Test fails on FreeBSD: test/expression_command/radar_9531204/TestPrintfAfterUp.py
Reproducing manually:
(lldb) expression (int)printf("value is %d.\n", value);
error: no matching function for call to 'printf'
note: candidate function not viable: requires 1 argument, but 2 were provided
error: 1 errors parsing expression
turning on expression logging shows
ClangExpressionDeclMap::FindExternalVisibleDecls[6] for 'printf' in a 'TranslationUnit'
CEDM::FEVD[6] Searching the root namespace
CEDM::FEVD[6] Found specific function printf (description libc.so.7`printf at printf.c:50), returned static int printf(static const char *)
The text was updated successfully, but these errors were encountered: