[Lldb-commits] [PATCH] linux: fix include in lldb.swig
Greg Clayton
gclayton at apple.com
Wed Dec 15 14:17:59 PST 2010
On Dec 15, 2010, at 2:05 PM, Stephen Wilson wrote:
> Greg Clayton <gclayton at apple.com> writes:
>
>> On Dec 15, 2010, at 1:31 PM, Stephen Wilson wrote:
>>
>>>
>>> Hi Greg,
>>>
>>> Greg Clayton <gclayton at apple.com> writes:
>>>
>>>> I am not sure this is what we want either. We want the UINT32_MAX and friends to
>>>> be defined in the generated SWIG file since we use them to test for invalid
>>>> indexes (much like in the "uint32_t SBBreakpoint::GetThreadIndex() const"
>>>> function. Can you try setting your PYTHONPATH to point to the lldb.so on linux
>>>> (the lldb.py file needs to be in the same directory and then make and run this
>>>> python script:
>>>
>>> I hope this question is not too stupid, but where is lldb.py? I see a
>>> reference in dotest.py indicating that it is distributed with XCode4.
>>> If it is not in the lldb tree, do you have a link handy (google can't
>>> seem to help me here)?
>>
>> the swig invocation should produce the lldb.py file. Not sure where it
>> will end up on linux, possibly next to the "lldb" binary?
>
> Ah, OK! I also needed to add a "_lldb.so" symlink pointing to liblldb.so.
>
> Unfortunately, I do not see the stuff from stdint.h.
sounds like we want to still use %include if we can then...
>
> I also upgraded my Swig installation to 2.0.1 but still cannot process
> stdint.h. The error I am getting is:
>
> swig -c++ -shadow -python -I"/home/steve/development/llvm/llvm-git/tools/lldb/source/Interpreter/../../include" \
> -I./. -I"/usr/include" -outdir "/home/steve/development/build/llvm-git/Debug+Asserts/bin" \
> -o LLDBWrapPython.cpp "/home/steve/development/llvm/llvm-git/tools/lldb/source/Interpreter/../../scripts/lldb.swig"
> /usr/include/stdint.h:44: Error: Syntax error in input(1).
>
>
> Looks to me like Swig does not like GCC's __extension__ "keyword".
>
>
> I wish I knew more about Swig... Any ideas?
No ideas off the top of my head. Are there any other header files that define UINT32_MAX and friends? Maybe <cstdint>?
>
>
>
> Thanks for your help,
>
>>>
>>>> % setenv PYTHONPATH /build/Debug/LLDB.framework/Resources/Python % cat
>>>> dirlldb.py #!/usr/bin/python import lldb print dir(lldb)
>>>>
>>>>
>>>> If I do this on MacOSX I see all of the stuff from stdint.h:
>>>>
>>>> % ./dirlldb.py ['INT16_MAX', 'INT16_MIN', 'INT32_MAX', 'INT32_MIN', 'INT64_MAX',
>>>> INT64_MIN', 'INT8_MAX', 'INT8_MIN', 'INTMAX_MAX', 'INTMAX_MIN', 'INTPTR_MAX',
>>>> INTPTR_MIN', 'INT_FAST16_MAX', 'INT_FAST16_MIN', 'INT_FAST32_MAX',
>>>> INT_FAST32_MIN', 'INT_FAST64_MAX', 'INT_FAST64_MIN', 'INT_FAST8_MAX',
>>>> INT_FAST8_MIN', 'INT_LEAST16_MAX', 'INT_LEAST16_MIN', 'INT_LEAST32_MAX',
>>>> INT_LEAST32_MIN', 'INT_LEAST64_MAX', 'INT_LEAST64_MIN', 'INT_LEAST8_MAX',
>>>> INT_LEAST8_MIN', 'LLDB_ARCH_DEFAULT', ...
>>>>
>>>> Do you still see these in the resulting SWIG module when you use #include?
>>>>
>>>>
>>>> On Dec 15, 2010, at 12:28 PM, Stephen Wilson wrote:
>>>>
>>>>> I would appreciate it if someone with experience in Swig could look this one
>>>>> over. I am not 100% positive this is the proper fix.
>>>>>
>>>>>
>>>>> Use #include rather than the Swig %include directive.
>>>>>
>>>>> In order to use the %include directive Swig needs to be instructed as to
>>>>> the search path. However, Swig 1.3.40 cannot process stdint.h provided by
>>>>> glibc. This fix takes advantage of the fact that, by default, Swig does not
>>>>> process headers introduced via #include.
>>>>>
>>>>> diff --git a/scripts/lldb.swig b/scripts/lldb.swig index 95c409e..63167c8
>>>>> 100644 --- a/scripts/lldb.swig +++ b/scripts/lldb.swig @@ -97,7 +97,7 @@ %}
>>>>>
>>>>> /* Various liblldb typedefs that SWIG needs to know about. */ -%include
>>>>> <stdint.h> +#include <stdint.h> %include "lldb/lldb-defines.h" %include
>>>>> "lldb/lldb-enumerations.h" %include "lldb/lldb-forward.h"
>>>>> _______________________________________________ lldb-commits mailing list
>>>>> lldb-commits at cs.uiuc.edu
>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>>>
>>>
>>> --
>>> steve
>>
>
>
>
> --
> steve
More information about the lldb-commits
mailing list