[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
zturner added a subscriber: clayborg. zturner added a comment. I know when I stepped through it with the Pi example, it was returning all matches, but not filtering down the results based on the template parameter first, so you’d get back every instantiation but the template parameter would be treated as a subexpression. I think the SymbolFile plugin should just get the whole string though and do this filtering itself. Might be hard for complicated template arguments. But if it’s too hard the plugin can always just give up and do what it currently does. For PDB it’s the other way around, without this information lookup is actually impossible, because you have to hash the record name, and the template parameters are part of the hash https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
I know when I stepped through it with the Pi example, it was returning all matches, but not filtering down the results based on the template parameter first, so you’d get back every instantiation but the template parameter would be treated as a subexpression. I think the SymbolFile plugin should just get the whole string though and do this filtering itself. Might be hard for complicated template arguments. But if it’s too hard the plugin can always just give up and do what it currently does. For PDB it’s the other way around, without this information lookup is actually impossible, because you have to hash the record name, and the template parameters are part of the hash On Mon, Nov 12, 2018 at 6:34 PM Greg Clayton via Phabricator < revi...@reviews.llvm.org> wrote: > clayborg added a comment. > > In https://reviews.llvm.org/D54454#1296392, @zturner wrote: > > > BTW, I will have to see if it's possible to write a test for this. Even > when I compiled and built a program with DWARF on Linux, the `target > variable Pi` example didn't "just work" for me, because > `FindGlobalVariables` wasn't returning the variable. So I think this part > actually needs to be fixed in the DWARF plugin, which I'm not equipped to > fix. I can try something that is not a variable template, such as the > `Foo::StaticMember` example, but if that also doesn't work, then there > might not be a good way to write a general purpose test for this until this > is fixed in the DWARF plugin. > > > > I can definitely add a test in the native pdb plugin though, and > technically that runs everywhere (although it would only test `target > variable` and not `frame variable`, maybe that's ok though?). > > > It is the template stuff that throws things off. Can't remember if there > is an accelerator table entry for those. Global variables in general work. > It would be good to figure out what this doesn't work for DWARF. I will > take a look. > > > https://reviews.llvm.org/D54454 > > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
clayborg added a comment. In https://reviews.llvm.org/D54454#1296392, @zturner wrote: > BTW, I will have to see if it's possible to write a test for this. Even when > I compiled and built a program with DWARF on Linux, the `target variable > Pi` example didn't "just work" for me, because `FindGlobalVariables` > wasn't returning the variable. So I think this part actually needs to be > fixed in the DWARF plugin, which I'm not equipped to fix. I can try > something that is not a variable template, such as the > `Foo::StaticMember` example, but if that also doesn't work, then there > might not be a good way to write a general purpose test for this until this > is fixed in the DWARF plugin. > > I can definitely add a test in the native pdb plugin though, and technically > that runs everywhere (although it would only test `target variable` and not > `frame variable`, maybe that's ok though?). It is the template stuff that throws things off. Can't remember if there is an accelerator table entry for those. Global variables in general work. It would be good to figure out what this doesn't work for DWARF. I will take a look. https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54460: Don't keep a global ABI plugin per architecture
clayborg added a comment. Anything that takes a process shared pointer should be per process. A long time ago these plug-ins didn't take process, and as time went on they did take a process: 306633 jmolenda ABI(lldb::ProcessSP process_sp) { 306633 jmolenda if (process_sp.get()) 306633 jmolenda m_process_wp = process_sp; 306633 jmolenda } 245277 labath 306633 jmolenda lldb::ProcessWP m_process_wp; 306633 jmolenda The ABI plug-in started off just figuring out where return values were and and where argument values went.. If there was no process, then each ABI plug-in really is per architecture and they could be shared. Not sure if there is anything cached in any ABI plug-ins that is process specific. The change log says: Change the ABI class to have a weak pointer to its Process; some methods in the ABI need a Process to do their work. Instead of passing it in as a one-off argument to those methods, this patch puts it in the base class and the methods can retrieve if it needed. Note that ABI's are sometimes built without a Process (e.g. SBTarget::GetStackRedZoneSize) so it's entirely possible that the process weak pointer will not be able to reconsistitue into a strong pointer. So to avoid having to pass the process to ABI functions that require it, it sounds like Jason just put it into the class. We can either take the process out of the base class and pass it in where it is needed to each method and keep one copy, or we can make new ones for each process. They aren't huge. Repository: rLLDB LLDB https://reviews.llvm.org/D54460 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54460: Don't keep a global ABI plugin per architecture
zturner added a comment. > If there were ever anything per-process that effected the ABI plugin's > behavior (for instance if it relied on a Process property) you could very > well use the wrong processes setting. Even worse, since the ABI's hold onto a > process through a weak pointer, if the initial process had gone away, you > would not be able to get to any process at all, and silently fall back on > some default behavior. This sounds like something testable. Start a process, force an operation that goes through the ABI, kill the process, start a new one, do the same thing again. Presumably this crashes in current LLDB? Maybe this makes for a good test case? BTW, as a general rule of thumb, `std::make_shared(constructor_args)` is preferred over `shared_ptr(new T(constructor_args));` unless it's impossible (the only time being where a constructor is private or protected). The biggest reason is that it's every so slightly more efficient. This usually doesn't matter, but it's one of those "well, why not?" kinda things. Feel free to use the current syntax though, just pointing it out in case it strikes your fancy. Repository: rLLDB LLDB https://reviews.llvm.org/D54460 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54460: Don't keep a global ABI plugin per architecture
jasonmolenda accepted this revision. jasonmolenda added a comment. This revision is now accepted and ready to land. LGTM, my guess is that this was Greg's code originally. He may have made a singleton object out of caution. Repository: rLLDB LLDB https://reviews.llvm.org/D54460 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54460: Don't keep a global ABI plugin per architecture
jingham created this revision. jingham added reviewers: clayborg, jasonmolenda. Herald added subscribers: lldb-commits, abidh, atanasyan, kbarton, javed.absar, nemanjai. For reasons that are unclear to me, when the ABIXXX::CreateInstance function is called to make a new ABI for a given process and ArchSpec, we would only make the plugin once, with the initial process and architecture. Then if we got called with a different process, we would check to see if we already made one and if we did, hand back the one we had made - even though that was for a different process. If there were ever anything per-process that effected the ABI plugin's behavior (for instance if it relied on a Process property) you could very well use the wrong processes setting. Even worse, since the ABI's hold onto a process through a weak pointer, if the initial process had gone away, you would not be able to get to any process at all, and silently fall back on some default behavior. This caching goes back to prehistoric days in lldb, but I can't think of any reason why we would do this. It seems clearly wrong, and ABI plugins are really cheap to make - they pretty much just copy the process SP to a weak pointer and that's about all. So this also seems like an unnecessary optimization. Greg or Jason, do you remember why we did this? Repository: rLLDB LLDB https://reviews.llvm.org/D54460 Files: source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Index: source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp === --- source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -1091,11 +1091,8 @@ ABISP ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec ) { - static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::x86_64) { -if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_x86_64(process_sp)); -return g_abi_sp; +return ABISP(new ABISysV_x86_64(process_sp)); } return ABISP(); } Index: source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp === --- source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp +++ source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp @@ -202,11 +202,8 @@ ABISP ABISysV_s390x::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec ) { - static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::systemz) { -if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_s390x(process_sp)); -return g_abi_sp; +return ABISP(new ABISysV_s390x(process_sp)); } return ABISP(); } Index: source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp === --- source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp +++ source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp @@ -220,11 +220,8 @@ ABISP ABISysV_ppc::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec ) { - static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::ppc) { -if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_ppc(process_sp)); -return g_abi_sp; + return ABISP(new ABISysV_ppc(process_sp)); } return ABISP(); } Index: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp === --- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp +++ source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp @@ -556,13 +556,10 @@ ABISP ABISysV_mips64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec ) { - static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); if ((arch_type == llvm::Triple::mips64) || (arch_type == llvm::Triple::mips64el)) { -if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_mips64(process_sp)); -return g_abi_sp; +return ABISP(new ABISysV_mips64(process_sp)); } return ABISP(); } Index: source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp === --- source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp +++ source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp @@ -556,13 +556,10 @@ ABISP ABISysV_mips::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec ) { - static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); if ((arch_type == llvm::Triple::mips) || (arch_type ==
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
jingham added a comment. A dotest test can be xfailed if the debug format is not PDB, right? At least we can xfail them for all the DWARF variants so it should be possible to do that for PDB as well. So you should be able to write a test for this and then just xfail it till the DWARF parser can be fixed. About the parsing rules... The name of the children of arrays or array like entities is, for example, "[0]". So the virtue of the current approach is that we grab a "legal" identifier, and then the next bit we grab will be the name of the child or synthetic child - if there are any. But we don't actually have to know what the name of the child is, it can be anything so long as it doesn't start with a legal identifier first character. Your suggest approach will bless useable aggregate child names. That's probably okay. These child names should look like the way you would access the element in the languages we support - and this code is really C-ish right now, so just allowing the C/C++ style element accessors isn't a huge restriction. BTW, I was just using "frame variable" as a example, target variable also supports []: (lldb) source list -l 1 1 int g_vec[3] = {10, 20, 30}; 2 3 int main() { 4return g_vec[0] + g_vec[1]; 5 } (lldb) target var g_vec[0] (int) g_vec[0] = 10 https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
zturner added a comment. BTW, I will have to see if it's possible to write a test for this. Even when I compiled and built a program with DWARF on Linux, the `target variable Pi` example didn't "just work" for me, because `FindGlobalVariables` wasn't returning the variable. So I think this part actually needs to be fixed in the DWARF plugin, which I'm not equipped to fix. I can try something that is not a variable template, such as the `Foo::StaticMember` example, but if that also doesn't work, then there might not be a good way to write a general purpose test for this until this is fixed in the DWARF plugin. I can definitely add a test in the native pdb plugin though, and technically that runs everywhere (although it would only test `target variable` and not `frame variable`, maybe that's ok though?). https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
zturner added a comment. In https://reviews.llvm.org/D54454#1296377, @jingham wrote: > Those seem legit things to try to capture, though a little esoteric. Since > "frame variable" and "target variable" didn't support these constructs before > you should certainly add some tests for that. > > The frame variable parser also supports: > > (lldb) frame variable foo[0] > > where foo is anything that can produce "vector" like children (e.g. > std::vector's). Will your change work with that? Might need to modify the regex to stop at `[`, but then it should. Might as well make `target variable` work with that syntax too, or at least there's no reason to add special code to `frame variable` that's not in `target variable`. I think the regex should just also stop at an open brace, that way everything should "just work". So perhaps Greg's suggestion of not using a regex at all, but just `find_first_of(".-[")` is sufficient. (There are still some even more obscure cases where `[` can appear in a template argument, but it's so obscure that I think it's better to optimize for the common case). https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
jingham added a comment. We do also handle [], though it isn't obvious to me after a quick glance where that gets done. This is a little cheesy because the name of the child that we are finding with [0] is actually "[0]", so you just have to be careful not to consume that when you consume the variable name. I don't remember any other special aggregate names like this. https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
clayborg added a comment. Since we only handle . and -> this general idea seems ok to me. Do we even need a regex then? Maybe just search for first of ".-"? https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
jingham added a comment. Those seem legit things to try to capture, though a little esoteric. Since "frame variable" and "target variable" didn't support these constructs before you should certainly add some tests for that. The frame variable parser also supports: (lldb) frame variable foo[0] where foo is anything that can produce "vector" like children (e.g. std::vector's). Will your change work with that? https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter
shafik added a comment. @zturner I would not be against discussing using pass by value for small objects going forward. I don't currently have a good feeling for at what sizes/data types the right trade-off is at though. Repository: rL LLVM https://reviews.llvm.org/D54003 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
zturner added a comment. In https://reviews.llvm.org/D54454#1296358, @jingham wrote: > You were probably speaking loosely, but to be clear, the code you are > changing doesn't get used for expressions - i.e. the expression command - > unless I'm missing something. > > This little mini-parser is for doing things like: > > (lldb) frame variable foo.bar > > We don't use clang or the expression parser to comprehend foo.bar, we use > GetValuesForVariableExpressionPath instead. But 'frame variable' 'target > variable' etc. which use this are fairly limited in what they need to > support. They just needs to handle variable references - either local > variables or static variables, and references to children of those variables. > No calls, no casts, no types, etc. > > So I don't see that the ability to handle template definition markers like > is important. I don't see how that would show up in a variable name or > the name of one of its children. C++14 variable templates. template T SomeVariable; void foo() { SomeVariable IntVariable = x; } Now in this case you can simply say `frame variable IntVariable`, and it will work fine. But what about this? template constexpr T Pi = 3.1415; In this case you might say `target variable Pi` and this will currently fail. A slightly less contrived example: template struct Foo { static T SomeGlobal; }; int Foo::SomeGlobal = 42; long double Foo::SomeGlobal = 42.0; Now you might write `target variable "Foo::SomeGlobal"` For a totally real world example, this came up for me when I tried to write `target variable std::numeric_limits::is_signed`. If `namespace::non_template_class::some_constant` works, then there's no reason this shouldn't also work. https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
jingham added a comment. You were probably speaking loosely, but to be clear, the code you are changing doesn't get used for expressions - i.e. the expression command - unless I'm missing something. This little mini-parser is for doing things like: (lldb) frame variable foo.bar We don't use clang or the expression parser to comprehend foo.bar, we use GetValuesForVariableExpressionPath instead. But 'frame variable' 'target variable' etc. which use this are fairly limited in what they need to support. They just needs to handle variable references - either local variables or static variables, and references to children of those variables. No calls, no casts, no types, etc. So I don't see that the ability to handle template definition markers like is important. I don't see how that would show up in a variable name or the name of one of its children. https://reviews.llvm.org/D54454 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54454: Be more permissive in what we consider a variable name.
zturner created this revision. zturner added reviewers: clayborg, jingham, labath. Herald added subscribers: JDevlieghere, aprantl. When we evaluate a variable name as part of an expression, we run a regex against it so break it apart. The intent seems to be that we want to get the main variable name (i.e. the part of the user input which is both necessary and sufficient to find the record in debug info), but leave the rest of the expression alone (for example the variable could be an instance of a class, and you have written `variable.member`. But I believe the current regex to be too restrictive. For example, it disallows variable templates, so for example if the user writes `variable` we would strip off the ``, but this is absolutely necessary to find the proper record in the debug info. It also doesn't allow things like ` 'anonymous namespace'::variable` which under the Microsoft ABI is a valid thing. Nor does it permit spaces, so we couldn't have something like `foo` (assuming we first fixed the template issue). Rather than try to accurately construct a regex for the set of all possible things that constitute a variable name, it seems easier to construct a regex to match all the things that **do not** constitute a variable name. Specifically, an occurrence of the . operator or -> operator, since that's what ultimately defines the beginning of a sub-expression. So this changes the regex accordingly. https://reviews.llvm.org/D54454 Files: lldb/source/Symbol/Variable.cpp Index: lldb/source/Symbol/Variable.cpp === --- lldb/source/Symbol/Variable.cpp +++ lldb/source/Symbol/Variable.cpp @@ -383,8 +383,12 @@ } break; default: { -static RegularExpression g_regex( -llvm::StringRef("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)")); +// A variable name can be something like foo, foo::bar, foo::bar, +// ::foo, foo::bar, and more. Rather than trying to construct +// a perfect regex, which is almost certainly going to lead to some edge +// cases that we don't handle, let's just take everything until the first +// . operator or -> operator. +static RegularExpression g_regex("^([^.-]*)(.*)"); RegularExpression::Match regex_match(1); std::string variable_name; variable_list.Clear(); Index: lldb/source/Symbol/Variable.cpp === --- lldb/source/Symbol/Variable.cpp +++ lldb/source/Symbol/Variable.cpp @@ -383,8 +383,12 @@ } break; default: { -static RegularExpression g_regex( -llvm::StringRef("^([A-Za-z_:][A-Za-z_0-9:]*)(.*)")); +// A variable name can be something like foo, foo::bar, foo::bar, +// ::foo, foo::bar, and more. Rather than trying to construct +// a perfect regex, which is almost certainly going to lead to some edge +// cases that we don't handle, let's just take everything until the first +// . operator or -> operator. +static RegularExpression g_regex("^([^.-]*)(.*)"); RegularExpression::Match regex_match(1); std::string variable_name; variable_list.Clear(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54452: [NativePDB] Add support for handling S_CONSTANT records
lemo accepted this revision. lemo added inline comments. This revision is now accepted and ready to land. Comment at: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:329 +std::pair GetIntegralTypeInfo(TypeIndex ti, TpiStream ) { + if (ti.isSimple()) { Just a suggestion: I'm not a big fan of returning std::pair<>. I'd use a simple struct instead. https://reviews.llvm.org/D54452 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54452: [NativePDB] Add support for handling S_CONSTANT records
zturner created this revision. zturner added reviewers: aleksandr.urakov, lemo. clang-cl does not emit these, but MSVC does, so we need to be able to handle them. Because clang-cl does not generate them, it was a bit hard to write a test. So what I had to do was get an PDB file with some `S_CONSTANT` records in using cl and link, dump it using `llvm-pdbutil dump -globals -sym-data` to get the bytes of the records, generate the same object file using `clang-cl` but with `-S` to emit an assembly file, and replace all the `S_LDATA32` records with the bytes of the `S_CONSTANT` records. This way, we can compile the file using `llvm-mc` and link it with `lld-link`. https://reviews.llvm.org/D54452 Files: lldb/lit/SymbolFile/NativePDB/Inputs/s_constant.lldbinit lldb/lit/SymbolFile/NativePDB/Inputs/s_constant.s lldb/lit/SymbolFile/NativePDB/nested-types.cpp lldb/lit/SymbolFile/NativePDB/s_constant.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h === --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -201,6 +201,8 @@ lldb::TypeSP CreateType(PdbSymUid type_uid); lldb::TypeSP CreateAndCacheType(PdbSymUid type_uid); lldb::VariableSP CreateGlobalVariable(PdbSymUid var_uid); + lldb::VariableSP CreateConstantSymbol(PdbSymUid var_uid, +const llvm::codeview::CVSymbol ); llvm::BumpPtrAllocator m_allocator; Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp === --- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -253,6 +253,29 @@ } } +static bool IsSimpleTypeSignedInteger(SimpleTypeKind kind) { + switch (kind) { + case SimpleTypeKind::Int128: + case SimpleTypeKind::Int64: + case SimpleTypeKind::Int64Quad: + case SimpleTypeKind::Int32: + case SimpleTypeKind::Int32Long: + case SimpleTypeKind::Int16: + case SimpleTypeKind::Int16Short: + case SimpleTypeKind::Float128: + case SimpleTypeKind::Float80: + case SimpleTypeKind::Float64: + case SimpleTypeKind::Float32: + case SimpleTypeKind::Float16: + case SimpleTypeKind::NarrowCharacter: + case SimpleTypeKind::SignedCharacter: + case SimpleTypeKind::SByte: +return true; + default: +return false; + } +} + static size_t GetTypeSizeForSimpleKind(SimpleTypeKind kind) { switch (kind) { case SimpleTypeKind::Boolean128: @@ -303,6 +326,35 @@ } } +std::pair GetIntegralTypeInfo(TypeIndex ti, TpiStream ) { + if (ti.isSimple()) { +SimpleTypeKind stk = ti.getSimpleKind(); +return {GetTypeSizeForSimpleKind(stk), IsSimpleTypeSignedInteger(stk)}; + } + + CVType cvt = tpi.getType(ti); + switch (cvt.kind()) { + case LF_MODIFIER: { +ModifierRecord mfr; +llvm::cantFail(TypeDeserializer::deserializeAs(cvt, mfr)); +return GetIntegralTypeInfo(mfr.ModifiedType, tpi); + } + case LF_POINTER: { +PointerRecord pr; +llvm::cantFail(TypeDeserializer::deserializeAs(cvt, pr)); +return GetIntegralTypeInfo(pr.ReferentType, tpi); + } + case LF_ENUM: { +EnumRecord er; +llvm::cantFail(TypeDeserializer::deserializeAs(cvt, er)); +return GetIntegralTypeInfo(er.UnderlyingType, tpi); + } + default: +assert(false && "Type is not integral!"); +return {0, false}; + } +} + static llvm::StringRef GetSimpleTypeName(SimpleTypeKind kind) { switch (kind) { case SimpleTypeKind::Boolean128: @@ -557,10 +609,15 @@ if (Record.Type.isSimple()) return llvm::None; + CVType cvt = tpi.getType(Record.Type); + + if (!IsTagRecord(cvt)) +return llvm::None; + // If it's an inner definition, then treat whatever name we have here as a // single component of a mangled name. So we can inject it into the parent's // mangled name to see if it matches. - CVTagRecord child = CVTagRecord::create(tpi.getType(Record.Type)); + CVTagRecord child = CVTagRecord::create(cvt); std::string qname = parent.asTag().getUniqueName(); if (qname.size() < 4 || child.asTag().getUniqueName().size() < 4) return llvm::None; @@ -971,23 +1028,25 @@ lldb::TypeSP SymbolFileNativePDB::CreateTagType(PdbSymUid type_uid, const EnumRecord ) { - llvm::StringRef name = DropNameScope(er.getName()); - - clang::DeclContext *decl_context = m_clang->GetTranslationUnitDecl(); + const PdbTypeSymId = type_uid.asTypeSym(); + TypeIndex ti(tid.index); + clang::DeclContext *decl_context = nullptr; + std::string uname; + std::tie(decl_context, uname) = CreateDeclInfoForType(er, ti); Declaration decl; TypeSP underlying_type =
[Lldb-commits] [PATCH] D54443: [CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
beanz added inline comments. Comment at: cmake/modules/AddLLVM.cmake:795 - llvm_codesign(${name}) + llvm_codesign(TARGET ${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} FORCE) endmacro(add_llvm_executable name) sgraenitz wrote: > Would we want to pass `FORCE` to `add_llvm_executable` conditionally? I'm trying to think about the situations in which we need the `FORCE` option. Since this is connecting as a post-build event it shouldn't be running unless the target re-generates the output, so I'm not sure I understand why we ever need it. I did the git blame walk back to when the code was initially added in `49dd98a03a`, and there is no explanation. I suspect debugserver doesn't actually need the `--force` option because the author of the initial patch probably hit errors when re-signing the pre-built binary in his build directory. Thoughts? Repository: rL LLVM https://reviews.llvm.org/D54443 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44081: [lldb] Add synthetic frontend for _NSCallStackArray
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB346708: [lldb] Add synthetic frontend for _NSCallStackArray (authored by kuba.brecka, committed by ). Changed prior to commit: https://reviews.llvm.org/D44081?vs=173695=173749#toc Repository: rLLDB LLDB https://reviews.llvm.org/D44081 Files: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py source/Plugins/Language/ObjC/NSArray.cpp source/Plugins/Language/ObjC/ObjCLanguage.cpp Index: source/Plugins/Language/ObjC/ObjCLanguage.cpp === --- source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -409,6 +409,9 @@ "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags); AddCXXSummary( objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, + "NSArray summary provider", ConstString("_NSCallStackArray"), appkit_flags); + AddCXXSummary( + objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags); AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, @@ -528,6 +531,10 @@ ScriptedSyntheticChildren::Flags()); AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, + "NSArray synthetic children", ConstString("_NSCallStackArray"), + ScriptedSyntheticChildren::Flags()); + AddCXXSynthetic(objc_category_sp, + lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags()); Index: source/Plugins/Language/ObjC/NSArray.cpp === --- source/Plugins/Language/ObjC/NSArray.cpp +++ source/Plugins/Language/ObjC/NSArray.cpp @@ -214,6 +214,25 @@ } +namespace CallStackArray { +struct DataDescriptor_32 { + uint32_t _data; + uint32_t _used; + uint32_t _offset; + const uint32_t _size = 0; +}; + +struct DataDescriptor_64 { + uint64_t _data; + uint64_t _used; + uint64_t _offset; + const uint64_t _size = 0; +}; + +using NSCallStackArraySyntheticFrontEnd = +GenericNSArrayMSyntheticFrontEnd; +} // namespace CallStackArray + template class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: @@ -364,6 +383,7 @@ static const ConstString g_NSArrayCF("__NSCFArray"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable"); + static const ConstString g_NSCallStackArray("_NSCallStackArray"); if (class_name.IsEmpty()) return false; @@ -413,7 +433,9 @@ value = 0; } else if (class_name == g_NSArray1) { value = 1; - } else if (class_name == g_NSArrayCF) { + } else if (class_name == g_NSArrayCF || class_name == g_NSCallStackArray) { +// __NSCFArray and _NSCallStackArray store the number of elements as a +// pointer-sized value at offset `2 * ptr_size`. Status error; value = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + 2 * ptr_size, ptr_size, 0, error); @@ -813,6 +835,7 @@ static const ConstString g_NSArray1("__NSSingleObjectArrayI"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable"); + static const ConstString g_NSCallStackArray("_NSCallStackArray"); if (class_name.IsEmpty()) return nullptr; @@ -842,6 +865,8 @@ return (new Foundation1010::NSArrayMSyntheticFrontEnd(valobj_sp)); else return (new Foundation109::NSArrayMSyntheticFrontEnd(valobj_sp)); + } else if (class_name == g_NSCallStackArray) { +return (new CallStackArray::NSCallStackArraySyntheticFrontEnd(valobj_sp)); } else { auto (NSArray_Additionals::GetAdditionalSynthetics()); auto iter = map.find(class_name), end = map.end(); Index: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py === --- packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py +++ packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py @@ -28,7 +28,8 @@ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', 'stop reason = breakpoint']) -thread = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread() +target = self.dbg.GetSelectedTarget() +thread = target.GetProcess().GetSelectedThread() frame = thread.GetSelectedFrame() self.expect( @@ -87,4 +88,13 @@ self.assertEqual(userInfo.summary, "1 key/value pair")
[Lldb-commits] [lldb] r346708 - [lldb] Add synthetic frontend for _NSCallStackArray
Author: kuba.brecka Date: Mon Nov 12 13:26:03 2018 New Revision: 346708 URL: http://llvm.org/viewvc/llvm-project?rev=346708=rev Log: [lldb] Add synthetic frontend for _NSCallStackArray An Obj-C array type _NSCallStackArray is used in NSException backtraces. This patch adds a synthetic frontend for _NSCallStackArray, which now correctly returns frame PCs. Differential Revision: https://reviews.llvm.org/D44081 Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=346708=346707=346708=diff == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py Mon Nov 12 13:26:03 2018 @@ -28,7 +28,8 @@ class ObjCExceptionsTestCase(TestBase): self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', 'stop reason = breakpoint']) -thread = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread() +target = self.dbg.GetSelectedTarget() +thread = target.GetProcess().GetSelectedThread() frame = thread.GetSelectedFrame() self.expect( @@ -87,4 +88,13 @@ class ObjCExceptionsTestCase(TestBase): self.assertEqual(userInfo.summary, "1 key/value pair") self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(0).description, "some_key") self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(1).description, "some_value") - self.assertGreater(e2.GetChildMemberWithName("reserved").dynamic.num_children, 0) +reserved = e2.GetChildMemberWithName("reserved").dynamic +self.assertGreater(reserved.num_children, 0) +callStackReturnAddresses = [reserved.GetChildAtIndex(i).GetChildAtIndex(1) for i in range(0, reserved.GetNumChildren()) +if reserved.GetChildAtIndex(i).GetChildAtIndex(0).description == "callStackReturnAddresses"][0].dynamic +children = [callStackReturnAddresses.GetChildAtIndex(i) for i in range(0, callStackReturnAddresses.num_children)] + +pcs = [i.unsigned for i in children] +names = [target.ResolveSymbolContextForAddress(lldb.SBAddress(pc, target), lldb.eSymbolContextSymbol).GetSymbol().name for pc in pcs] +for n in ["objc_exception_throw", "foo", "main"]: +self.assertTrue(n in names, "%s is in the exception backtrace (%s)" % (n, names)) Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=346708=346707=346708=diff == --- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original) +++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Mon Nov 12 13:26:03 2018 @@ -214,6 +214,25 @@ namespace Foundation1437 { } +namespace CallStackArray { +struct DataDescriptor_32 { + uint32_t _data; + uint32_t _used; + uint32_t _offset; + const uint32_t _size = 0; +}; + +struct DataDescriptor_64 { + uint64_t _data; + uint64_t _used; + uint64_t _offset; + const uint64_t _size = 0; +}; + +using NSCallStackArraySyntheticFrontEnd = +GenericNSArrayMSyntheticFrontEnd; +} // namespace CallStackArray + template class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: @@ -364,6 +383,7 @@ bool lldb_private::formatters::NSArraySu static const ConstString g_NSArrayCF("__NSCFArray"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable"); + static const ConstString g_NSCallStackArray("_NSCallStackArray"); if (class_name.IsEmpty()) return false; @@ -413,7 +433,9 @@ bool lldb_private::formatters::NSArraySu value = 0; } else if (class_name == g_NSArray1) { value = 1; - } else if (class_name == g_NSArrayCF) { + } else if (class_name == g_NSArrayCF || class_name == g_NSCallStackArray) { +// __NSCFArray and _NSCallStackArray store the number of elements as a +// pointer-sized value at offset `2 * ptr_size`. Status error; value = process_sp->ReadUnsignedIntegerFromMemory( valobj_addr + 2 * ptr_size, ptr_size, 0, error); @@ -813,6 +835,7 @@ lldb_private::formatters::NSArraySynthet static const ConstString g_NSArray1("__NSSingleObjectArrayI"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString
[Lldb-commits] [lldb] r346707 - Re-land "Extract construction of DataBufferLLVM into FileSystem"
Author: jdevlieghere Date: Mon Nov 12 13:24:50 2018 New Revision: 346707 URL: http://llvm.org/viewvc/llvm-project?rev=346707=rev Log: Re-land "Extract construction of DataBufferLLVM into FileSystem" This fixes some UB in isLocal detected by the sanitized bot. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/DataBufferLLVM.h lldb/trunk/source/API/SBSection.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Utility/DataBufferLLVM.cpp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346707=346706=346707=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 12 13:24:50 2018 @@ -11,6 +11,7 @@ #define liblldb_Host_FileSystem_h #include "lldb/Host/File.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" @@ -94,6 +95,12 @@ public: bool IsDirectory(const llvm::Twine ) const; /// @} + /// Returns whether the given path is local to the file system. + /// @{ + bool IsLocal(const FileSpec _spec) const; + bool IsLocal(const llvm::Twine ) const; + /// @} + /// Make the given file path absolute. /// @{ std::error_code MakeAbsolute(llvm::SmallVectorImpl ) const; @@ -106,6 +113,16 @@ public: void Resolve(FileSpec _spec); /// @} + Create memory buffer from path. + /// @{ + std::shared_ptr CreateDataBuffer(const llvm::Twine , + uint64_t size = 0, + uint64_t offset = 0); + std::shared_ptr CreateDataBuffer(const FileSpec _spec, + uint64_t size = 0, + uint64_t offset = 0); + /// @} + /// Call into the Host to see if it can help find the file. bool ResolveExecutableLocation(FileSpec _spec); Modified: lldb/trunk/include/lldb/Utility/DataBufferLLVM.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataBufferLLVM.h?rev=346707=346706=346707=diff == --- lldb/trunk/include/lldb/Utility/DataBufferLLVM.h (original) +++ lldb/trunk/include/lldb/Utility/DataBufferLLVM.h Mon Nov 12 13:24:50 2018 @@ -23,16 +23,11 @@ class Twine; namespace lldb_private { +class FileSystem; class DataBufferLLVM : public DataBuffer { public: ~DataBufferLLVM(); - static std::shared_ptr - CreateSliceFromPath(const llvm::Twine , uint64_t Size, uint64_t Offset); - - static std::shared_ptr - CreateFromPath(const llvm::Twine ); - uint8_t *GetBytes() override; const uint8_t *GetBytes() const override; lldb::offset_t GetByteSize() const override; @@ -40,6 +35,7 @@ public: char *GetChars() { return reinterpret_cast(GetBytes()); } private: + friend FileSystem; /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid /// pointer. explicit DataBufferLLVM(std::unique_ptr Buffer); Modified: lldb/trunk/source/API/SBSection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=346707=346706=346707=diff == --- lldb/trunk/source/API/SBSection.cpp (original) +++ lldb/trunk/source/API/SBSection.cpp Mon Nov 12 13:24:50 2018 @@ -14,7 +14,6 @@ #include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/DataBuffer.h" -#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -166,7 +165,7 @@ SBData SBSection::GetSectionData(uint64_ else file_size = 0; } - auto data_buffer_sp = DataBufferLLVM::CreateSliceFromPath( + auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer( objfile->GetFileSpec().GetPath(),
[Lldb-commits] [PATCH] D43886: [lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_exception_throw for Obj-C runtimes
kubamracek updated this revision to Diff 173747. kubamracek retitled this revision from "[lldb] Add GetCurrentException and GetCurrentExceptionBacktrace APIs to SBThread" to "[lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_exception_throw for Obj-C runtimes". kubamracek edited the summary of this revision. kubamracek added a comment. Simplifying this a bit further, adding a test, and commenting out the backtrace API, which I'll add in a subsequent commit. https://reviews.llvm.org/D43886 Files: include/lldb/API/SBThread.h include/lldb/Target/StackFrameRecognizer.h include/lldb/Target/Thread.h packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py source/API/SBThread.cpp source/Commands/CommandObjectThread.cpp source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp source/Target/StackFrameRecognizer.cpp source/Target/Thread.cpp Index: source/Target/Thread.cpp === --- source/Target/Thread.cpp +++ source/Target/Thread.cpp @@ -25,6 +25,7 @@ #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StackFrameRecognizer.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/SystemRuntime.h" #include "lldb/Target/Target.h" @@ -2186,3 +2187,18 @@ } return error; } + +ValueObjectSP Thread::GetCurrentException() { + StackFrameSP frame_sp(GetStackFrameAtIndex(0)); + if (!frame_sp) return ValueObjectSP(); + + RecognizedStackFrameSP recognized_frame(frame_sp->GetRecognizedFrame()); + if (!recognized_frame) return ValueObjectSP(); + + return recognized_frame->GetExceptionObject(); +} + +/* TODO(kubamracek) +ThreadSP Thread::GetCurrentExceptionBacktrace() { + return ThreadSP(); +}*/ Index: source/Target/StackFrameRecognizer.cpp === --- source/Target/StackFrameRecognizer.cpp +++ source/Target/StackFrameRecognizer.cpp @@ -49,8 +49,9 @@ class StackFrameRecognizerManagerImpl { public: - void AddRecognizer(StackFrameRecognizerSP recognizer, ConstString , - ConstString , bool first_instruction_only) { + void AddRecognizer(StackFrameRecognizerSP recognizer, + const ConstString , const ConstString , + bool first_instruction_only) { m_recognizers.push_front({(uint32_t)m_recognizers.size(), false, recognizer, false, module, RegularExpressionSP(), symbol, RegularExpressionSP(), first_instruction_only}); @@ -152,8 +153,8 @@ } void StackFrameRecognizerManager::AddRecognizer( -StackFrameRecognizerSP recognizer, ConstString , ConstString , -bool first_instruction_only) { +StackFrameRecognizerSP recognizer, const ConstString , +const ConstString , bool first_instruction_only) { GetStackFrameRecognizerManagerImpl().AddRecognizer(recognizer, module, symbol, first_instruction_only); } Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp === --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -25,6 +25,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" +#include "lldb/Core/ValueObjectConstResult.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/FunctionCaller.h" @@ -39,10 +40,12 @@ #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/VariableList.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Platform.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/StackFrameRecognizer.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/ConstString.h" @@ -373,6 +376,8 @@ } } +static void RegisterObjCExceptionRecognizer(); + AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process, const ModuleSP _module_sp) : AppleObjCRuntime(process), m_get_class_info_code(), @@ -393,6 +398,7 @@ static const ConstString g_gdb_object_getClass("gdb_object_getClass"); m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType( g_gdb_object_getClass, eSymbolTypeCode) != NULL); + RegisterObjCExceptionRecognizer(); } bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress( @@ -2592,3 +2598,57 @@ } else this->AppleObjCRuntime::GetValuesForGlobalCFBooleans(cf_true, cf_false); } + +#pragma mark Frame recognizers + +class
[Lldb-commits] [PATCH] D54443: [CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
sgraenitz added inline comments. Comment at: cmake/modules/AddLLVM.cmake:795 - llvm_codesign(${name}) + llvm_codesign(TARGET ${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} FORCE) endmacro(add_llvm_executable name) Would we want to pass `FORCE` to `add_llvm_executable` conditionally? Repository: rL LLVM https://reviews.llvm.org/D54443 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54444: [CMake] Use extended llvm_codesign to pass entitlements for lldb-server
sgraenitz added a comment. `debugserver` was not that simple. For now only `lldb-server` as an example. Comment at: cmake/modules/AddLLDB.cmake:109 list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS}) - add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS}) I am parsing `ENTITLEMENTS` above and passing it on here explicitly. Had expected it to be passed along with `ARG_UNPARSED_ARGUMENTS` otherwise, but for some reason that didn't work. Is that the expected behaviour? https://reviews.llvm.org/D5 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server
sgraenitz added a comment. Please find the alternative proposal in https://reviews.llvm.org/D54443 (llvm) and https://reviews.llvm.org/D5 (lldb). https://reviews.llvm.org/D54352 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54444: [CMake] Use extended llvm_codesign to pass entitlements for lldb-server
sgraenitz created this revision. sgraenitz added reviewers: beanz, bogner. Herald added a subscriber: mgorny. This is using the mechanism proposed in https://reviews.llvm.org/D54443 to pass the entitlements file for lldb-server to llvm_codesign. https://reviews.llvm.org/D5 Files: CMakeLists.txt cmake/modules/AddLLDB.cmake tools/lldb-server/CMakeLists.txt Index: tools/lldb-server/CMakeLists.txt === --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -42,6 +42,16 @@ list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF) endif() +unset(entitlements) +if(APPLE) + set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY}) + + if(LLDB_USE_ENTITLEMENTS AND NOT IOS) +# Same entitlements file as used for lldb-server +set(entitlements ${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist) + endif() +endif() + add_lldb_tool(lldb-server INCLUDE_IN_SUITE Acceptor.cpp lldb-gdbserver.cpp @@ -61,6 +71,9 @@ LINK_COMPONENTS Support + +ENTITLEMENTS + ${entitlements} ) target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS}) Index: cmake/modules/AddLLDB.cmake === --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -100,13 +100,13 @@ function(add_lldb_executable name) cmake_parse_arguments(ARG "INCLUDE_IN_SUITE;GENERATE_INSTALL" -"" +"ENTITLEMENTS" "LINK_LIBS;LINK_COMPONENTS" ${ARGN} ) list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS}) - add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS}) target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS}) set_target_properties(${name} PROPERTIES Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -7,6 +7,8 @@ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ) +option(LLDB_USE_ENTITLEMENTS "When codesigning use entitlements if available" ON) + include(LLDBStandalone) include(LLDBConfig) include(AddLLDB) Index: tools/lldb-server/CMakeLists.txt === --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -42,6 +42,16 @@ list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF) endif() +unset(entitlements) +if(APPLE) + set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY}) + + if(LLDB_USE_ENTITLEMENTS AND NOT IOS) +# Same entitlements file as used for lldb-server +set(entitlements ${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist) + endif() +endif() + add_lldb_tool(lldb-server INCLUDE_IN_SUITE Acceptor.cpp lldb-gdbserver.cpp @@ -61,6 +71,9 @@ LINK_COMPONENTS Support + +ENTITLEMENTS + ${entitlements} ) target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS}) Index: cmake/modules/AddLLDB.cmake === --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -100,13 +100,13 @@ function(add_lldb_executable name) cmake_parse_arguments(ARG "INCLUDE_IN_SUITE;GENERATE_INSTALL" -"" +"ENTITLEMENTS" "LINK_LIBS;LINK_COMPONENTS" ${ARGN} ) list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS}) - add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS}) target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS}) set_target_properties(${name} PROPERTIES Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -7,6 +7,8 @@ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ) +option(LLDB_USE_ENTITLEMENTS "When codesigning use entitlements if available" ON) + include(LLDBStandalone) include(LLDBConfig) include(AddLLDB) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54443: [CMake] Accept ENTITLEMENTS in add_llvm_executable and llvm_codesign
sgraenitz created this revision. sgraenitz added reviewers: beanz, bogner. Herald added a subscriber: mgorny. Allow code-signing with entitlements. FORCE may be used to avoid an error when replacing existing signatures. Repository: rL LLVM https://reviews.llvm.org/D54443 Files: cmake/modules/AddLLVM.cmake Index: cmake/modules/AddLLVM.cmake === --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -580,7 +580,7 @@ if(ARG_SHARED OR ARG_MODULE) llvm_externalize_debuginfo(${name}) -llvm_codesign(${name}) +llvm_codesign(TARGET ${name}) endif() endfunction() @@ -708,7 +708,12 @@ macro(add_llvm_executable name) - cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN}) + cmake_parse_arguments(ARG + "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" +"ENTITLEMENTS" +"DEPENDS" +${ARGN}) + llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} ) list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS}) @@ -787,7 +792,7 @@ target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB}) endif() - llvm_codesign(${name}) + llvm_codesign(TARGET ${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} FORCE) endmacro(add_llvm_executable name) function(export_executable_symbols target) @@ -1626,7 +1631,15 @@ endif() endfunction() -function(llvm_codesign name) +# Usage: llvm_codesign(TARGET name [ENTITLEMENTS file] [FORCE]) +# +# Code-sign the given TARGET with the global LLVM_CODESIGNING_IDENTITY or skip +# if undefined. Customize capabilities by passing a file path to ENTITLEMENTS. +# FORCE may be used to avoid an error when replacing existing signatures. +# +function(llvm_codesign) + cmake_parse_arguments(ARG "FORCE" "TARGET;ENTITLEMENTS" "" ${ARGN}) + if(NOT LLVM_CODESIGNING_IDENTITY) return() endif() @@ -1642,12 +1655,20 @@ OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE ) endif() +if(DEFINED ARG_FORCE) + set(PASS_FORCE --force) +endif() +if(DEFINED ARG_ENTITLEMENTS) + set(PASS_ENTITLEMENTS --entitlements ${ARG_ENTITLEMENTS}) +endif() + add_custom_command( - TARGET ${name} POST_BUILD + TARGET ${ARG_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE} ${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY} - $ + ${PASS_ENTITLEMENTS} ${PASS_FORCE} + $ ) endif() endfunction() Index: cmake/modules/AddLLVM.cmake === --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -580,7 +580,7 @@ if(ARG_SHARED OR ARG_MODULE) llvm_externalize_debuginfo(${name}) -llvm_codesign(${name}) +llvm_codesign(TARGET ${name}) endif() endfunction() @@ -708,7 +708,12 @@ macro(add_llvm_executable name) - cmake_parse_arguments(ARG "DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" "" "DEPENDS" ${ARGN}) + cmake_parse_arguments(ARG +"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH" +"ENTITLEMENTS" +"DEPENDS" +${ARGN}) + llvm_process_sources( ALL_FILES ${ARG_UNPARSED_ARGUMENTS} ) list(APPEND LLVM_COMMON_DEPENDS ${ARG_DEPENDS}) @@ -787,7 +792,7 @@ target_link_libraries(${name} PRIVATE ${LLVM_PTHREAD_LIB}) endif() - llvm_codesign(${name}) + llvm_codesign(TARGET ${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} FORCE) endmacro(add_llvm_executable name) function(export_executable_symbols target) @@ -1626,7 +1631,15 @@ endif() endfunction() -function(llvm_codesign name) +# Usage: llvm_codesign(TARGET name [ENTITLEMENTS file] [FORCE]) +# +# Code-sign the given TARGET with the global LLVM_CODESIGNING_IDENTITY or skip +# if undefined. Customize capabilities by passing a file path to ENTITLEMENTS. +# FORCE may be used to avoid an error when replacing existing signatures. +# +function(llvm_codesign) + cmake_parse_arguments(ARG "FORCE" "TARGET;ENTITLEMENTS" "" ${ARGN}) + if(NOT LLVM_CODESIGNING_IDENTITY) return() endif() @@ -1642,12 +1655,20 @@ OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE ) endif() +if(DEFINED ARG_FORCE) + set(PASS_FORCE --force) +endif() +if(DEFINED ARG_ENTITLEMENTS) + set(PASS_ENTITLEMENTS --entitlements ${ARG_ENTITLEMENTS}) +endif() + add_custom_command( - TARGET ${name} POST_BUILD + TARGET ${ARG_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} -E env CODESIGN_ALLOCATE=${CMAKE_CODESIGN_ALLOCATE} ${CMAKE_CODESIGN} -s ${LLVM_CODESIGNING_IDENTITY} - $ + ${PASS_ENTITLEMENTS} ${PASS_FORCE} + $ ) endif() endfunction() ___ lldb-commits mailing list
[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values
kubamracek marked an inline comment as done. kubamracek added a comment. Thanks for the review! https://reviews.llvm.org/D43884 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB346695: [lldb] Extract more fields from NSException values (authored by kuba.brecka, committed by ). Repository: rLLDB LLDB https://reviews.llvm.org/D43884 Files: packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py packages/Python/lldbsuite/test/lang/objc/exceptions/main.m source/Plugins/Language/ObjC/NSException.cpp Index: source/Plugins/Language/ObjC/NSException.cpp === --- source/Plugins/Language/ObjC/NSException.cpp +++ source/Plugins/Language/ObjC/NSException.cpp @@ -30,8 +30,8 @@ using namespace lldb_private::formatters; static bool ExtractFields(ValueObject , ValueObjectSP *name_sp, - ValueObjectSP *reason_sp, - ValueObjectSP *userinfo_sp) { + ValueObjectSP *reason_sp, ValueObjectSP *userinfo_sp, + ValueObjectSP *reserved_sp) { ProcessSP process_sp(valobj.GetProcessSP()); if (!process_sp) return false; @@ -61,10 +61,14 @@ auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size, error); if (error.Fail() || userinfo == LLDB_INVALID_ADDRESS) return false; + auto reserved = process_sp->ReadPointerFromMemory(ptr + 4 * ptr_size, error); + if (error.Fail() || reserved == LLDB_INVALID_ADDRESS) +return false; InferiorSizedWord name_isw(name, *process_sp); InferiorSizedWord reason_isw(reason, *process_sp); InferiorSizedWord userinfo_isw(userinfo, *process_sp); + InferiorSizedWord reserved_isw(reserved, *process_sp); CompilerType voidstar = process_sp->GetTarget() .GetScratchClangASTContext() @@ -83,15 +87,19 @@ *userinfo_sp = ValueObject::CreateValueObjectFromData( "userInfo", userinfo_isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), voidstar); + if (reserved_sp) +*reserved_sp = ValueObject::CreateValueObjectFromData( +"reserved", reserved_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); return true; } bool lldb_private::formatters::NSException_SummaryProvider( ValueObject , Stream , const TypeSummaryOptions ) { lldb::ValueObjectSP name_sp; lldb::ValueObjectSP reason_sp; - if (!ExtractFields(valobj, _sp, _sp, nullptr)) + if (!ExtractFields(valobj, _sp, _sp, nullptr, nullptr)) return false; if (!name_sp || !reason_sp) @@ -117,35 +125,56 @@ ~NSExceptionSyntheticFrontEnd() override = default; size_t CalculateNumChildren() override { -return 1; +return 4; } lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { switch (idx) { - case 0: return m_userinfo_sp; + case 0: return m_name_sp; + case 1: return m_reason_sp; + case 2: return m_userinfo_sp; + case 3: return m_reserved_sp; } return lldb::ValueObjectSP(); } bool Update() override { +m_name_sp.reset(); +m_reason_sp.reset(); m_userinfo_sp.reset(); -if (!ExtractFields(m_backend, nullptr, nullptr, _userinfo_sp)) { +m_reserved_sp.reset(); + +if (!ExtractFields(m_backend, _name_sp, _reason_sp, _userinfo_sp, + _reserved_sp)) { return false; } return true; } bool MightHaveChildren() override { return true; } size_t GetIndexOfChildWithName(const ConstString ) override { +// NSException has 4 members: +// NSString *name; +// NSString *reason; +// NSDictionary *userInfo; +// id reserved; +static ConstString g___name("name"); +static ConstString g___reason("reason"); static ConstString g___userInfo("userInfo"); -if (name == g___userInfo) - return 0; +static ConstString g___reserved("reserved"); +if (name == g___name) return 0; +if (name == g___reason) return 1; +if (name == g___userInfo) return 2; +if (name == g___reserved) return 3; return UINT32_MAX; } private: + ValueObjectSP m_name_sp; + ValueObjectSP m_reason_sp; ValueObjectSP m_userinfo_sp; + ValueObjectSP m_reserved_sp; }; SyntheticChildrenFrontEnd * Index: packages/Python/lldbsuite/test/lang/objc/exceptions/main.m === --- packages/Python/lldbsuite/test/lang/objc/exceptions/main.m +++ packages/Python/lldbsuite/test/lang/objc/exceptions/main.m @@ -0,0 +1,36 @@ +//===-- main.m *- ObjC -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#import + +void foo() +{ +
[Lldb-commits] [lldb] r346695 - [lldb] Extract more fields from NSException values
Author: kuba.brecka Date: Mon Nov 12 11:12:31 2018 New Revision: 346695 URL: http://llvm.org/viewvc/llvm-project?rev=346695=rev Log: [lldb] Extract more fields from NSException values This patch teaches LLDB about more fields on NSException Obj-C objects, specifically we can now retrieve the "name" and "reason" of an NSException. The goal is to eventually be able to have SB API that can provide details about the currently thrown/caught/processed exception. Differential Revision: https://reviews.llvm.org/D43884 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/main.m Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile?rev=346695=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile Mon Nov 12 11:12:31 2018 @@ -0,0 +1,9 @@ +LEVEL = ../../../make + +OBJC_SOURCES := main.m + +CFLAGS_EXTRAS += -w + +include $(LEVEL)/Makefile.rules + +LDFLAGS += -framework Foundation Added: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=346695=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py Mon Nov 12 11:12:31 2018 @@ -0,0 +1,90 @@ +# encoding: utf-8 +""" +Test lldb Obj-C exception support. +""" + +from __future__ import print_function + + +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class ObjCExceptionsTestCase(TestBase): + +mydir = TestBase.compute_mydir(__file__) + +@skipUnlessDarwin +def test_objc_exceptions_1(self): +self.build() + +target = self.dbg.CreateTarget(self.getBuildArtifact("a.out")) +self.assertTrue(target, VALID_TARGET) + +lldbutil.run_to_source_breakpoint(self, "// Set break point at this line.", lldb.SBFileSpec("main.m")) + +self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, +substrs=['stopped', 'stop reason = breakpoint']) + +thread = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread() +frame = thread.GetSelectedFrame() + +self.expect( +'frame variable e1', +substrs=[ +'(NSException *) e1 = ', +'name: @"ExceptionName" - reason: @"SomeReason"' +]) + +self.expect( +'frame variable --dynamic-type no-run-target *e1', +substrs=[ +'(NSException) *e1 = ', +'name = ', '@"ExceptionName"', +'reason = ', '@"SomeReason"', +'userInfo = ', '1 key/value pair', +'reserved = ', 'nil', +]) + +e1 = frame.FindVariable("e1") +self.assertTrue(e1) +self.assertEqual(e1.type.name, "NSException *") +self.assertEqual(e1.GetSummary(), 'name: @"ExceptionName" - reason: @"SomeReason"') +self.assertEqual(e1.GetChildMemberWithName("name").description, "ExceptionName") +self.assertEqual(e1.GetChildMemberWithName("reason").description, "SomeReason") +userInfo = e1.GetChildMemberWithName("userInfo").dynamic +self.assertEqual(userInfo.summary, "1 key/value pair") + self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(0).description, "some_key") + self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(1).description, "some_value") +self.assertEqual(e1.GetChildMemberWithName("reserved").description, "") + +self.expect( +'frame variable e2', +substrs=[ +'(NSException *) e2 = ', +'name: @"ThrownException" - reason: @"SomeReason"' +]) + +self.expect( +'frame variable --dynamic-type no-run-target *e2', +substrs=[ +'(NSException) *e2 = ', +'name = ', '@"ThrownException"', +'reason = ', '@"SomeReason"', +'userInfo = ', '1 key/value pair', +'reserved = ', +]) + +e2 = frame.FindVariable("e2") +
[Lldb-commits] [lldb] r346694 - Revert "Extract construction of DataBufferLLVM into FileSystem"
Author: davide Date: Mon Nov 12 11:08:19 2018 New Revision: 346694 URL: http://llvm.org/viewvc/llvm-project?rev=346694=rev Log: Revert "Extract construction of DataBufferLLVM into FileSystem" It broke the lldb sanitizer bots. Modified: lldb/trunk/include/lldb/Host/FileSystem.h lldb/trunk/include/lldb/Utility/DataBufferLLVM.h lldb/trunk/source/API/SBSection.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Host/common/FileSystem.cpp lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/linux/Host.cpp lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/trunk/source/Symbol/ObjectFile.cpp lldb/trunk/source/Utility/DataBufferLLVM.cpp lldb/trunk/unittests/Process/minidump/MinidumpParserTest.cpp Modified: lldb/trunk/include/lldb/Host/FileSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346694=346693=346694=diff == --- lldb/trunk/include/lldb/Host/FileSystem.h (original) +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 12 11:08:19 2018 @@ -11,7 +11,6 @@ #define liblldb_Host_FileSystem_h #include "lldb/Host/File.h" -#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" @@ -95,12 +94,6 @@ public: bool IsDirectory(const llvm::Twine ) const; /// @} - /// Returns whether the given path is local to the file system. - /// @{ - bool IsLocal(const FileSpec _spec) const; - bool IsLocal(const llvm::Twine ) const; - /// @} - /// Make the given file path absolute. /// @{ std::error_code MakeAbsolute(llvm::SmallVectorImpl ) const; @@ -113,16 +106,6 @@ public: void Resolve(FileSpec _spec); /// @} - Create memory buffer from path. - /// @{ - std::shared_ptr CreateDataBuffer(const llvm::Twine , - uint64_t size = 0, - uint64_t offset = 0); - std::shared_ptr CreateDataBuffer(const FileSpec _spec, - uint64_t size = 0, - uint64_t offset = 0); - /// @} - /// Call into the Host to see if it can help find the file. bool ResolveExecutableLocation(FileSpec _spec); Modified: lldb/trunk/include/lldb/Utility/DataBufferLLVM.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/DataBufferLLVM.h?rev=346694=346693=346694=diff == --- lldb/trunk/include/lldb/Utility/DataBufferLLVM.h (original) +++ lldb/trunk/include/lldb/Utility/DataBufferLLVM.h Mon Nov 12 11:08:19 2018 @@ -23,11 +23,16 @@ class Twine; namespace lldb_private { -class FileSystem; class DataBufferLLVM : public DataBuffer { public: ~DataBufferLLVM(); + static std::shared_ptr + CreateSliceFromPath(const llvm::Twine , uint64_t Size, uint64_t Offset); + + static std::shared_ptr + CreateFromPath(const llvm::Twine ); + uint8_t *GetBytes() override; const uint8_t *GetBytes() const override; lldb::offset_t GetByteSize() const override; @@ -35,7 +40,6 @@ public: char *GetChars() { return reinterpret_cast(GetBytes()); } private: - friend FileSystem; /// Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a valid /// pointer. explicit DataBufferLLVM(std::unique_ptr Buffer); Modified: lldb/trunk/source/API/SBSection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSection.cpp?rev=346694=346693=346694=diff == --- lldb/trunk/source/API/SBSection.cpp (original) +++ lldb/trunk/source/API/SBSection.cpp Mon Nov 12 11:08:19 2018 @@ -14,6 +14,7 @@ #include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Utility/DataBuffer.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" @@ -165,7 +166,7 @@ SBData SBSection::GetSectionData(uint64_ else file_size = 0; } - auto data_buffer_sp = FileSystem::Instance().CreateDataBuffer( + auto data_buffer_sp = DataBufferLLVM::CreateSliceFromPath( objfile->GetFileSpec().GetPath(), file_size, file_offset);
[Lldb-commits] [PATCH] D54431: [lldb] Add "ninja" to svn:ignore
This revision was automatically updated to reflect the committed changes. Closed by commit rL346693: [lldb] Add ninja to svn:ignore (authored by kuba.brecka, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D54431?vs=173697=173720#toc Repository: rL LLVM https://reviews.llvm.org/D54431 Files: lldb/trunk ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346693 - [lldb] Add "ninja" to svn:ignore
Author: kuba.brecka Date: Mon Nov 12 11:06:15 2018 New Revision: 346693 URL: http://llvm.org/viewvc/llvm-project?rev=346693=rev Log: [lldb] Add "ninja" to svn:ignore Differential Revision: https://reviews.llvm.org/D54431 Modified: lldb/trunk/ (props changed) Propchange: lldb/trunk/ -- --- svn:ignore (original) +++ svn:ignore Mon Nov 12 11:06:15 2018 @@ -3,4 +3,5 @@ intermediates llvm llvm-build .vscode +ninja ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54432: [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB346692: [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and… (authored by kuba.brecka, committed by ). Changed prior to commit: https://reviews.llvm.org/D54432?vs=173698=173719#toc Repository: rLLDB LLDB https://reviews.llvm.org/D54432 Files: test ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346692 - [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files
Author: kuba.brecka Date: Mon Nov 12 11:05:16 2018 New Revision: 346692 URL: http://llvm.org/viewvc/llvm-project?rev=346692=rev Log: [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files Differential Revision: https://reviews.llvm.org/D54432 Modified: lldb/trunk/test/ (props changed) Propchange: lldb/trunk/test/ -- --- svn:ignore (original) +++ svn:ignore Mon Nov 12 11:05:16 2018 @@ -1 +1,2 @@ -20[1-9][0-9]-[01][0-9]-[0-3][0-9]_[0-2][0-9]_[0-5][0-9]_[0-6][0-9] +20[1-9][0-9]-[01][0-9]-[0-3][0-9]-[0-2][0-9]_[0-5][0-9]_[0-6][0-9] +lldb-test-build.noindex ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44081: [lldb] Add synthetic frontend for _NSCallStackArray
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. Thanks for addressing my comments. https://reviews.llvm.org/D44081 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54431: [lldb] Add "ninja" to svn:ignore
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. This is trivial. I don't know why we didn't do this before. https://reviews.llvm.org/D54431 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. LGTM. Thanks. https://reviews.llvm.org/D43884 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server
sgraenitz added a comment. Ok, I will have a look and prepare a draft. https://reviews.llvm.org/D54352 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346684 - Remove the last CURRENT_ARCH reference in Xcode's build scripts.
Author: friss Date: Mon Nov 12 09:59:30 2018 New Revision: 346684 URL: http://llvm.org/viewvc/llvm-project?rev=346684=rev Log: Remove the last CURRENT_ARCH reference in Xcode's build scripts. In the same spirit as r346443. Modified: lldb/trunk/scripts/Xcode/lldbbuild.py Modified: lldb/trunk/scripts/Xcode/lldbbuild.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Xcode/lldbbuild.py?rev=346684=346683=346684=diff == --- lldb/trunk/scripts/Xcode/lldbbuild.py (original) +++ lldb/trunk/scripts/Xcode/lldbbuild.py Mon Nov 12 09:59:30 2018 @@ -190,4 +190,4 @@ def package_build_path(): return os.path.join( llvm_build_dirtree(), os.environ["LLVM_CONFIGURATION"], -os.environ["CURRENT_ARCH"]) +"x86_64") ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server
beanz added a comment. I can certainly foresee other LLVM-based projects needing entitlements, so I am very much in favor of adding `ENTITLEMENTS` and `FORCE` options onto `llvm_codesign`. https://reviews.llvm.org/D54352 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D51578: Contiguous .debug_info+.debug_types for D32167
clayborg accepted this revision. clayborg added inline comments. This revision is now accepted and ready to land. Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h:65 typedef std::vector CompileUnitColl; + typedef llvm::DenseMap TypeSignatureMap; yeah, I kept getting people commenting on my patches that told me to use DenseMap and StringMap! Repository: rLLDB LLDB https://reviews.llvm.org/D51578 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54417: Fix a crash when parsing incorrect DWARF
JDevlieghere accepted this revision. JDevlieghere added a comment. This revision is now accepted and ready to land. Your explanation makes sense, good catch. Thanks for fixing this! https://reviews.llvm.org/D54417 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346679 - [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC.
Author: kuba.brecka Date: Mon Nov 12 09:25:23 2018 New Revision: 346679 URL: http://llvm.org/viewvc/llvm-project?rev=346679=rev Log: [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC. - Refactor reading of NSException fields into ExtractFields method to avoid code duplication. - Remove "m_child_ptr" field, as it's not used anywhere. - Clang-format. Differential Revision: https://reviews.llvm.org/D44073 Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp?rev=346679=346678=346679=diff == --- lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp (original) +++ lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Mon Nov 12 09:25:23 2018 @@ -29,52 +29,70 @@ using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; -bool lldb_private::formatters::NSException_SummaryProvider( -ValueObject , Stream , const TypeSummaryOptions ) { +static bool ExtractFields(ValueObject , ValueObjectSP *name_sp, + ValueObjectSP *reason_sp, + ValueObjectSP *userinfo_sp) { ProcessSP process_sp(valobj.GetProcessSP()); if (!process_sp) return false; - lldb::addr_t ptr_value = LLDB_INVALID_ADDRESS; + lldb::addr_t ptr = LLDB_INVALID_ADDRESS; CompilerType valobj_type(valobj.GetCompilerType()); Flags type_flags(valobj_type.GetTypeInfo()); if (type_flags.AllClear(eTypeHasValue)) { if (valobj.IsBaseClass() && valobj.GetParent()) - ptr_value = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); - } else -ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + ptr = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + } else { +ptr = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + } - if (ptr_value == LLDB_INVALID_ADDRESS) + if (ptr == LLDB_INVALID_ADDRESS) return false; size_t ptr_size = process_sp->GetAddressByteSize(); - lldb::addr_t name_location = ptr_value + 1 * ptr_size; - lldb::addr_t reason_location = ptr_value + 2 * ptr_size; Status error; - lldb::addr_t name = process_sp->ReadPointerFromMemory(name_location, error); + auto name = process_sp->ReadPointerFromMemory(ptr + 1 * ptr_size, error); if (error.Fail() || name == LLDB_INVALID_ADDRESS) return false; - - lldb::addr_t reason = - process_sp->ReadPointerFromMemory(reason_location, error); + auto reason = process_sp->ReadPointerFromMemory(ptr + 2 * ptr_size, error); if (error.Fail() || reason == LLDB_INVALID_ADDRESS) return false; + auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size, error); + if (error.Fail() || userinfo == LLDB_INVALID_ADDRESS) +return false; InferiorSizedWord name_isw(name, *process_sp); InferiorSizedWord reason_isw(reason, *process_sp); + InferiorSizedWord userinfo_isw(userinfo, *process_sp); CompilerType voidstar = process_sp->GetTarget() .GetScratchClangASTContext() ->GetBasicType(lldb::eBasicTypeVoid) .GetPointerType(); - ValueObjectSP name_sp = ValueObject::CreateValueObjectFromData( - "name_str", name_isw.GetAsData(process_sp->GetByteOrder()), - valobj.GetExecutionContextRef(), voidstar); - ValueObjectSP reason_sp = ValueObject::CreateValueObjectFromData( - "reason_str", reason_isw.GetAsData(process_sp->GetByteOrder()), - valobj.GetExecutionContextRef(), voidstar); + if (name_sp) +*name_sp = ValueObject::CreateValueObjectFromData( +"name", name_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + if (reason_sp) +*reason_sp = ValueObject::CreateValueObjectFromData( +"reason", reason_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + if (userinfo_sp) +*userinfo_sp = ValueObject::CreateValueObjectFromData( +"userInfo", userinfo_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + + return true; +} + +bool lldb_private::formatters::NSException_SummaryProvider( +ValueObject , Stream , const TypeSummaryOptions ) { + lldb::ValueObjectSP name_sp; + lldb::ValueObjectSP reason_sp; + if (!ExtractFields(valobj, _sp, _sp, nullptr)) +return false; if (!name_sp || !reason_sp) return false; @@ -97,63 +115,24 @@ public: : SyntheticChildrenFrontEnd(*valobj_sp) {} ~NSExceptionSyntheticFrontEnd() override = default; - // no need to delete m_child_ptr - it's kept alive by the cluster manager on - // our behalf size_t CalculateNumChildren() override { -if (m_child_ptr) - return 1; -if
[Lldb-commits] [PATCH] D44073: [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC.
This revision was automatically updated to reflect the committed changes. Closed by commit rLLDB346679: [lldb] Refactor ObjC/NSException.cpp (cleanup, avoid code duplication). NFC. (authored by kuba.brecka, committed by ). Herald added a subscriber: teemperor. Changed prior to commit: https://reviews.llvm.org/D44073?vs=136931=173699#toc Repository: rLLDB LLDB https://reviews.llvm.org/D44073 Files: source/Plugins/Language/ObjC/NSException.cpp Index: source/Plugins/Language/ObjC/NSException.cpp === --- source/Plugins/Language/ObjC/NSException.cpp +++ source/Plugins/Language/ObjC/NSException.cpp @@ -29,52 +29,70 @@ using namespace lldb_private; using namespace lldb_private::formatters; -bool lldb_private::formatters::NSException_SummaryProvider( -ValueObject , Stream , const TypeSummaryOptions ) { +static bool ExtractFields(ValueObject , ValueObjectSP *name_sp, + ValueObjectSP *reason_sp, + ValueObjectSP *userinfo_sp) { ProcessSP process_sp(valobj.GetProcessSP()); if (!process_sp) return false; - lldb::addr_t ptr_value = LLDB_INVALID_ADDRESS; + lldb::addr_t ptr = LLDB_INVALID_ADDRESS; CompilerType valobj_type(valobj.GetCompilerType()); Flags type_flags(valobj_type.GetTypeInfo()); if (type_flags.AllClear(eTypeHasValue)) { if (valobj.IsBaseClass() && valobj.GetParent()) - ptr_value = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); - } else -ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + ptr = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + } else { +ptr = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + } - if (ptr_value == LLDB_INVALID_ADDRESS) + if (ptr == LLDB_INVALID_ADDRESS) return false; size_t ptr_size = process_sp->GetAddressByteSize(); - lldb::addr_t name_location = ptr_value + 1 * ptr_size; - lldb::addr_t reason_location = ptr_value + 2 * ptr_size; Status error; - lldb::addr_t name = process_sp->ReadPointerFromMemory(name_location, error); + auto name = process_sp->ReadPointerFromMemory(ptr + 1 * ptr_size, error); if (error.Fail() || name == LLDB_INVALID_ADDRESS) return false; - - lldb::addr_t reason = - process_sp->ReadPointerFromMemory(reason_location, error); + auto reason = process_sp->ReadPointerFromMemory(ptr + 2 * ptr_size, error); if (error.Fail() || reason == LLDB_INVALID_ADDRESS) return false; + auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size, error); + if (error.Fail() || userinfo == LLDB_INVALID_ADDRESS) +return false; InferiorSizedWord name_isw(name, *process_sp); InferiorSizedWord reason_isw(reason, *process_sp); + InferiorSizedWord userinfo_isw(userinfo, *process_sp); CompilerType voidstar = process_sp->GetTarget() .GetScratchClangASTContext() ->GetBasicType(lldb::eBasicTypeVoid) .GetPointerType(); - ValueObjectSP name_sp = ValueObject::CreateValueObjectFromData( - "name_str", name_isw.GetAsData(process_sp->GetByteOrder()), - valobj.GetExecutionContextRef(), voidstar); - ValueObjectSP reason_sp = ValueObject::CreateValueObjectFromData( - "reason_str", reason_isw.GetAsData(process_sp->GetByteOrder()), - valobj.GetExecutionContextRef(), voidstar); + if (name_sp) +*name_sp = ValueObject::CreateValueObjectFromData( +"name", name_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + if (reason_sp) +*reason_sp = ValueObject::CreateValueObjectFromData( +"reason", reason_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + if (userinfo_sp) +*userinfo_sp = ValueObject::CreateValueObjectFromData( +"userInfo", userinfo_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); + + return true; +} + +bool lldb_private::formatters::NSException_SummaryProvider( +ValueObject , Stream , const TypeSummaryOptions ) { + lldb::ValueObjectSP name_sp; + lldb::ValueObjectSP reason_sp; + if (!ExtractFields(valobj, _sp, _sp, nullptr)) +return false; if (!name_sp || !reason_sp) return false; @@ -97,63 +115,24 @@ : SyntheticChildrenFrontEnd(*valobj_sp) {} ~NSExceptionSyntheticFrontEnd() override = default; - // no need to delete m_child_ptr - it's kept alive by the cluster manager on - // our behalf size_t CalculateNumChildren() override { -if (m_child_ptr) - return 1; -if (m_child_sp) - return 1; -return 0; +return 1; } lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { -if (idx != 0) - return lldb::ValueObjectSP(); - -if (m_child_ptr) - return m_child_ptr->GetSP(); -return m_child_sp; +switch (idx) { + case
[Lldb-commits] [PATCH] D54432: [lldb] Fix the typo (replace underscore with dash) in svn:ignore on test/ and add "lldb-test-build.noindex" to ignored files
kubamracek created this revision. kubamracek added reviewers: davide, aprantl. Herald added a subscriber: arphaman. https://reviews.llvm.org/D54432 Files: . ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54431: [lldb] Add "ninja" to svn:ignore
kubamracek created this revision. kubamracek added reviewers: davide, aprantl. https://reviews.llvm.org/D54431 Files: . ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44081: [lldb] Add synthetic frontend for _NSCallStackArray
kubamracek marked an inline comment as done. kubamracek added inline comments. Comment at: source/Plugins/Language/ObjC/NSArray.cpp:446-451 + } else if (class_name == g_NSCallStackArray) { +Status error; +value = process_sp->ReadUnsignedIntegerFromMemory( +valobj_addr + 2 * ptr_size, ptr_size, 0, error); +if (error.Fail()) + return false; davide wrote: > Can you add a comment here? > this also seems exactly the same as `NSArrayCF`, any chance we can avoid the > duplication? Added comment and de-duplicated the branch. https://reviews.llvm.org/D44081 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44081: [lldb] Add synthetic frontend for _NSCallStackArray
kubamracek updated this revision to Diff 173695. https://reviews.llvm.org/D44081 Files: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py source/Plugins/Language/ObjC/NSArray.cpp source/Plugins/Language/ObjC/ObjCLanguage.cpp Index: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py === --- packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py +++ packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py @@ -28,7 +28,8 @@ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, substrs=['stopped', 'stop reason = breakpoint']) -thread = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread() +target = self.dbg.GetSelectedTarget() +thread = target.GetProcess().GetSelectedThread() frame = thread.GetSelectedFrame() self.expect( @@ -87,4 +88,14 @@ self.assertEqual(userInfo.summary, "1 key/value pair") self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(0).description, "some_key") self.assertEqual(userInfo.GetChildAtIndex(0).GetChildAtIndex(1).description, "some_value") -self.assertGreater(e2.GetChildMemberWithName("reserved").dynamic.num_children, 0) +reserved = e2.GetChildMemberWithName("reserved").dynamic +self.assertGreater(reserved.num_children, 0) +callStackReturnAddresses = [reserved.GetChildAtIndex(i).GetChildAtIndex(1) for i in range(0, reserved.GetNumChildren()) +if reserved.GetChildAtIndex(i).GetChildAtIndex(0).description == "callStackReturnAddresses"][0].dynamic +self.assertEqual(callStackReturnAddresses.summary, '@"5 elements"') +children = [callStackReturnAddresses.GetChildAtIndex(i) for i in range(0, callStackReturnAddresses.num_children)] + +pcs = [i.unsigned for i in children] +names = [target.ResolveSymbolContextForAddress(lldb.SBAddress(pc, target), lldb.eSymbolContextSymbol).GetSymbol().name for pc in pcs] +for n in ["objc_exception_throw", "foo", "main"]: +self.assertTrue(n in names, "%s is in the exception backtrace (%s)" % (n, names)) Index: source/Plugins/Language/ObjC/ObjCLanguage.cpp === --- source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -409,6 +409,9 @@ "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags); AddCXXSummary( objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, + "NSArray summary provider", ConstString("_NSCallStackArray"), appkit_flags); + AddCXXSummary( + objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags); AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, @@ -528,6 +531,10 @@ ScriptedSyntheticChildren::Flags()); AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, + "NSArray synthetic children", ConstString("_NSCallStackArray"), + ScriptedSyntheticChildren::Flags()); + AddCXXSynthetic(objc_category_sp, + lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags()); Index: source/Plugins/Language/ObjC/NSArray.cpp === --- source/Plugins/Language/ObjC/NSArray.cpp +++ source/Plugins/Language/ObjC/NSArray.cpp @@ -214,6 +214,25 @@ } +namespace CallStackArray { +struct DataDescriptor_32 { + uint32_t _data; + uint32_t _used; + uint32_t _offset; + const uint32_t _size = 0; +}; + +struct DataDescriptor_64 { + uint64_t _data; + uint64_t _used; + uint64_t _offset; + const uint64_t _size = 0; +}; + +using NSCallStackArraySyntheticFrontEnd = +GenericNSArrayMSyntheticFrontEnd; +} // namespace CallStackArray + template class GenericNSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: @@ -364,6 +383,7 @@ static const ConstString g_NSArrayCF("__NSCFArray"); static const ConstString g_NSArrayMLegacy("__NSArrayM_Legacy"); static const ConstString g_NSArrayMImmutable("__NSArrayM_Immutable"); + static const ConstString g_NSCallStackArray("_NSCallStackArray"); if (class_name.IsEmpty()) return false; @@ -413,7 +433,9 @@ value = 0; } else if (class_name == g_NSArray1) { value = 1; - } else if (class_name == g_NSArrayCF) { + } else if (class_name == g_NSArrayCF || class_name == g_NSCallStackArray) { +// __NSCFArray and _NSCallStackArray store the number of elements as a +// pointer-sized
[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values
kubamracek marked an inline comment as done. kubamracek added inline comments. Comment at: source/Plugins/Language/ObjC/NSException.cpp:161-168 +static ConstString g___name("name"); +static ConstString g___reason("reason"); static ConstString g___userInfo("userInfo"); -if (name == g___userInfo) - return 0; +static ConstString g___reserved("reserved"); +if (name == g___name) return 0; +if (name == g___reason) return 1; +if (name == g___userInfo) return 2; davide wrote: > can you clang-format this and add a comment? Thanks. This is already clang-formatted. Added comment. https://reviews.llvm.org/D43884 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values
kubamracek updated this revision to Diff 173692. https://reviews.llvm.org/D43884 Files: packages/Python/lldbsuite/test/lang/objc/exceptions/Makefile packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py packages/Python/lldbsuite/test/lang/objc/exceptions/main.m source/Plugins/Language/ObjC/NSException.cpp Index: source/Plugins/Language/ObjC/NSException.cpp === --- source/Plugins/Language/ObjC/NSException.cpp +++ source/Plugins/Language/ObjC/NSException.cpp @@ -34,8 +34,8 @@ using namespace lldb_private::formatters; static bool ExtractFields(ValueObject , ValueObjectSP *name_sp, - ValueObjectSP *reason_sp, - ValueObjectSP *userinfo_sp) { + ValueObjectSP *reason_sp, ValueObjectSP *userinfo_sp, + ValueObjectSP *reserved_sp) { ProcessSP process_sp(valobj.GetProcessSP()); if (!process_sp) return false; @@ -65,10 +65,14 @@ auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size, error); if (error.Fail() || userinfo == LLDB_INVALID_ADDRESS) return false; + auto reserved = process_sp->ReadPointerFromMemory(ptr + 4 * ptr_size, error); + if (error.Fail() || reserved == LLDB_INVALID_ADDRESS) +return false; InferiorSizedWord name_isw(name, *process_sp); InferiorSizedWord reason_isw(reason, *process_sp); InferiorSizedWord userinfo_isw(userinfo, *process_sp); + InferiorSizedWord reserved_isw(reserved, *process_sp); CompilerType voidstar = process_sp->GetTarget() .GetScratchClangASTContext() @@ -87,15 +91,19 @@ *userinfo_sp = ValueObject::CreateValueObjectFromData( "userInfo", userinfo_isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), voidstar); + if (reserved_sp) +*reserved_sp = ValueObject::CreateValueObjectFromData( +"reserved", reserved_isw.GetAsData(process_sp->GetByteOrder()), +valobj.GetExecutionContextRef(), voidstar); return true; } bool lldb_private::formatters::NSException_SummaryProvider( ValueObject , Stream , const TypeSummaryOptions ) { lldb::ValueObjectSP name_sp; lldb::ValueObjectSP reason_sp; - if (!ExtractFields(valobj, _sp, _sp, nullptr)) + if (!ExtractFields(valobj, _sp, _sp, nullptr, nullptr)) return false; if (!name_sp || !reason_sp) @@ -121,35 +129,56 @@ ~NSExceptionSyntheticFrontEnd() override = default; size_t CalculateNumChildren() override { -return 1; +return 4; } lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { switch (idx) { - case 0: return m_userinfo_sp; + case 0: return m_name_sp; + case 1: return m_reason_sp; + case 2: return m_userinfo_sp; + case 3: return m_reserved_sp; } return lldb::ValueObjectSP(); } bool Update() override { +m_name_sp.reset(); +m_reason_sp.reset(); m_userinfo_sp.reset(); -if (!ExtractFields(m_backend, nullptr, nullptr, _userinfo_sp)) { +m_reserved_sp.reset(); + +if (!ExtractFields(m_backend, _name_sp, _reason_sp, _userinfo_sp, + _reserved_sp)) { return false; } return true; } bool MightHaveChildren() override { return true; } size_t GetIndexOfChildWithName(const ConstString ) override { +// NSException has 4 members: +// NSString *name; +// NSString *reason; +// NSDictionary *userInfo; +// id reserved; +static ConstString g___name("name"); +static ConstString g___reason("reason"); static ConstString g___userInfo("userInfo"); -if (name == g___userInfo) - return 0; +static ConstString g___reserved("reserved"); +if (name == g___name) return 0; +if (name == g___reason) return 1; +if (name == g___userInfo) return 2; +if (name == g___reserved) return 3; return UINT32_MAX; } private: + ValueObjectSP m_name_sp; + ValueObjectSP m_reason_sp; ValueObjectSP m_userinfo_sp; + ValueObjectSP m_reserved_sp; }; SyntheticChildrenFrontEnd * Index: packages/Python/lldbsuite/test/lang/objc/exceptions/main.m === --- /dev/null +++ packages/Python/lldbsuite/test/lang/objc/exceptions/main.m @@ -0,0 +1,36 @@ +//===-- main.m *- ObjC -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#import + +void foo() +{ +NSDictionary *info = [NSDictionary dictionaryWithObjectsAndKeys:@"some_value", @"some_key", nil]; +@throw [[NSException alloc] initWithName:@"ThrownException" reason:@"SomeReason" userInfo:info]; +} + +int main (int
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
aleksandr.urakov added a comment. But all compiles without errors if I run this manually: clang-cl -m32 /Z7 /c /GS- C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp /o C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.obj Repository: rLLDB LLDB https://reviews.llvm.org/D54009 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54009: Refactor LLDB lit configuration files
aleksandr.urakov added a comment. I also have some strange failures on Windows x86 (I run tests from x64_86 MSVC command line). If I locally revert this commit and 3 fix commits right after this one, then all seems to work. Here is the failure: C:\Work\llvm\build_x86\bin>llvm-lit.py -v C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB\enums-layout.test llvm-lit.py: C:/Work/llvm\utils\lit\lit\llvm\config.py:333: note: using C:/Work/llvm/build_x86/./bin/clang.exe: C:\Work\llvm\build_x86\bin\clang.exe llvm-lit.py: C:/Work/llvm\utils\lit\lit\llvm\config.py:333: note: using C:/Work/llvm/build_x86/./bin/clang++.exe: C:\Work\llvm\build_x86\bin\clang++.exe config.cc = C:\Work\llvm\build_x86\bin\clang.exe -- Testing: 1 tests, 1 threads -- FAIL: LLDB :: SymbolFile/PDB/enums-layout.test (1 of 1) TEST 'LLDB :: SymbolFile/PDB/enums-layout.test' FAILED Script: -- : 'RUN: at line 2'; clang-cl -m32 /Z7 /c /GS- C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp /o C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.obj : 'RUN: at line 3'; link C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.exe : 'RUN: at line 4'; C:\Work\llvm\build_x86\bin\lldb-test.EXE symbols C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.exe | C:\Work\llvm\build_x86\bin\FileCheck.EXE C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB\enums-layout.test -- Exit Code: 1 Command Output (stdout): -- $ ":" "RUN: at line 2" $ "clang-cl" "-m32" "/Z7" "/c" "/GS-" "C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp" "/o" "C:\Work\llvm\build_x86\tools\lldb\lit\SymbolFile\PDB\Output/SimpleTypesTest.cpp.enums.obj" # command stderr: C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp(41,9) : error: unknown type name 'char16_t' typedef char16_t WChar16Typedef; ^ C:\Work\llvm\tools\lldb\lit\SymbolFile\PDB/Inputs/SimpleTypesTest.cpp(44,9) : error: unknown type name 'char32_t' typedef char32_t WChar32Typedef; ^ 2 errors generated. error: command failed with exit status: 1 -- Testing Time: 0.33s Failing Tests (1): LLDB :: SymbolFile/PDB/enums-layout.test Unexpected Failures: 1 I can't figure out yet what can be wrong with it. May be you have some ideas how to fix this? Repository: rLLDB LLDB https://reviews.llvm.org/D54009 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44060: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex
This revision was automatically updated to reflect the committed changes. Closed by commit rL346673: [lldb] Fix code requires global destructor warning in g_architecture_mutex (authored by kuba.brecka, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D44060?vs=136886=173690#toc Repository: rL LLVM https://reviews.llvm.org/D44060 Files: lldb/trunk/source/Core/PluginManager.cpp Index: lldb/trunk/source/Core/PluginManager.cpp === --- lldb/trunk/source/Core/PluginManager.cpp +++ lldb/trunk/source/Core/PluginManager.cpp @@ -286,7 +286,10 @@ typedef std::vector ArchitectureInstances; -static std::mutex g_architecture_mutex; +static std::mutex () { +static std::mutex g_architecture_mutex; +return g_architecture_mutex; +} static ArchitectureInstances () { static ArchitectureInstances g_instances; @@ -296,13 +299,13 @@ void PluginManager::RegisterPlugin(const ConstString , llvm::StringRef description, ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); GetArchitectureInstances().push_back({name, description, create_callback}); } void PluginManager::UnregisterPlugin( ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); auto = GetArchitectureInstances(); for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) { @@ -316,7 +319,7 @@ std::unique_ptr PluginManager::CreateArchitectureInstance(const ArchSpec ) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); for (const auto : GetArchitectureInstances()) { if (auto plugin_up = instances.create_callback(arch)) return plugin_up; Index: lldb/trunk/source/Core/PluginManager.cpp === --- lldb/trunk/source/Core/PluginManager.cpp +++ lldb/trunk/source/Core/PluginManager.cpp @@ -286,7 +286,10 @@ typedef std::vector ArchitectureInstances; -static std::mutex g_architecture_mutex; +static std::mutex () { +static std::mutex g_architecture_mutex; +return g_architecture_mutex; +} static ArchitectureInstances () { static ArchitectureInstances g_instances; @@ -296,13 +299,13 @@ void PluginManager::RegisterPlugin(const ConstString , llvm::StringRef description, ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); GetArchitectureInstances().push_back({name, description, create_callback}); } void PluginManager::UnregisterPlugin( ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); auto = GetArchitectureInstances(); for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) { @@ -316,7 +319,7 @@ std::unique_ptr PluginManager::CreateArchitectureInstance(const ArchSpec ) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); for (const auto : GetArchitectureInstances()) { if (auto plugin_up = instances.create_callback(arch)) return plugin_up; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346673 - [lldb] Fix "code requires global destructor" warning in g_architecture_mutex
Author: kuba.brecka Date: Mon Nov 12 08:52:58 2018 New Revision: 346673 URL: http://llvm.org/viewvc/llvm-project?rev=346673=rev Log: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex Differential Revision: https://reviews.llvm.org/D44060 Modified: lldb/trunk/source/Core/PluginManager.cpp Modified: lldb/trunk/source/Core/PluginManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=346673=346672=346673=diff == --- lldb/trunk/source/Core/PluginManager.cpp (original) +++ lldb/trunk/source/Core/PluginManager.cpp Mon Nov 12 08:52:58 2018 @@ -286,7 +286,10 @@ struct ArchitectureInstance { typedef std::vector ArchitectureInstances; -static std::mutex g_architecture_mutex; +static std::mutex () { +static std::mutex g_architecture_mutex; +return g_architecture_mutex; +} static ArchitectureInstances () { static ArchitectureInstances g_instances; @@ -296,13 +299,13 @@ static ArchitectureInstances void PluginManager::RegisterPlugin(const ConstString , llvm::StringRef description, ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); GetArchitectureInstances().push_back({name, description, create_callback}); } void PluginManager::UnregisterPlugin( ArchitectureCreateInstance create_callback) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); auto = GetArchitectureInstances(); for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) { @@ -316,7 +319,7 @@ void PluginManager::UnregisterPlugin( std::unique_ptr PluginManager::CreateArchitectureInstance(const ArchSpec ) { - std::lock_guard guard(g_architecture_mutex); + std::lock_guard guard(GetArchitectureMutex()); for (const auto : GetArchitectureInstances()) { if (auto plugin_up = instances.create_callback(arch)) return plugin_up; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346672 - [PDB] Fix `vbases.test` requirement
Author: aleksandr.urakov Date: Mon Nov 12 08:45:55 2018 New Revision: 346672 URL: http://llvm.org/viewvc/llvm-project?rev=346672=rev Log: [PDB] Fix `vbases.test` requirement Differential revision: https://reviews.llvm.org/D53506 Modified: lldb/trunk/lit/SymbolFile/PDB/vbases.test Modified: lldb/trunk/lit/SymbolFile/PDB/vbases.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/vbases.test?rev=346672=346671=346672=diff == --- lldb/trunk/lit/SymbolFile/PDB/vbases.test (original) +++ lldb/trunk/lit/SymbolFile/PDB/vbases.test Mon Nov 12 08:45:55 2018 @@ -1,4 +1,4 @@ -REQUIRES: windows +REQUIRES: system-windows RUN: clang-cl /Zi %S/Inputs/VBases.cpp /o %t.exe RUN: %lldb -b -s %S/Inputs/VBases.script -- %t.exe | FileCheck %s ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D53506: [ClangASTContext] Extract VTable pointers from C++ objects
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL346669: [ClangASTContext] Extract VTable pointers from C++ objects (authored by aleksandr.urakov, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D53506?vs=170430=173684#toc Repository: rL LLVM https://reviews.llvm.org/D53506 Files: lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.cpp lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.script lldb/trunk/lit/SymbolFile/PDB/vbases.test lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Index: lldb/trunk/source/Core/ValueObject.cpp === --- lldb/trunk/source/Core/ValueObject.cpp +++ lldb/trunk/source/Core/ValueObject.cpp @@ -2804,31 +2804,6 @@ return result_sp; } -lldb::addr_t ValueObject::GetCPPVTableAddress(AddressType _type) { - CompilerType pointee_type; - CompilerType this_type(GetCompilerType()); - uint32_t type_info = this_type.GetTypeInfo(_type); - if (type_info) { -bool ptr_or_ref = false; -if (type_info & (eTypeIsPointer | eTypeIsReference)) { - ptr_or_ref = true; - type_info = pointee_type.GetTypeInfo(); -} - -const uint32_t cpp_class = eTypeIsClass | eTypeIsCPlusPlus; -if ((type_info & cpp_class) == cpp_class) { - if (ptr_or_ref) { -address_type = GetAddressTypeOfChildren(); -return GetValueAsUnsigned(LLDB_INVALID_ADDRESS); - } else -return GetAddressOf(false, _type); -} - } - - address_type = eAddressTypeInvalid; - return LLDB_INVALID_ADDRESS; -} - ValueObjectSP ValueObject::Dereference(Status ) { if (m_deref_valobj) return m_deref_valobj->GetSP(); Index: lldb/trunk/source/Symbol/ClangASTContext.cpp === --- lldb/trunk/source/Symbol/ClangASTContext.cpp +++ lldb/trunk/source/Symbol/ClangASTContext.cpp @@ -201,6 +201,122 @@ } } +static lldb::addr_t GetVTableAddress(Process , + VTableContextBase _ctx, + ValueObject , + const ASTRecordLayout _layout) { + // Retrieve type info + CompilerType pointee_type; + CompilerType this_type(valobj.GetCompilerType()); + uint32_t type_info = this_type.GetTypeInfo(_type); + if (!type_info) +return LLDB_INVALID_ADDRESS; + + // Check if it's a pointer or reference + bool ptr_or_ref = false; + if (type_info & (eTypeIsPointer | eTypeIsReference)) { +ptr_or_ref = true; +type_info = pointee_type.GetTypeInfo(); + } + + // We process only C++ classes + const uint32_t cpp_class = eTypeIsClass | eTypeIsCPlusPlus; + if ((type_info & cpp_class) != cpp_class) +return LLDB_INVALID_ADDRESS; + + // Calculate offset to VTable pointer + lldb::offset_t vbtable_ptr_offset = + vtable_ctx.isMicrosoft() ? record_layout.getVBPtrOffset().getQuantity() + : 0; + + if (ptr_or_ref) { +// We have a pointer / ref to object, so read +// VTable pointer from process memory + +if (valobj.GetAddressTypeOfChildren() != eAddressTypeLoad) + return LLDB_INVALID_ADDRESS; + +auto vbtable_ptr_addr = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS); +if (vbtable_ptr_addr == LLDB_INVALID_ADDRESS) + return LLDB_INVALID_ADDRESS; + +vbtable_ptr_addr += vbtable_ptr_offset; + +Status err; +return process.ReadPointerFromMemory(vbtable_ptr_addr, err); + } + + // We have an object already read from process memory, + // so just extract VTable pointer from it + + DataExtractor data; + Status err; + auto size = valobj.GetData(data, err); + if (err.Fail() || vbtable_ptr_offset + data.GetAddressByteSize() > size) +return LLDB_INVALID_ADDRESS; + + return data.GetPointer(_ptr_offset); +} + +static int64_t ReadVBaseOffsetFromVTable(Process , + VTableContextBase _ctx, + lldb::addr_t vtable_ptr, + const CXXRecordDecl *cxx_record_decl, + const CXXRecordDecl *base_class_decl) { + if (vtable_ctx.isMicrosoft()) { +clang::MicrosoftVTableContext _vtable_ctx = +static_cast(vtable_ctx); + +// Get the index into the virtual base table. The +// index is the index in uint32_t from vbtable_ptr +const unsigned vbtable_index = +msoft_vtable_ctx.getVBTableIndex(cxx_record_decl, base_class_decl); +const lldb::addr_t base_offset_addr = vtable_ptr + vbtable_index * 4; +Status err; +return process.ReadSignedIntegerFromMemory(base_offset_addr, 4, INT64_MAX, + err); + } + +
[Lldb-commits] [lldb] r346669 - [ClangASTContext] Extract VTable pointers from C++ objects
Author: aleksandr.urakov Date: Mon Nov 12 08:23:50 2018 New Revision: 346669 URL: http://llvm.org/viewvc/llvm-project?rev=346669=rev Log: [ClangASTContext] Extract VTable pointers from C++ objects This patch processes the case of retrieving a virtual base when the object is already read from the debuggee memory. To achieve that ValueObject::GetCPPVTableAddress was removed and was reimplemented in ClangASTContext (because access to the process is needed to retrieve the VTable pointer in general, and because this is the only place that used old version of ValueObject::GetCPPVTableAddress). This patch allows to use real object's VTable instead of searching virtual bases by offsets restored by MicrosoftRecordLayoutBuilder. PDB has no enough info to restore VBase offsets properly, so we have to read real VTable instead. Differential revision: https://reviews.llvm.org/D53506 Added: lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.cpp lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.script lldb/trunk/lit/SymbolFile/PDB/vbases.test Modified: lldb/trunk/include/lldb/Core/ValueObject.h lldb/trunk/source/Core/ValueObject.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Core/ValueObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=346669=346668=346669=diff == --- lldb/trunk/include/lldb/Core/ValueObject.h (original) +++ lldb/trunk/include/lldb/Core/ValueObject.h Mon Nov 12 08:23:50 2018 @@ -635,9 +635,6 @@ public: virtual void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS, AddressType address_type = eAddressTypeLoad) {} - // Find the address of the C++ vtable pointer - virtual lldb::addr_t GetCPPVTableAddress(AddressType _type); - virtual lldb::ValueObjectSP Cast(const CompilerType _type); virtual lldb::ValueObjectSP CastPointerType(const char *name, Added: lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.cpp?rev=346669=auto == --- lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.cpp (added) +++ lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.cpp Mon Nov 12 08:23:50 2018 @@ -0,0 +1,16 @@ +struct A { + char a = 1; +}; + +struct B { + int b = 2; +}; + +struct C : virtual A, virtual B { + short c = 3; +}; + +int main() { + C c{}; + return 0; +} Added: lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.script URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.script?rev=346669=auto == --- lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.script (added) +++ lldb/trunk/lit/SymbolFile/PDB/Inputs/VBases.script Mon Nov 12 08:23:50 2018 @@ -0,0 +1,7 @@ +breakpoint set --file VBases.cpp --line 15 + +run + +print c + +frame variable c \ No newline at end of file Added: lldb/trunk/lit/SymbolFile/PDB/vbases.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/vbases.test?rev=346669=auto == --- lldb/trunk/lit/SymbolFile/PDB/vbases.test (added) +++ lldb/trunk/lit/SymbolFile/PDB/vbases.test Mon Nov 12 08:23:50 2018 @@ -0,0 +1,15 @@ +REQUIRES: windows +RUN: clang-cl /Zi %S/Inputs/VBases.cpp /o %t.exe +RUN: %lldb -b -s %S/Inputs/VBases.script -- %t.exe | FileCheck %s + +CHECK: { +CHECK: A = (a = '\x01') +CHECK: B = (b = 2) +CHECK: c = 3 +CHECK: } + +CHECK: { +CHECK: A = (a = '\x01') +CHECK: B = (b = 2) +CHECK: c = 3 +CHECK: } Modified: lldb/trunk/source/Core/ValueObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=346669=346668=346669=diff == --- lldb/trunk/source/Core/ValueObject.cpp (original) +++ lldb/trunk/source/Core/ValueObject.cpp Mon Nov 12 08:23:50 2018 @@ -2804,31 +2804,6 @@ ValueObjectSP ValueObject::GetQualifiedR return result_sp; } -lldb::addr_t ValueObject::GetCPPVTableAddress(AddressType _type) { - CompilerType pointee_type; - CompilerType this_type(GetCompilerType()); - uint32_t type_info = this_type.GetTypeInfo(_type); - if (type_info) { -bool ptr_or_ref = false; -if (type_info & (eTypeIsPointer | eTypeIsReference)) { - ptr_or_ref = true; - type_info = pointee_type.GetTypeInfo(); -} - -const uint32_t cpp_class = eTypeIsClass | eTypeIsCPlusPlus; -if ((type_info & cpp_class) == cpp_class) { - if (ptr_or_ref) { -address_type = GetAddressTypeOfChildren(); -return GetValueAsUnsigned(LLDB_INVALID_ADDRESS); - } else -return GetAddressOf(false, _type); -} - } - - address_type = eAddressTypeInvalid; - return LLDB_INVALID_ADDRESS; -} -
[Lldb-commits] [PATCH] D54333: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX
This revision was automatically updated to reflect the committed changes. Closed by commit rL346668: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX (authored by stefan.graenitz, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D54333 Files: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/LLDBConfig.cmake Index: lldb/trunk/CMakeLists.txt === --- lldb/trunk/CMakeLists.txt +++ lldb/trunk/CMakeLists.txt @@ -56,7 +56,7 @@ # the framework, and must be defined before building liblldb. set(PRODUCT_NAME "LLDB") set(EXECUTABLE_NAME "LLDB") - set(CURRENT_PROJECT_VERSION "360.99.0") + set(CURRENT_PROJECT_VERSION "${LLDB_VERSION}") set(LLDB_SUITE_TARGET lldb-framework) set(LLDB_FRAMEWORK_DIR Index: lldb/trunk/cmake/modules/LLDBConfig.cmake === --- lldb/trunk/cmake/modules/LLDBConfig.cmake +++ lldb/trunk/cmake/modules/LLDBConfig.cmake @@ -265,9 +265,20 @@ "`CMakeFiles'. Please delete them.") endif() -# Compute the LLDB version from the LLVM version. -string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION - ${PACKAGE_VERSION}) +# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*. +if(NOT DEFINED LLDB_VERSION_MAJOR) + set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) +endif() +if(NOT DEFINED LLDB_VERSION_MINOR) + set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR}) +endif() +if(NOT DEFINED LLDB_VERSION_PATCH) + set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH}) +endif() +if(NOT DEFINED LLDB_VERSION_SUFFIX) + set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX}) +endif() +set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}") message(STATUS "LLDB version: ${LLDB_VERSION}") include_directories(BEFORE Index: lldb/trunk/CMakeLists.txt === --- lldb/trunk/CMakeLists.txt +++ lldb/trunk/CMakeLists.txt @@ -56,7 +56,7 @@ # the framework, and must be defined before building liblldb. set(PRODUCT_NAME "LLDB") set(EXECUTABLE_NAME "LLDB") - set(CURRENT_PROJECT_VERSION "360.99.0") + set(CURRENT_PROJECT_VERSION "${LLDB_VERSION}") set(LLDB_SUITE_TARGET lldb-framework) set(LLDB_FRAMEWORK_DIR Index: lldb/trunk/cmake/modules/LLDBConfig.cmake === --- lldb/trunk/cmake/modules/LLDBConfig.cmake +++ lldb/trunk/cmake/modules/LLDBConfig.cmake @@ -265,9 +265,20 @@ "`CMakeFiles'. Please delete them.") endif() -# Compute the LLDB version from the LLVM version. -string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION - ${PACKAGE_VERSION}) +# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*. +if(NOT DEFINED LLDB_VERSION_MAJOR) + set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) +endif() +if(NOT DEFINED LLDB_VERSION_MINOR) + set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR}) +endif() +if(NOT DEFINED LLDB_VERSION_PATCH) + set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH}) +endif() +if(NOT DEFINED LLDB_VERSION_SUFFIX) + set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX}) +endif() +set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}") message(STATUS "LLDB version: ${LLDB_VERSION}") include_directories(BEFORE ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54335: [CMake] Fix: add_host_subdirectory source/Host/macosx
This revision was automatically updated to reflect the committed changes. Closed by commit rL346667: [CMake] Fix: add_host_subdirectory source/Host/macosx (authored by stefan.graenitz, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D54335 Files: lldb/trunk/source/Host/CMakeLists.txt Index: lldb/trunk/source/Host/CMakeLists.txt === --- lldb/trunk/source/Host/CMakeLists.txt +++ lldb/trunk/source/Host/CMakeLists.txt @@ -91,7 +91,7 @@ include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) add_subdirectory(macosx/objcxx) set(LLDBObjCLibs lldbHostMacOSXObjCXX) -add_host_subdirectory(maqcosx +add_host_subdirectory(macosx macosx/Symbols.cpp macosx/cfcpp/CFCBundle.cpp macosx/cfcpp/CFCData.cpp Index: lldb/trunk/source/Host/CMakeLists.txt === --- lldb/trunk/source/Host/CMakeLists.txt +++ lldb/trunk/source/Host/CMakeLists.txt @@ -91,7 +91,7 @@ include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) add_subdirectory(macosx/objcxx) set(LLDBObjCLibs lldbHostMacOSXObjCXX) -add_host_subdirectory(maqcosx +add_host_subdirectory(macosx macosx/Symbols.cpp macosx/cfcpp/CFCBundle.cpp macosx/cfcpp/CFCData.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346668 - [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX
Author: stefan.graenitz Date: Mon Nov 12 08:22:28 2018 New Revision: 346668 URL: http://llvm.org/viewvc/llvm-project?rev=346668=rev Log: [CMake] Allow version overrides with -DLLDB_VERSION_MAJOR/MINOR/PATCH/SUFFIX Summary: This follows the approach in Clang. If no overrides are given, LLDB_VERSION_* is inferred from LLVM_VERSION_*. This mimics the current behaviour (PACKAGE_VERSION itself is generated from LLVM_VERSION_*). For in-tree builds LLVM_VERSION_* will be defined at this point already. For standalone builds, LLDBConfig.cmake is included after LLDBStandalone.cmake which includes LLVMConfig.cmake. Reviewers: labath, xiaobai Subscribers: mgorny, friss, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D54333 Modified: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/LLDBConfig.cmake Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=346668=346667=346668=diff == --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Mon Nov 12 08:22:28 2018 @@ -56,7 +56,7 @@ if(LLDB_BUILD_FRAMEWORK) # the framework, and must be defined before building liblldb. set(PRODUCT_NAME "LLDB") set(EXECUTABLE_NAME "LLDB") - set(CURRENT_PROJECT_VERSION "360.99.0") + set(CURRENT_PROJECT_VERSION "${LLDB_VERSION}") set(LLDB_SUITE_TARGET lldb-framework) set(LLDB_FRAMEWORK_DIR Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=346668=346667=346668=diff == --- lldb/trunk/cmake/modules/LLDBConfig.cmake (original) +++ lldb/trunk/cmake/modules/LLDBConfig.cmake Mon Nov 12 08:22:28 2018 @@ -265,9 +265,20 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINA "`CMakeFiles'. Please delete them.") endif() -# Compute the LLDB version from the LLVM version. -string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION - ${PACKAGE_VERSION}) +# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*. +if(NOT DEFINED LLDB_VERSION_MAJOR) + set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) +endif() +if(NOT DEFINED LLDB_VERSION_MINOR) + set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR}) +endif() +if(NOT DEFINED LLDB_VERSION_PATCH) + set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH}) +endif() +if(NOT DEFINED LLDB_VERSION_SUFFIX) + set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX}) +endif() +set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}") message(STATUS "LLDB version: ${LLDB_VERSION}") include_directories(BEFORE ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346667 - [CMake] Fix: add_host_subdirectory source/Host/macosx
Author: stefan.graenitz Date: Mon Nov 12 08:22:24 2018 New Revision: 346667 URL: http://llvm.org/viewvc/llvm-project?rev=346667=rev Log: [CMake] Fix: add_host_subdirectory source/Host/macosx Summary: Typo introduced with https://reviews.llvm.org/D47929 Reviewers: teemperor Subscribers: mgorny, friss, lldb-commits Differential Revision: https://reviews.llvm.org/D54335 Modified: lldb/trunk/source/Host/CMakeLists.txt Modified: lldb/trunk/source/Host/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=346667=34=346667=diff == --- lldb/trunk/source/Host/CMakeLists.txt (original) +++ lldb/trunk/source/Host/CMakeLists.txt Mon Nov 12 08:22:24 2018 @@ -91,7 +91,7 @@ else() include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) add_subdirectory(macosx/objcxx) set(LLDBObjCLibs lldbHostMacOSXObjCXX) -add_host_subdirectory(maqcosx +add_host_subdirectory(macosx macosx/Symbols.cpp macosx/cfcpp/CFCBundle.cpp macosx/cfcpp/CFCData.cpp ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D54357: [NativePDB] Improved support for nested type reconstruction
On Mon, Nov 12, 2018 at 6:42 PM Zachary Turner wrote: > Clang only. But I don’t think we can ever replace it with an assert, > debug info is basically user input, so we have to be able to handle every > manner of malformed input. In fact, when this bug is fixed in clang, i > will probably try to keep a test case around that manually generates the > bad debug info using llvm-mc or something, just to make sure it will not > break. Because, for example, someone could be debugging a program that was > built with the buggy compiler version. > Yes, I agree now. > I think we need to support both. Certain pieces of information are not > represented in the mangling at all, so if we rely purely on the mangling we > will never be able to perfectly reconstruct the DeclContext hierarchy. So > I think each approach by itself would be imperfect, but combined it will be > very good. > Ok, then LGTM, thanks! -- Aleksandr Urakov Software Developer JetBrains http://www.jetbrains.com The Drive to Develop ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values
davide requested changes to this revision. davide added inline comments. This revision now requires changes to proceed. Comment at: source/Plugins/Language/ObjC/NSException.cpp:161-168 +static ConstString g___name("name"); +static ConstString g___reason("reason"); static ConstString g___userInfo("userInfo"); -if (name == g___userInfo) - return 0; +static ConstString g___reserved("reserved"); +if (name == g___name) return 0; +if (name == g___reason) return 1; +if (name == g___userInfo) return 2; can you clang-format this and add a comment? Thanks. https://reviews.llvm.org/D43884 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44081: [lldb] Add synthetic frontend for _NSCallStackArray
davide requested changes to this revision. davide added inline comments. This revision now requires changes to proceed. Comment at: source/Plugins/Language/ObjC/NSArray.cpp:446-451 + } else if (class_name == g_NSCallStackArray) { +Status error; +value = process_sp->ReadUnsignedIntegerFromMemory( +valobj_addr + 2 * ptr_size, ptr_size, 0, error); +if (error.Fail()) + return false; Can you add a comment here? this also seems exactly the same as `NSArrayCF`, any chance we can avoid the duplication? https://reviews.llvm.org/D44081 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44060: [lldb] Fix "code requires global destructor" warning in g_architecture_mutex
davide accepted this revision. davide added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D44060 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D54357: [NativePDB] Improved support for nested type reconstruction
On Mon, Nov 12, 2018 at 6:51 AM Aleksandr Urakov via Phabricator < revi...@reviews.llvm.org> wrote: > aleksandr.urakov added a comment. > > This change looks reasonable to me for solving the problem with the > current `LF_NESTTYPE` approach. But I'm not sure... Now we all the same > need to analyze mangled names and make a decision based on this. Does the > current `LF_NESTTYPE` approach still has advantages over the "parse-scope" > approach? I'm afraid that we will have to fully analyze a mangled name in > the future for scoped types, so if the `LF_NESTTYPE` approach doesn't have > a significant advantages over the "parse-scope" approach, do we really need > to support them both? I think we need to support both. Certain pieces of information are not represented in the mangling at all, so if we rely purely on the mangling we will never be able to perfectly reconstruct the DeclContext hierarchy. So I think each approach by itself would be imperfect, but combined it will be very good. > > > > > Comment at: > lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:560-576 > + // If it's an inner definition, then treat whatever name we have here > as a > + // single component of a mangled name. So we can inject it into the > parent's > + // mangled name to see if it matches. > + CVTagRecord child = CVTagRecord::create(tpi.getType(Record.Type)); > + std::string qname = parent.asTag().getUniqueName(); > + if (qname.size() < 4 || child.asTag().getUniqueName().size() < 4) > +return llvm::None; > > May be it would be a good idea to make the demangler (or to implement a > mangler) more flexible to hide these details there? I do not mean to do it > exactly in this commit, but what do you think about this at all? > > > > Comment at: > lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:881-887 > +// If there is no parent in the debug info, but some of the scopes > have > +// template params, then this is a case of bad debug info. See, for > +// example, llvm.org/pr39607. We don't want to create an ambiguity > between > +// a NamespaceDecl and a CXXRecordDecl, so instead we create a class > at > +// global scope with the fully qualified name. > +if (AnyScopesHaveTemplateParams(scopes)) > + return {context, record.Name}; > > Is this a clang only bug, or MSVC also does so? I do not have anything > against this solution for now, I just mean, may be we'll replace it with an > `assert` when the bug will be fixed? Clang only. But I don’t think we can ever replace it with an assert, debug info is basically user input, so we have to be able to handle every manner of malformed input. In fact, when this bug is fixed in clang, i will probably try to keep a test case around that manually generates the bad debug info using llvm-mc or something, just to make sure it will not break. Because, for example, someone could be debugging a program that was built with the buggy compiler version. > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54357: [NativePDB] Improved support for nested type reconstruction
aleksandr.urakov added a comment. This change looks reasonable to me for solving the problem with the current `LF_NESTTYPE` approach. But I'm not sure... Now we all the same need to analyze mangled names and make a decision based on this. Does the current `LF_NESTTYPE` approach still has advantages over the "parse-scope" approach? I'm afraid that we will have to fully analyze a mangled name in the future for scoped types, so if the `LF_NESTTYPE` approach doesn't have a significant advantages over the "parse-scope" approach, do we really need to support them both? Comment at: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:560-576 + // If it's an inner definition, then treat whatever name we have here as a + // single component of a mangled name. So we can inject it into the parent's + // mangled name to see if it matches. + CVTagRecord child = CVTagRecord::create(tpi.getType(Record.Type)); + std::string qname = parent.asTag().getUniqueName(); + if (qname.size() < 4 || child.asTag().getUniqueName().size() < 4) +return llvm::None; May be it would be a good idea to make the demangler (or to implement a mangler) more flexible to hide these details there? I do not mean to do it exactly in this commit, but what do you think about this at all? Comment at: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp:881-887 +// If there is no parent in the debug info, but some of the scopes have +// template params, then this is a case of bad debug info. See, for +// example, llvm.org/pr39607. We don't want to create an ambiguity between +// a NamespaceDecl and a CXXRecordDecl, so instead we create a class at +// global scope with the fully qualified name. +if (AnyScopesHaveTemplateParams(scopes)) + return {context, record.Name}; Is this a clang only bug, or MSVC also does so? I do not have anything against this solution for now, I just mean, may be we'll replace it with an `assert` when the bug will be fixed? https://reviews.llvm.org/D54357 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r346651 - Fix an unused variable warning. NFC
Author: alexfh Date: Mon Nov 12 05:41:42 2018 New Revision: 346651 URL: http://llvm.org/viewvc/llvm-project?rev=346651=rev Log: Fix an unused variable warning. NFC Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=346651=346650=346651=diff == --- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Mon Nov 12 05:41:42 2018 @@ -44,8 +44,10 @@ const char *StopInfoMachException::GetDe const char *subcode_label = "subcode"; const char *subcode_desc = NULL; +#if defined(__APPLE__) char code_desc_buf[32]; char subcode_desc_buf[32]; +#endif switch (m_value) { case 1: // EXC_BAD_ACCESS ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54352: [CMake] Explicit lldb_codesign function with application in debugserver and lldb-server
sgraenitz added a comment. Yes, considered it, but was not sure whether it's a good idea to bloat the general mechanism in LLVM to match the requirements for a single subproject. Do you think other projects would benefit from it? My reasoning was: Passing through target-specific parameters to llvm_codesign is not simple as it runs "implicitly" as part of add_llvm_executable/library. In order to align with its current approach, entitlements had to be set in a global variable (like LLVM_CODESIGNING_IDENTITY) beforehand. Furthermore, we want to avoid entitlements to be used for yet another target, so we had to unset it afterwards. The conditions that determine the correct entitlements for each situation seem to be complicated already. Not sure if that's a good combination. OTOH, if we are in favour of a unified implementation, it would be great to encapsulate the details and write something like: add_lldb_tool(target ${sources} LINK_LIBS ${libs} ENTITLEMENTS ${entitlements} ) I think this would still require quite some additions to llvm_codesign. I went with the simpler version for now. What do you think? https://reviews.llvm.org/D54352 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D54417: Fix a crash when parsing incorrect DWARF
labath created this revision. labath added reviewers: clayborg, jankratochvil, JDevlieghere. While parsing a childless compile unit DIE we could crash if the DIE was followed by any extra data (such as a superfluous end-of-children marker). This happened because the break-on-depth=0 check was performed only when parsing the null DIE, which was not correct because with a childless root DIE, we could reach the end of the unit without ever encountering the null DIE. If the compile unit contribution ended directly after the CU DIE, everything would be fine as we would terminate parsing due to reaching EOF. However, if the contribution contained extra data (perhaps a superfluous end-of-children marker), we would crash because we would treat that data as the begging of another compile unit. This fixes the crash by moving the depth=0 check to a more generic place, and also adds a regression test. https://reviews.llvm.org/D54417 Files: lit/SymbolFile/DWARF/childless-compile-unit.s source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -244,9 +244,6 @@ if (depth > 0) --depth; - if (depth == 0) -break; // We are done with this compile unit! - prev_die_had_children = false; } else { die_index_stack.back() = m_die_array.size() - 1; @@ -258,6 +255,9 @@ } prev_die_had_children = die_has_children; } + +if (depth == 0) + break; // We are done with this compile unit! } if (!m_die_array.empty()) { Index: lit/SymbolFile/DWARF/childless-compile-unit.s === --- /dev/null +++ lit/SymbolFile/DWARF/childless-compile-unit.s @@ -0,0 +1,45 @@ +# Test that we don't crash when parsing slightly invalid DWARF. The compile +# unit in this file sets DW_CHILDREN_no, but it still includes an +# end-of-children marker in its contribution. + +# RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj > %t.o +# RUN: lldb-test symbols %t.o + + .section.debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "Hand-written DWARF" +.Linfo_string1: + .asciz "-" +.Linfo_string2: + .asciz "/tmp" + + .section.debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 0 # DW_CHILDREN_no + .byte 37 # DW_AT_producer + .byte 14 # DW_FORM_strp + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 14 # DW_FORM_strp + .byte 27 # DW_AT_comp_dir + .byte 14 # DW_FORM_strp + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + + .section.debug_info,"",@progbits +.Lcu_begin0: + .long .Lcu_length_end-.Lcu_length_start # Length of Unit +.Lcu_length_start: + .short 4 # DWARF version number + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Address Size (in bytes) + .byte 1 # Abbrev [1] 0xb:0x30 DW_TAG_compile_unit + .long .Linfo_string0 # DW_AT_producer + .short 12 # DW_AT_language + .long .Linfo_string1 # DW_AT_name + .long .Linfo_string2 # DW_AT_comp_dir + .byte 0 # Bogus End Of Children Mark +.Lcu_length_end: Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -244,9 +244,6 @@ if (depth > 0) --depth; - if (depth == 0) -break; // We are done with this compile unit! - prev_die_had_children = false; } else { die_index_stack.back() = m_die_array.size() - 1; @@ -258,6 +255,9 @@ } prev_die_had_children = die_has_children; } + +if (depth == 0) + break; // We are done with this compile unit! } if (!m_die_array.empty()) { Index: lit/SymbolFile/DWARF/childless-compile-unit.s === --- /dev/null +++ lit/SymbolFile/DWARF/childless-compile-unit.s @@ -0,0 +1,45 @@ +# Test that we don't crash when parsing slightly invalid DWARF. The compile +# unit in this file sets DW_CHILDREN_no, but it still includes an +# end-of-children