[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
jhenderson resigned from this revision. jhenderson added a comment. I'm not an LLDB developer, so probably not the right person to review this, sorry. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
wallace accepted this revision. wallace added inline comments. This revision is now accepted and ready to land. Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:559-560 if (!match) { + // Breakpad might put a hash of the up to the first page if .text + // bytes into the UUID of a minidump. Facebook also has slightly + // modified this hash to avoid collisions. Check for UUIDs from the I don't understand well the first sentence Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
jhenderson added inline comments. Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:34 +private: + Data &DWARF; + std::map AbbrevID2Index; Higuoxing wrote: > labath wrote: > > jhenderson wrote: > > > Would it make any sense to merge the `DWARFYAML::Data` class and > > > `DWARFYAML::DWARFState` class at all? > > That would definitely be nice. > >>! @jhenderson : > > Would it make any sense to merge the `DWARFYAML::Data` class and > > `DWARFYAML::DWARFState` class at all? > > >>! @labath : > > That would definitely be nice. > > I think they can be merged. But is there any particular reason to merge them? > Personally, I would like to keep the `DWARFYAML::DWARFState` class. Here are > a few concerns I would like to address: > > - If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we > will need to add some helper variables, e.g. `AbbrevTableID2Index` and a > method like `Error DWARFYAML::link()` to `DWARFYAML::Data` class to link > DWARF sections. We will have to call this special method before DWARF > sections being emitted. If we port DWARF support to other binary format in > the future, e.g., wasm, we might forget to call this method. If we make DWARF > emitters accept `DWARFYAML::DWARFState`, it's easy to figure out that we need > a `DWARFState` before emitting DWARF sections. > > - Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have > different functions. `DWARFYAML::Data` is used to contain original DWARF > section descriptions and `DWARFYAML::DWARFState` contains helper structs and > methods which helps link DWARF sections. It might be good not to merge them > so that we can easily figure out when and where are those sections get linked? > > I can be persuaded :-) > I think they can be merged. But is there any particular reason to merge them? As things stand, it mostly seems like `DWARFState` merely gets in the way of accessing the `Data` class. It seems to me like it would be easier to use if the two were one class, as you wouldn't have to keep going through an extra function call/member access. > - If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we > will need to add some helper variables, e.g. `AbbrevTableID2Index` and a > method like `Error DWARFYAML::link()` to `DWARFYAML::Data` class to link > DWARF sections. We will have to call this special method before DWARF > sections being emitted. If we port DWARF support to other binary format in > the future, e.g., wasm, we might forget to call this method. If we make DWARF > emitters accept `DWARFYAML::DWARFState`, it's easy to figure out that we need > a `DWARFState` before emitting DWARF sections. If, rather than do all the calculations up front (e.g. mapping tables to IDs), you put the `Data` members behind getters, you could then add the "linking" code there. For example, with the AbbrevTable ID mapping, you could have the `getAbbrevTableIndexByID` method, which is the only way of getting an abbrev table from outside the class. The first time this is called (or optionally every time), it works out the mapping between ID(s) and table(s). This avoids the need for an explicit `link` or `finalize` method. > - Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have > different functions. `DWARFYAML::Data` is used to contain original DWARF > section descriptions and `DWARFYAML::DWARFState` contains helper structs and > methods which helps link DWARF sections. It might be good not to merge them > so that we can easily figure out when and where are those sections get linked? I'm not sure I agree they have different functions. The `AbbrevID2Index` map is just a helper variable that is directly derived from the `Data` struct's members. We could get rid of it entirely, and just move the `getAbbrevTableIndexByID` method into `Data`, rewriting it to just run through the list of tables each time to find the right ID. This is obviously less efficient than instantiating a mapping up front, if done repeatedly, but I think it indicates that this extra layer is not actually doing anything distinct. Similar principles apply probably for other things, although without further concrete examples, it's hard to discuss them! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing updated this revision to Diff 286755. Higuoxing marked 10 inline comments as done. Higuoxing added a comment. Merge `DWARFYAML::Data` and `DWARFYAML::DWARFState`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 Files: llvm/include/llvm/ObjectYAML/DWARFEmitter.h llvm/include/llvm/ObjectYAML/DWARFYAML.h llvm/lib/ObjectYAML/DWARFEmitter.cpp llvm/lib/ObjectYAML/DWARFYAML.cpp llvm/lib/ObjectYAML/ELFEmitter.cpp llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml llvm/tools/obj2yaml/dwarf2yaml.cpp llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp === --- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -2487,6 +2487,7 @@ - Value: 0x - Length: 16 Version: 4 +AbbrevTableID: 0 AbbrOffset: 0 AddrSize:8 Entries: Index: llvm/tools/obj2yaml/dwarf2yaml.cpp === --- llvm/tools/obj2yaml/dwarf2yaml.cpp +++ llvm/tools/obj2yaml/dwarf2yaml.cpp @@ -23,6 +23,7 @@ void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) { auto AbbrevSetPtr = DCtx.getDebugAbbrev(); if (AbbrevSetPtr) { +uint64_t AbbrevTableID = 0; for (auto AbbrvDeclSet : *AbbrevSetPtr) { Y.DebugAbbrev.emplace_back(); for (auto AbbrvDecl : AbbrvDeclSet.second) { @@ -39,6 +40,7 @@ AttAbrv.Value = Attribute.getImplicitConstValue(); Abbrv.Attributes.push_back(AttAbrv); } +Y.DebugAbbrev.back().ID = AbbrevTableID++; Y.DebugAbbrev.back().Table.push_back(Abbrv); } } @@ -172,6 +174,14 @@ NewUnit.Version = CU->getVersion(); if (NewUnit.Version >= 5) NewUnit.Type = (dwarf::UnitType)CU->getUnitType(); +const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev(); +NewUnit.AbbrevTableID = std::distance( +DebugAbbrev->begin(), +std::find_if( +DebugAbbrev->begin(), DebugAbbrev->end(), +[&](const std::pair &P) { + return P.first == CU->getAbbreviations()->getOffset(); +})); NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset(); NewUnit.AddrSize = CU->getAddressByteSize(); for (auto DIE : CU->dies()) { Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml === --- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml +++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml @@ -207,11 +207,12 @@ - Attribute: 0x01 Form: DW_FORM_addrx4 ## 0x2c debug_info: -- Length: 0x1234 - Version:5 - UnitType: DW_UT_type - AbbrOffset: 0x1234 - AddrSize: 4 +- Length:0x1234 + Version: 5 + UnitType: DW_UT_type + AbbrevTableID: 0 + AbbrOffset:0x1234 + AddrSize: 4 Entries: - AbbrCode: 1 Values: @@ -272,6 +273,7 @@ Version: 5 ## Test another unit type. UnitType: DW_UT_compile + AbbrevTableID: 0 AbbrOffset:0x1234 AddrSize: 4 Entries: @@ -280,6 +282,7 @@ - Length:0x5678 ## Test DWARFv4 Version: 4 + AbbrevTableID: 0 AbbrOffset:0x5678 AddrSize: 4 Entries: @@ -901,7 +904,7 @@ ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV -# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table +# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 --- !ELF FileHeader: Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml === --- llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml +++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml @@ -314,3 +314,28 @@ - Tag:DW_TAG_subprogram Children: DW_CHILDREN_no Attributes: [] + +## i) Test that yaml2obj emits an error message when there are non-empty compilation units +## and multiple abbrev tables are assigned the same ID. + +## RUN: not yaml2obj --docnum=9 %s 2>&1 | FileCheck %s --check-prefix=ID-COLLISION + +# ID-COLLISION: yaml2obj: error: the ID (1) of abbrev table with index 1 has been used by abbrev table with index 0 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machi
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing added inline comments. Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:34 +private: + Data &DWARF; + std::map AbbrevID2Index; jhenderson wrote: > Higuoxing wrote: > > labath wrote: > > > jhenderson wrote: > > > > Would it make any sense to merge the `DWARFYAML::Data` class and > > > > `DWARFYAML::DWARFState` class at all? > > > That would definitely be nice. > > >>! @jhenderson : > > > Would it make any sense to merge the `DWARFYAML::Data` class and > > > `DWARFYAML::DWARFState` class at all? > > > > >>! @labath : > > > That would definitely be nice. > > > > I think they can be merged. But is there any particular reason to merge > > them? Personally, I would like to keep the `DWARFYAML::DWARFState` class. > > Here are a few concerns I would like to address: > > > > - If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we > > will need to add some helper variables, e.g. `AbbrevTableID2Index` and a > > method like `Error DWARFYAML::link()` to `DWARFYAML::Data` class to link > > DWARF sections. We will have to call this special method before DWARF > > sections being emitted. If we port DWARF support to other binary format in > > the future, e.g., wasm, we might forget to call this method. If we make > > DWARF emitters accept `DWARFYAML::DWARFState`, it's easy to figure out that > > we need a `DWARFState` before emitting DWARF sections. > > > > - Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have > > different functions. `DWARFYAML::Data` is used to contain original DWARF > > section descriptions and `DWARFYAML::DWARFState` contains helper structs > > and methods which helps link DWARF sections. It might be good not to merge > > them so that we can easily figure out when and where are those sections get > > linked? > > > > I can be persuaded :-) > > I think they can be merged. But is there any particular reason to merge > > them? > As things stand, it mostly seems like `DWARFState` merely gets in the way of > accessing the `Data` class. It seems to me like it would be easier to use if > the two were one class, as you wouldn't have to keep going through an extra > function call/member access. > > > > - If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we > > will need to add some helper variables, e.g. `AbbrevTableID2Index` and a > > method like `Error DWARFYAML::link()` to `DWARFYAML::Data` class to link > > DWARF sections. We will have to call this special method before DWARF > > sections being emitted. If we port DWARF support to other binary format in > > the future, e.g., wasm, we might forget to call this method. If we make > > DWARF emitters accept `DWARFYAML::DWARFState`, it's easy to figure out that > > we need a `DWARFState` before emitting DWARF sections. > If, rather than do all the calculations up front (e.g. mapping tables to > IDs), you put the `Data` members behind getters, you could then add the > "linking" code there. For example, with the AbbrevTable ID mapping, you could > have the `getAbbrevTableIndexByID` method, which is the only way of getting > an abbrev table from outside the class. The first time this is called (or > optionally every time), it works out the mapping between ID(s) and table(s). > This avoids the need for an explicit `link` or `finalize` method. > > > - Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have > > different functions. `DWARFYAML::Data` is used to contain original DWARF > > section descriptions and `DWARFYAML::DWARFState` contains helper structs > > and methods which helps link DWARF sections. It might be good not to merge > > them so that we can easily figure out when and where are those sections get > > linked? > I'm not sure I agree they have different functions. The `AbbrevID2Index` map > is just a helper variable that is directly derived from the `Data` struct's > members. We could get rid of it entirely, and just move the > `getAbbrevTableIndexByID` method into `Data`, rewriting it to just run > through the list of tables each time to find the right ID. This is obviously > less efficient than instantiating a mapping up front, if done repeatedly, but > I think it indicates that this extra layer is not actually doing anything > distinct. Similar principles apply probably for other things, although > without further concrete examples, it's hard to discuss them! Thanks for the explanation! Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:89 +DWARFYAML::DWARFState::DWARFState(DWARFYAML::Data &DI, Error &Err) : DWARF(DI) { + ErrorAsOutParameter EAO(&Err); + labath wrote: > If you'd do all this work in the factory function and then just pass in a > finished map to the constructor, there'd be no need for the > `ErrorAsOutParameter` thingy. `DWARFYAML::DWARFState` is merged into `DWARFYAML::Data`, so we don't need `ErrorAsOutParameter` any more.
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing added inline comments. Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml:426 #CHECK: Form:DW_FORM_ref4 + + I will remove this blank line later. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
jhenderson added a comment. I'm not sure if my test comments have been looked at. Could you mark them as Done if you think you have addressed them, please? Comment at: llvm/include/llvm/ObjectYAML/DWARFYAML.h:234-237 + Expected getAbbrevTableIndexByID(uint64_t ID); + +private: + std::unordered_map AbbrevTableID2Index; Something to consider here: the user-visible behaviour of this class is that this is a `const` operation, but because this method causes `AbbrevTableID2Index` to be populated on the first call, it technically isn't. I would say this is a reasonable use case for `mutable` - the cache (in this case `AbbrevTableID2Index`) is marked as mutable, and then you can continue to pass this class around as `const`. Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:92 + for (uint64_t I = 0; I < DI.DebugAbbrev.size(); ++I) { +// If the abbrev table's ID isn't specified, we use the index as its ID. +uint64_t ID = I; Higuoxing wrote: > jhenderson wrote: > > Maybe to avoid weird errors, it might make sense to disallow mixing the two > > methods, i.e. if one table has an explicit ID, the others all must do too. > > What do you think? It may not be worth it if the code is more complex, I > > don't know. > I think it's a little bit difficult to distinguish these 2 situations. > Besides, sometimes we might want to add one compilation unit to a test case > and let it reference an existing abbrev table. We don't need to mutate the > whole test case to add IDs. What do think of it? Leave it as is. I wasn't convinced by my own statement, so I think what you've got is fine. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing added inline comments. Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:306-313 + Optional AbbrevTableIndex = + DS.getAbbrevTableIndexByID(AbbrevTableID); + if (!AbbrevTableIndex) +return createStringError(errc::invalid_argument, + "cannot find abbrev table whose ID is " + + utostr(AbbrevTableID)); + ArrayRef AbbrevDecls( jhenderson wrote: > It might make more sense to do this work in the caller of this function, and > to maintain this function's interface. This is discussed in [D86194](https://reviews.llvm.org/D86194#inline-796173) Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:679-681 +## c) Test that yaml2obj is able to generate compilation units according to the +## associated abbrev table that is referenced by the 'AbbrevTableID' and obj2yaml +## is able to convert it back. jhenderson wrote: > Is there any particular reason you don't have something equivalent to this in > the ELF testing, to show you can have tables out-of-order etc. Added in test/tools/yaml2obj/ELF/DWARF/debug-info.yaml (o) Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:711 +# MULTI-TABLES-NEXT: Form: DW_FORM_udata +# MULTI-TABLES-NEXT: debug_info: +# MULTI-TABLES-NEXT: - Length:0x000C jhenderson wrote: > Something's not right here - the YAML below has four debug_info tables, but > only three have check lines. What happened to the one that should be > referencing abbrev table 2? Sorry, the length and offsets are calculated by myself, and the __debug_info section's length is miscalculated to be 60, which should be 67. I've corrected it. Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml:658 + +# NOTABLE: yaml2obj: error: abbrev table index must be less than or equal to the number of abbrev tables + jhenderson wrote: > Perhaps worth including the index and table count values in this error > message to make it easier for people to identify the problem. I've included the abbrev table ID and compilation unit count values in test case (n). Can we prettify the error message in test case (i) in a follow-up patch? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing updated this revision to Diff 286780. Higuoxing marked 11 inline comments as done. Higuoxing added a comment. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 Files: llvm/include/llvm/ObjectYAML/DWARFYAML.h llvm/lib/ObjectYAML/DWARFEmitter.cpp llvm/lib/ObjectYAML/DWARFYAML.cpp llvm/lib/ObjectYAML/ELFEmitter.cpp llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml llvm/tools/obj2yaml/dwarf2yaml.cpp llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp === --- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -2487,6 +2487,7 @@ - Value: 0x - Length: 16 Version: 4 +AbbrevTableID: 0 AbbrOffset: 0 AddrSize:8 Entries: Index: llvm/tools/obj2yaml/dwarf2yaml.cpp === --- llvm/tools/obj2yaml/dwarf2yaml.cpp +++ llvm/tools/obj2yaml/dwarf2yaml.cpp @@ -23,6 +23,7 @@ void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) { auto AbbrevSetPtr = DCtx.getDebugAbbrev(); if (AbbrevSetPtr) { +uint64_t AbbrevTableID = 0; for (auto AbbrvDeclSet : *AbbrevSetPtr) { Y.DebugAbbrev.emplace_back(); for (auto AbbrvDecl : AbbrvDeclSet.second) { @@ -39,6 +40,7 @@ AttAbrv.Value = Attribute.getImplicitConstValue(); Abbrv.Attributes.push_back(AttAbrv); } +Y.DebugAbbrev.back().ID = AbbrevTableID++; Y.DebugAbbrev.back().Table.push_back(Abbrv); } } @@ -172,6 +174,14 @@ NewUnit.Version = CU->getVersion(); if (NewUnit.Version >= 5) NewUnit.Type = (dwarf::UnitType)CU->getUnitType(); +const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev(); +NewUnit.AbbrevTableID = std::distance( +DebugAbbrev->begin(), +std::find_if( +DebugAbbrev->begin(), DebugAbbrev->end(), +[&](const std::pair &P) { + return P.first == CU->getAbbreviations()->getOffset(); +})); NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset(); NewUnit.AddrSize = CU->getAddressByteSize(); for (auto DIE : CU->dies()) { Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml === --- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml +++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml @@ -207,11 +207,12 @@ - Attribute: 0x01 Form: DW_FORM_addrx4 ## 0x2c debug_info: -- Length: 0x1234 - Version:5 - UnitType: DW_UT_type - AbbrOffset: 0x1234 - AddrSize: 4 +- Length:0x1234 + Version: 5 + UnitType: DW_UT_type + AbbrevTableID: 0 + AbbrOffset:0x1234 + AddrSize: 4 Entries: - AbbrCode: 1 Values: @@ -272,6 +273,7 @@ Version: 5 ## Test another unit type. UnitType: DW_UT_compile + AbbrevTableID: 0 AbbrOffset:0x1234 AddrSize: 4 Entries: @@ -280,6 +282,7 @@ - Length:0x5678 ## Test DWARFv4 Version: 4 + AbbrevTableID: 0 AbbrOffset:0x5678 AddrSize: 4 Entries: @@ -901,7 +904,7 @@ ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV -# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table +# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0 --- !ELF FileHeader: @@ -917,3 +920,102 @@ - AbbrCode: 1 Values: - Value: 0x1234 + +## o) Test that yaml2obj is able to generate compilation units according to the +## associated abbrev table that is referenced by the 'AbbrevTableID'. + +# RUN: yaml2obj --docnum=17 %s -o %t17.o +# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES + +# MULTI-TABLES: Hex dump of section '.debug_info': +# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4... +## ^---unit_length (4-byte) +## ^--- version (2-byte) +## ^ debug_abbrev_offset (4-byte) +##^-
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
jhenderson accepted this revision. jhenderson added a comment. This revision is now accepted and ready to land. LGTM. Thanks! Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml:658 + +# NOTABLE: yaml2obj: error: abbrev table index must be less than or equal to the number of abbrev tables + Higuoxing wrote: > jhenderson wrote: > > Perhaps worth including the index and table count values in this error > > message to make it easier for people to identify the problem. > I've included the abbrev table ID and compilation unit count values in test > case (n). Can we prettify the error message in test case (i) in a follow-up > patch? That's fine. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
labath added a comment. This has been a feature we've been missing for a while. Thanks for implementing it. Just two quick requests on the implementation. Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:171-174 + // This code carefully duplicates how the hash was created in Breakpad + // sources, including the error where it might has an extra 15 bytes past the + // end of the .text section if the .text section is less than a page size in + // length. Running off of the end of data buffer in this way seems dangerous. I get that we actually want to replicate running off of the end of the section, but we should do it in a way that won't light up on any sanitizer. It seems like it should be possible to fetch the desired data via something like this: ``` size_t size_to_read = std::min(llvm::alignTo(sect_sp->GetFileSize(), kMDGUIDSize), kBreakpadPageSize) /*or something similar*/; sect_sp->GetObjectFile()->GetData(sect_sp->GetFileOffset(), size_to_read, data); ``` Comment at: lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad.yaml:15 +AddressAlign:0x0004 +Content: 040014000300474E5500 I guess this should include a custom `Fill` pseudo-section so that we can guarantee the contents of whatever comes after it. Otherwise, yaml2obj might decide to place anything (or nothing) there. Something like this ought to do it: ``` - Type: Fill Pattern: "DEADBEEF" Size: 0xsomething ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
labath added a subscriber: markmentovai. labath added a comment. Also, +@markmentovai, in case he has any thoughts on this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9109311 - [lldb] Forcefully complete a type when adding typedefs
Author: Pavel Labath Date: 2020-08-20T15:19:10+02:00 New Revision: 9109311356cc9e74818dd7450020d9b85d2f8125 URL: https://github.com/llvm/llvm-project/commit/9109311356cc9e74818dd7450020d9b85d2f8125 DIFF: https://github.com/llvm/llvm-project/commit/9109311356cc9e74818dd7450020d9b85d2f8125.diff LOG: [lldb] Forcefully complete a type when adding typedefs This is very similar to D85968, only more elusive to since we were not adding the typedef type to the relevant DeclContext until D86140, which meant that the DeclContext was populated (and the relevant assertion hit) only after importing the type into the expression ast in a particular way. I haven't checked whether this situation can be hit in the gmodules case, but my money is on "yes". Differential Revision: https://reviews.llvm.org/D86216 Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index 486945ccbb8b..2fee87d98da8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -556,42 +556,51 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc, TypeSP type_sp; CompilerType clang_type; - if (tag == DW_TAG_typedef && attrs.type.IsValid()) { -// Try to parse a typedef from the (DWARF embedded in the) Clang -// module file first as modules can contain typedef'ed -// structures that have no names like: -// -// typedef struct { int a; } Foo; -// -// In this case we will have a structure with no name and a -// typedef named "Foo" that points to this unnamed -// structure. The name in the typedef is the only identifier for -// the struct, so always try to get typedefs from Clang modules -// if possible. -// -// The type_sp returned will be empty if the typedef doesn't -// exist in a module file, so it is cheap to call this function -// just to check. -// -// If we don't do this we end up creating a TypeSP that says -// this is a typedef to type 0x123 (the DW_AT_type value would -// be 0x123 in the DW_TAG_typedef), and this is the unnamed -// structure type. We will have a hard time tracking down an -// unnammed structure type in the module debug info, so we make -// sure we don't get into this situation by always resolving -// typedefs from the module. -const DWARFDIE encoding_die = attrs.type.Reference(); - -// First make sure that the die that this is typedef'ed to _is_ -// just a declaration (DW_AT_declaration == 1), not a full -// definition since template types can't be represented in -// modules since only concrete instances of templates are ever -// emitted and modules won't contain those -if (encoding_die && -encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) { - type_sp = ParseTypeFromClangModule(sc, die, log); - if (type_sp) -return type_sp; + if (tag == DW_TAG_typedef) { +// DeclContext will be populated when the clang type is materialized in +// Type::ResolveCompilerType. +PrepareContextToReceiveMembers( +m_ast, GetClangASTImporter(), +GetClangDeclContextContainingDIE(die, nullptr), die, +attrs.name.GetCString()); + +if (attrs.type.IsValid()) { + // Try to parse a typedef from the (DWARF embedded in the) Clang + // module file first as modules can contain typedef'ed + // structures that have no names like: + // + // typedef struct { int a; } Foo; + // + // In this case we will have a structure with no name and a + // typedef named "Foo" that points to this unnamed + // structure. The name in the typedef is the only identifier for + // the struct, so always try to get typedefs from Clang modules + // if possible. + // + // The type_sp returned will be empty if the typedef doesn't + // exist in a module file, so it is cheap to call this function + // just to check. + // + // If we don't do this we end up creating a TypeSP that says + // this is a typedef to type 0x123 (the DW_AT_type value would + // be 0x123 in the DW_TAG_typedef), and this is the unnamed + // structure type. We will have a hard time tracking down an + // unnammed structure type in the module debug info, so we make + // sure we don't get into this situation by always resolving + // typedefs from the module. + const DWARFDIE encoding_die = attrs.type.Reference(); + + // First make sure that the die that this is typedef'ed to _is_ + // just a declaration (DW_AT_declaration == 1), not a full +
[Lldb-commits] [PATCH] D86216: [lldb] Forcefully complete a type when adding typedefs
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG9109311356cc: [lldb] Forcefully complete a type when adding typedefs (authored by labath). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86216/new/ https://reviews.llvm.org/D86216 Files: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s === --- lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s +++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s @@ -28,6 +28,13 @@ # CHECK-LABEL: expr b1 # CHECK: (B::B1) $0 = (ptr = 0xbaadf00d) +target var c1 +# CHECK-LABEL: target var c1 +# CHECK: (C::C1) c1 = 424742 + +expr c1 +# CHECK-LABEL: expr c1 +# CHECK: (C::C1) $1 = 424742 #--- asm .text _ZN1AC2Ev: @@ -42,6 +49,8 @@ b1: .quad 0xbaadf00d +c1: +.long 42474247 .section.debug_abbrev,"",@progbits .byte 1 # Abbreviation Code @@ -118,6 +127,17 @@ .byte 19 # DW_FORM_ref4 .byte 0 # EOM(1) .byte 0 # EOM(2) +.byte 9 # Abbreviation Code +.byte 36 # DW_TAG_base_type +.byte 0 # DW_CHILDREN_no +.byte 3 # DW_AT_name +.byte 8 # DW_FORM_string +.byte 62 # DW_AT_encoding +.byte 11 # DW_FORM_data1 +.byte 11 # DW_AT_byte_size +.byte 11 # DW_FORM_data1 +.byte 0 # EOM(1) +.byte 0 # EOM(2) .byte 10 # Abbreviation Code .byte 46 # DW_TAG_subprogram .byte 1 # DW_CHILDREN_yes @@ -146,6 +166,15 @@ .byte 25 # DW_FORM_flag_present .byte 0 # EOM(1) .byte 0 # EOM(2) +.byte 12 # Abbreviation Code +.byte 22 # DW_TAG_typedef +.byte 0 # DW_CHILDREN_no +.byte 73 # DW_AT_type +.byte 19 # DW_FORM_ref4 +.byte 3 # DW_AT_name +.byte 8 # DW_FORM_string +.byte 0 # EOM(1) +.byte 0 # EOM(2) .byte 0 # EOM(3) .section.debug_info,"",@progbits .Lcu_begin0: @@ -222,7 +251,6 @@ .LB1: .byte 6 # Abbrev [6] DW_TAG_class_type .asciz "B1"# DW_AT_name -# DW_AT_declaration .byte 7 # Abbrev [5] 0x58:0xc DW_TAG_member .asciz "ptr" # DW_AT_name .long .LAptr # DW_AT_type @@ -237,5 +265,33 @@ .byte 3 .quad b1 +# Case 3: A typedef in DW_AT_declaration struct. +# C++ equivalent: +# struct C { +# virtual ~C(); // not defined here +# typedef int C1; +# }; +# C::C1 c1; +.Lint: +.byte 9 # Abbrev [9] DW_TAG_base_type +.asciz "int" # DW_AT_name +.byte 5 # DW_AT_encoding +.byte 4 # DW_AT_byte_size +.byte 3 # Abbrev [3] DW_TAG_structure_type +.asciz "C" # DW_AT_name +# DW_AT_declaration +.LC1: +.byte 12 # Abbrev [12] DW_TAG_typedef +.long .Lint-.Lcu_begin0 # DW_AT_type +.asciz "C1"# DW_AT_name +.byte 0 # End Of Children Mark + +.byte 2 # Abbrev [2] DW_TAG_variable +.asciz "c1"# DW_AT_name +.long .LC1-.Lcu_begin0# DW_AT_type +.byte 9
[Lldb-commits] [PATCH] D86220: [lldb/Utility] Simplify Scalar handling of float types
labath marked an inline comment as done. labath added inline comments. Comment at: lldb/source/Utility/Scalar.cpp:68 +Scalar::PromotionKey Scalar::GetFloatPromoKey(const llvm::fltSemantics &sem) { + static const llvm::fltSemantics *order[] = {&APFloat::IEEEsingle(), + &APFloat::IEEEdouble(), JDevlieghere wrote: > `std::array` or `ArrayRef` maybe? With a std::array, I'd have to explicitly specify the size, and I'm _really_ not sure what would happen with an ArrayRef (I think it would end up as a dangling pointer). Given that it has just one usage, I don't think this is an issue. Even with multiple usages, I think it'd be fine to declare the variable this way, but that have an accessor which would wrap it in an ArrayRef for easier manipulation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86220/new/ https://reviews.llvm.org/D86220 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 8a8a2dd - [lldb/Utility] Simplify Scalar handling of float types
Author: Pavel Labath Date: 2020-08-20T16:26:02+02:00 New Revision: 8a8a2dd3165e63b29e725526745427c6434f0654 URL: https://github.com/llvm/llvm-project/commit/8a8a2dd3165e63b29e725526745427c6434f0654 DIFF: https://github.com/llvm/llvm-project/commit/8a8a2dd3165e63b29e725526745427c6434f0654.diff LOG: [lldb/Utility] Simplify Scalar handling of float types Similarly to D85836, collapse all Scalar float types to a single enum value, and use APFloat semantics to differentiate between. This simplifies the code, and opens to door to supporting other floating point semantics (which would be needed for fully supporting architectures with more interesting float types such as PPC). Differential Revision: https://reviews.llvm.org/D86220 Added: Modified: lldb/include/lldb/Utility/Scalar.h lldb/source/Utility/Scalar.cpp lldb/unittests/Utility/ScalarTest.cpp Removed: diff --git a/lldb/include/lldb/Utility/Scalar.h b/lldb/include/lldb/Utility/Scalar.h index d1e0fdd888df..4e0505e669dd 100644 --- a/lldb/include/lldb/Utility/Scalar.h +++ b/lldb/include/lldb/Utility/Scalar.h @@ -45,8 +45,6 @@ class Scalar { e_sint, e_uint, e_float, -e_double, -e_long_double }; // Constructors and Destructors @@ -70,8 +68,8 @@ class Scalar { : m_type(e_uint), m_integer(sizeof(v) * 8, uint64_t(v), false), m_float(0.0f) {} Scalar(float v) : m_type(e_float), m_float(v) {} - Scalar(double v) : m_type(e_double), m_float(v) {} - Scalar(long double v) : m_type(e_long_double), m_float(double(v)) { + Scalar(double v) : m_type(e_float), m_float(v) {} + Scalar(long double v) : m_type(e_float), m_float(double(v)) { bool ignore; m_float.convert(llvm::APFloat::x87DoubleExtended(), llvm::APFloat::rmNearestTiesToEven, &ignore); @@ -114,15 +112,13 @@ class Scalar { void GetValue(Stream *s, bool show_type) const; - bool IsValid() const { -return (m_type >= e_sint) && (m_type <= e_long_double); - } + bool IsValid() const { return (m_type >= e_sint) && (m_type <= e_float); } /// Convert to an integer with \p bits and the given signedness. void TruncOrExtendTo(uint16_t bits, bool sign); bool IntegralPromote(uint16_t bits, bool sign); - bool FloatPromote(Scalar::Type type); + bool FloatPromote(const llvm::fltSemantics &semantics); bool MakeSigned(); @@ -136,8 +132,6 @@ class Scalar { static Scalar::Type GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size); - static Scalar::Type GetValueTypeForFloatWithByteSize(size_t byte_size); - // All operators can benefits from the implicit conversions that will happen // automagically by the compiler, so no temporary objects will need to be // created. As a result, we currently don't need a variety of overloaded set @@ -257,8 +251,13 @@ class Scalar { static Type PromoteToMaxType(Scalar &lhs, Scalar &rhs); - using IntPromotionKey = std::pair; - IntPromotionKey GetIntKey() const; + enum class Category { Void, Integral, Float }; + static Category GetCategory(Scalar::Type type); + + using PromotionKey = std::tuple; + PromotionKey GetPromoKey() const; + + static PromotionKey GetFloatPromoKey(const llvm::fltSemantics &semantics); private: friend const Scalar operator+(const Scalar &lhs, const Scalar &rhs); diff --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp index 32082b50eaa8..1a27808068d6 100644 --- a/lldb/source/Utility/Scalar.cpp +++ b/lldb/source/Utility/Scalar.cpp @@ -26,17 +26,11 @@ using namespace lldb_private; using llvm::APFloat; using llvm::APInt; -namespace { -enum class Category { Void, Integral, Float }; -} - -static Category GetCategory(Scalar::Type type) { +Scalar::Category Scalar::GetCategory(Scalar::Type type) { switch (type) { case Scalar::e_void: return Category::Void; case Scalar::e_float: - case Scalar::e_double: - case Scalar::e_long_double: return Category::Float; case Scalar::e_sint: case Scalar::e_uint: @@ -52,49 +46,62 @@ static bool IsSigned(Scalar::Type type) { return false; case Scalar::e_sint: case Scalar::e_float: - case Scalar::e_double: - case Scalar::e_long_double: return true; } llvm_unreachable("Unhandled type!"); } -Scalar::IntPromotionKey Scalar::GetIntKey() const { - assert(GetCategory(GetType()) == Category::Integral); - return {m_integer.getBitWidth(), !IsSigned(m_type)}; +Scalar::PromotionKey Scalar::GetPromoKey() const { + Category cat = GetCategory(m_type); + switch (cat) { + case Category::Void: +return {cat, 0, false}; + case Category::Integral: +return {cat, m_integer.getBitWidth(), !IsSigned(m_type)}; + case Category::Float: +return GetFloatPromoKey(m_float.getSemantics()); + } + llvm_unreachable("Unhandled category!"); +} + +Scalar::PromotionKey Scalar::GetFloatPromoKey(const llvm::fltSemantics &sem)
[Lldb-commits] [PATCH] D86220: [lldb/Utility] Simplify Scalar handling of float types
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. labath marked an inline comment as done. Closed by commit rG8a8a2dd3165e: [lldb/Utility] Simplify Scalar handling of float types (authored by labath). Changed prior to commit: https://reviews.llvm.org/D86220?vs=286567&id=286812#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86220/new/ https://reviews.llvm.org/D86220 Files: lldb/include/lldb/Utility/Scalar.h lldb/source/Utility/Scalar.cpp lldb/unittests/Utility/ScalarTest.cpp Index: lldb/unittests/Utility/ScalarTest.cpp === --- lldb/unittests/Utility/ScalarTest.cpp +++ lldb/unittests/Utility/ScalarTest.cpp @@ -16,6 +16,7 @@ #include "llvm/Testing/Support/Error.h" using namespace lldb_private; +using llvm::APFloat; using llvm::APInt; using llvm::Failed; using llvm::Succeeded; @@ -304,12 +305,12 @@ EXPECT_FALSE(a.IntegralPromote(64, true)); - EXPECT_TRUE(a.FloatPromote(Scalar::e_double)); - EXPECT_EQ(Scalar::e_double, a.GetType()); + EXPECT_TRUE(a.FloatPromote(APFloat::IEEEdouble())); + EXPECT_EQ(Scalar::e_float, a.GetType()); EXPECT_EQ(47.0, a.Double()); - EXPECT_FALSE(a.FloatPromote(Scalar::e_float)); - EXPECT_TRUE(a.FloatPromote(Scalar::e_long_double)); + EXPECT_FALSE(a.FloatPromote(APFloat::IEEEsingle())); + EXPECT_TRUE(a.FloatPromote(APFloat::x87DoubleExtended())); EXPECT_EQ(47.0L, a.LongDouble()); } Index: lldb/source/Utility/Scalar.cpp === --- lldb/source/Utility/Scalar.cpp +++ lldb/source/Utility/Scalar.cpp @@ -26,17 +26,11 @@ using llvm::APFloat; using llvm::APInt; -namespace { -enum class Category { Void, Integral, Float }; -} - -static Category GetCategory(Scalar::Type type) { +Scalar::Category Scalar::GetCategory(Scalar::Type type) { switch (type) { case Scalar::e_void: return Category::Void; case Scalar::e_float: - case Scalar::e_double: - case Scalar::e_long_double: return Category::Float; case Scalar::e_sint: case Scalar::e_uint: @@ -52,49 +46,62 @@ return false; case Scalar::e_sint: case Scalar::e_float: - case Scalar::e_double: - case Scalar::e_long_double: return true; } llvm_unreachable("Unhandled type!"); } -Scalar::IntPromotionKey Scalar::GetIntKey() const { - assert(GetCategory(GetType()) == Category::Integral); - return {m_integer.getBitWidth(), !IsSigned(m_type)}; +Scalar::PromotionKey Scalar::GetPromoKey() const { + Category cat = GetCategory(m_type); + switch (cat) { + case Category::Void: +return {cat, 0, false}; + case Category::Integral: +return {cat, m_integer.getBitWidth(), !IsSigned(m_type)}; + case Category::Float: +return GetFloatPromoKey(m_float.getSemantics()); + } + llvm_unreachable("Unhandled category!"); +} + +Scalar::PromotionKey Scalar::GetFloatPromoKey(const llvm::fltSemantics &sem) { + static const llvm::fltSemantics *const order[] = { + &APFloat::IEEEsingle(), &APFloat::IEEEdouble(), + &APFloat::x87DoubleExtended()}; + for (const auto &entry : llvm::enumerate(order)) { +if (entry.value() == &sem) + return {Category::Float, entry.index(), false}; + } + llvm_unreachable("Unsupported semantics!"); } // Promote to max type currently follows the ANSI C rule for type promotion in // expressions. Scalar::Type Scalar::PromoteToMaxType(Scalar &lhs, Scalar &rhs) { const auto &Promote = [](Scalar &a, const Scalar &b) { -if (GetCategory(b.GetType()) == Category::Integral) +switch (GetCategory(b.GetType())) { +case Category::Void: + break; +case Category::Integral: a.IntegralPromote(b.UInt128(APInt()).getBitWidth(), IsSigned(b.GetType())); -else - a.FloatPromote(b.GetType()); + break; +case Category::Float: + a.FloatPromote(b.m_float.getSemantics()); +} }; - // Extract the types of both the right and left hand side values - Scalar::Type lhs_type = lhs.GetType(); - Scalar::Type rhs_type = rhs.GetType(); - - if (GetCategory(lhs_type) == Category::Integral && - GetCategory(rhs_type) == Category::Integral) { -IntPromotionKey lhs_key = lhs.GetIntKey(); -IntPromotionKey rhs_key = rhs.GetIntKey(); -if (lhs_key > rhs_key) - Promote(rhs, lhs); -else if (rhs_key > lhs_key) - Promote(lhs, rhs); - } else if (lhs_type > rhs_type) + PromotionKey lhs_key = lhs.GetPromoKey(); + PromotionKey rhs_key = rhs.GetPromoKey(); + + if (lhs_key > rhs_key) Promote(rhs, lhs); - else if (lhs_type < rhs_type) + else if (rhs_key > lhs_key) Promote(lhs, rhs); // Make sure our type promotion worked as expected - if (lhs.GetType() == rhs.GetType()) -return lhs.GetType(); // Return the resulting max type + if (lhs.GetPromoKey() == rhs.GetPromoKey()) +return
[Lldb-commits] [PATCH] D62732: [RISCV] Add SystemV ABI
simoncook updated this revision to Diff 286749. simoncook added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62732/new/ https://reviews.llvm.org/D62732 Files: lldb/include/lldb/Utility/ArchSpec.h lldb/source/Plugins/ABI/CMakeLists.txt lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.cpp lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h lldb/source/Plugins/ABI/RISCV/CMakeLists.txt lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/source/Target/Platform.cpp lldb/source/Utility/ArchSpec.cpp Index: lldb/source/Utility/ArchSpec.cpp === --- lldb/source/Utility/ArchSpec.cpp +++ lldb/source/Utility/ArchSpec.cpp @@ -212,6 +212,11 @@ {eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon, ArchSpec::eCore_hexagon_hexagonv5, "hexagonv5"}, +{eByteOrderLittle, 4, 2, 4, llvm::Triple::riscv32, + ArchSpec::eCore_riscv32, "riscv32"}, +{eByteOrderLittle, 8, 2, 4, llvm::Triple::riscv64, + ArchSpec::eCore_riscv64, "riscv64"}, + {eByteOrderLittle, 4, 4, 4, llvm::Triple::UnknownArch, ArchSpec::eCore_uknownMach32, "unknown-mach-32"}, {eByteOrderLittle, 8, 4, 4, llvm::Triple::UnknownArch, @@ -452,6 +457,10 @@ 0xu, 0xu}, // ARC {ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // AVR +{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE, + 0xu, 0xu}, // riscv32 +{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE, + 0xu, 0xu}, // riscv64 }; static const ArchDefinition g_elf_arch_def = { Index: lldb/source/Target/Platform.cpp === --- lldb/source/Target/Platform.cpp +++ lldb/source/Target/Platform.cpp @@ -1951,6 +1951,20 @@ trap_opcode_size = sizeof(g_i386_opcode); } break; + case llvm::Triple::riscv32: + case llvm::Triple::riscv64: { +static const uint8_t g_riscv_c_opcode[] = {0x02, 0x90}; // c_ebreak +static const uint8_t g_riscv_opcode[] = {0x73, 0x00, 0x10, 0x00}; // ebreak +if (arch.GetFlags() & ArchSpec::eRISCV_arch_c) { + trap_opcode = g_riscv_c_opcode; + trap_opcode_size = sizeof(g_riscv_c_opcode); +} else { + trap_opcode = g_riscv_opcode; + trap_opcode_size = sizeof(g_riscv_opcode); +} +break; + } + default: return 0; } Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1364,6 +1364,18 @@ arch_spec.SetFlags(ArchSpec::eARM_abi_hard_float); } + if (arch_spec.GetMachine() == llvm::Triple::riscv32 || + arch_spec.GetMachine() == llvm::Triple::riscv64) { +if (header.e_flags & llvm::ELF::EF_RISCV_RVC) + arch_spec.SetFlags(ArchSpec::eRISCV_arch_c); +if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI) == +llvm::ELF::EF_RISCV_FLOAT_ABI_SINGLE) + arch_spec.SetFlags(ArchSpec::eRISCV_abi_f); +if ((header.e_flags & llvm::ELF::EF_RISCV_FLOAT_ABI) == +llvm::ELF::EF_RISCV_FLOAT_ABI_DOUBLE) + arch_spec.SetFlags(ArchSpec::eRISCV_abi_d); + } + // If there are no section headers we are done. if (header.e_shnum == 0) return 0; Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp === --- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -1149,6 +1149,11 @@ cpu = "apple-latest"; } + // For RISC-V, enable all standard extensions so these can be disassembled. + if (triple.getArch() == llvm::Triple::riscv32 || + triple.getArch() == llvm::Triple::riscv64) +features_str += "+a,+c,+d,+f,+m"; + // We use m_disasm_up.get() to tell whether we are valid or not, so if this // isn't good for some reason, we won't be valid and FindPlugin will fail and // we won't get used. Index: lldb/source/Plugins/ABI/RISCV/CMakeLists.txt === --- /dev/null +++ lldb/source/Plugins/ABI/RISCV/CMakeLists.txt @@ -0,0 +1,10 @@ +add_lldb_library(lldbPluginABISysV_riscv PLUGIN + ABISysV_riscv.cpp + + LINK_LIBS +lldbCore +lldbSymbol +lldbTarget + LINK_COMPONENTS +Support + ) Index: lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h === --- /dev/null +++ lldb/source/Plugins/ABI/RISCV/ABISysV_riscv.h @@ -0,0 +1,116 @@ +//===-- ABISysV_riscv.h -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with
[Lldb-commits] [PATCH] D86292: [LLDB][RISCV] Distinguish between riscv32 and riscv64 based on ELF class
luismarques created this revision. luismarques added reviewers: asb, lenary, clayborg, jasonmolenda, simoncook. Herald added subscribers: lldb-commits, evandro, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, atanasyan, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, johnrusso, rbar, arichardson, sdardis, emaste. Herald added a reviewer: espindola. Herald added a project: LLDB. luismarques requested review of this revision. Herald added subscribers: JDevlieghere, MaskRay. LLDB was detecting riscv64 ELF files as riscv32. This patch fixes that issue. The patch follows the implementation approach previously used for MIPS. It defines RISC-V architecture subtypes and inspects the ELF header, namely the ELF class, to detect the right subtype. At the moment this is slightly silly, as the subtypes coincide with the architecture types (rv32 vs rv64), but given how the existing code was structured this seemed like a straightforward and future-proof solution. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D86292 Files: lldb/include/lldb/Utility/ArchSpec.h lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp lldb/source/Utility/ArchSpec.cpp lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml Index: lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml === --- /dev/null +++ lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml @@ -0,0 +1,11 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Architecture: riscv64-- + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_RISCV Index: lldb/source/Utility/ArchSpec.cpp === --- lldb/source/Utility/ArchSpec.cpp +++ lldb/source/Utility/ArchSpec.cpp @@ -457,10 +457,10 @@ 0xu, 0xu}, // ARC {ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // AVR -{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE, - 0xu, 0xu}, // riscv32 -{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE, - 0xu, 0xu}, // riscv64 +{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV, + ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32 +{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV, + ArchSpec::eRISCVSubType_riscv64, 0xu, 0xu}, // riscv64 }; static const ArchDefinition g_elf_arch_def = { Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -296,9 +296,23 @@ return arch_variant; } +static uint32_t riscvVariantFromElfFlags(const elf::ELFHeader &header) { + uint32_t fileclass = header.e_ident[EI_CLASS]; + switch (fileclass) { + case llvm::ELF::ELFCLASS32: +return ArchSpec::eRISCVSubType_riscv32; + case llvm::ELF::ELFCLASS64: +return ArchSpec::eRISCVSubType_riscv64; + default: +return ArchSpec::eRISCVSubType_unknown; + } +} + static uint32_t subTypeFromElfHeader(const elf::ELFHeader &header) { if (header.e_machine == llvm::ELF::EM_MIPS) return mipsVariantFromElfFlags(header); + else if (header.e_machine == llvm::ELF::EM_RISCV) +return riscvVariantFromElfFlags(header); return LLDB_INVALID_CPUTYPE; } Index: lldb/include/lldb/Utility/ArchSpec.h === --- lldb/include/lldb/Utility/ArchSpec.h +++ lldb/include/lldb/Utility/ArchSpec.h @@ -99,6 +99,12 @@ eRISCV_abi_d = 0x0020 }; + enum RISCVSubType { +eRISCVSubType_unknown, +eRISCVSubType_riscv32, +eRISCVSubType_riscv64, + }; + enum Core { eCore_arm_generic, eCore_arm_armv4, Index: lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml === --- /dev/null +++ lldb/test/Shell/ObjectFile/ELF/riscv64-arch.yaml @@ -0,0 +1,11 @@ +# RUN: yaml2obj %s > %t +# RUN: lldb-test object-file %t | FileCheck %s + +# CHECK: Architecture: riscv64-- + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_RISCV Index: lldb/source/Utility/ArchSpec.cpp === --- lldb/source/Utility/ArchSpec.cpp +++ lldb/source/Utility/ArchSpec.cpp @@ -457,10 +457,10 @@ 0xu, 0xu}, // ARC {ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE, 0xu, 0xu}, // AVR -{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV, LLDB_INVALID_CPUTYPE, - 0xu, 0x
[Lldb-commits] [lldb] 0de3d0c - [lldb][asan] Mark destructor as virtual to allow subclasses.
Author: Jordan Rupprecht Date: 2020-08-20T09:21:33-07:00 New Revision: 0de3d0c61266675cd5e688a09e02124518e01935 URL: https://github.com/llvm/llvm-project/commit/0de3d0c61266675cd5e688a09e02124518e01935 DIFF: https://github.com/llvm/llvm-project/commit/0de3d0c61266675cd5e688a09e02124518e01935.diff LOG: [lldb][asan] Mark destructor as virtual to allow subclasses. `lldb_private::ScriptInterpreterPython::CommandDataPython` inherits from `lldb_private::BreakpointOptions::CommandData`, but the latter does not have a virtual destructor. This leads to a new-delete-type-mismatch error when running certain tests (such as `functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py`) under asan. Added: Modified: lldb/include/lldb/Breakpoint/BreakpointOptions.h Removed: diff --git a/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h index 615b4eb77be4..85b8e025a8e5 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -51,7 +51,7 @@ friend class Breakpoint; : user_source(user_source), script_source(), interpreter(interp), stop_on_error(true) {} -~CommandData() = default; +virtual ~CommandData() = default; static const char *GetSerializationKey() { return "BKPTCMDData"; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86311: Fix how ValueObjectVariable handles DW_AT_const_value when the DWARFExpression holds the data that represents a constant value
shafik created this revision. shafik added reviewers: aprantl, friss, labath, jingham, vsk. shafik requested review of this revision. Herald added a reviewer: jdoerfert. Herald added a subscriber: sstefan1. In some cases when we have a `DW_AT_const_value` and the data can be found in the `DWARFExpression` then `ValueObjectVariable` does not handle it properly and we end up with an `extracting data from value failed` error: (lldb) target var constant (U) constant = { raw = = (a = , b = , c = , d = , e = , f = ) } This should fix that case. The test is a very stripped down assembly file since reproducing this relies on the results of compiling with `-O1` which may not be stable over time. https://reviews.llvm.org/D86311 Files: lldb/source/Core/ValueObjectVariable.cpp lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s === --- /dev/null +++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s @@ -0,0 +1,408 @@ +# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-apple-macosx10.15.0 %s +# RUN: %lldb %t -o "target variable constant" -b | FileCheck %s + +# CHECK: (lldb) target variable constant +# CHECK: (U) constant = { +# CHECK: raw = 1688469761 +# CHECK:= (a = 1, b = 1, c = 36, d = 2, e = 36, f = 1) +# CHECK: } + +# This is testing when how ValueObjectVariable handles the case where the +# DWARFExpression holds the data that represents a constant value. +# Compile at -O1 allows us to capture this case. Below is the code used +# to generate the assembly: +# +# typedef union +# { +# unsigned raw; +# struct +# { +# unsigned a : 8; +# unsigned b : 8; +# unsigned c : 6; +# unsigned d : 2; +# unsigned e : 6; +# unsigned f : 2; +# } ; +# } U; +# +# static U __attribute__((used)) _type_anchor; +# static const int constant = 0x64A40101; +# +# int g() { return constant; } +# +# int main() { +# U u; +# u.raw = 0x64A40101; +# } +# +# Compiled as follows: +# +# clang -gdwarf-4 -O1 dw_at_const_value_bug.c -S -o dw_at_const_value_bug.s +# +# I was able to obtain a global of type U with DW_AT_const_value but was able +# to using int. This required modifying the DW_AT_type of constant to be type +# U. After that stripping as much of the assembly as possible to give us a +# smaller reproducer. + + +.zerofill __DATA,__bss,__type_anchor,4,2 ## @_type_anchor + .no_dead_strip __type_anchor + .section __DWARF,__debug_str,regular,debug +Linfo_string: + .zero 90 + .asciz "constant" ## string offset=90 + .asciz "int" ## string offset=99 + .asciz "_type_anchor" ## string offset=103 + .asciz "U" ## string offset=116 + .asciz "raw" ## string offset=118 + .asciz "unsigned int" ## string offset=122 + .asciz "a" ## string offset=135 + .asciz "b" ## string offset=137 + .asciz "c" ## string offset=139 + .asciz "d" ## string offset=141 + .asciz "e" ## string offset=143 + .asciz "f" ## string offset=145 + .asciz "g" ## string offset=147 + .asciz "main" ## string offset=149 + .asciz "u" ## string offset=154 + .section __DWARF,__debug_abbrev,regular,debug +Lsection_abbrev: + .byte 1 ## Abbreviation Code + .byte 17 ## DW_TAG_compile_unit + .byte 1 ## DW_CHILDREN_yes + .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 66 ## DW_AT_stmt_list + .byte 23 ## DW_FORM_sec_offset + .byte 27 ## DW_AT_comp_dir + .byte 14 ## DW_FORM_strp + .ascii "\264B" ## DW_AT_GNU_pubnames + .byte 25 ## DW_FORM_flag_present + .ascii "\341\177" ## DW_AT_APPLE_optimized + .byte 25 ## DW_FORM_flag_present + .byte 17 ## DW_AT_low_pc + .byte 1 ## DW_FORM_addr + .byte 18 ## DW_AT_high_pc + .byte 6 ## DW_FORM_data4 + .byte 0 ## EOM(1) + .byte 0 ## EOM(2) + .byte 2 ## Abbreviation Code + .byte 52 ## DW_TAG_variable + .byte 0 ## DW_CHILDREN_no + .byte 3 ## DW_AT_name + .byte 14 ## DW_FORM_strp + .byte 73 ## DW_AT_type + .byte 19 ## DW_FORM_ref4 + .byte 58 ## DW_AT_decl_fi
[Lldb-commits] [lldb] 22e63cb - [lldb] tab completion for breakpoint names
Author: Gongyu Deng Date: 2020-08-20T20:56:34+02:00 New Revision: 22e63cba17e5e6266b9251e3fb7032b793143d09 URL: https://github.com/llvm/llvm-project/commit/22e63cba17e5e6266b9251e3fb7032b793143d09 DIFF: https://github.com/llvm/llvm-project/commit/22e63cba17e5e6266b9251e3fb7032b793143d09.diff LOG: [lldb] tab completion for breakpoint names 1. created a common completion for breakpoint names; 2. bound the breakpoint name common completion with eArgTypeBreakpointName; 3. implemented the dedicated completion for breakpoint read -N. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D80693 Added: lldb/test/API/functionalities/completion/breakpoints.json lldb/test/API/functionalities/completion/breakpoints_invalid.json Modified: lldb/include/lldb/Interpreter/CommandCompletions.h lldb/source/Commands/CommandCompletions.cpp lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Interpreter/CommandObject.cpp lldb/test/API/functionalities/completion/TestCompletion.py Removed: diff --git a/lldb/include/lldb/Interpreter/CommandCompletions.h b/lldb/include/lldb/Interpreter/CommandCompletions.h index a744b3fd849d..1d8972e0ca03 100644 --- a/lldb/include/lldb/Interpreter/CommandCompletions.h +++ b/lldb/include/lldb/Interpreter/CommandCompletions.h @@ -44,10 +44,11 @@ class CommandCompletions { eStopHookIDCompletion = (1u << 16), eThreadIndexCompletion = (1u << 17), eWatchPointIDCompletion = (1u << 18), +eBreakpointNameCompletion = (1u << 19), // This item serves two purposes. It is the last element in the enum, so // you can add custom enums starting from here in your Option class. Also // if you & in this bit the base code will not process the option. -eCustomCompletion = (1u << 19) +eCustomCompletion = (1u << 20) }; static bool InvokeCommonCompletionCallbacks( @@ -101,6 +102,10 @@ class CommandCompletions { static void Breakpoints(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher); + static void BreakpointNames(CommandInterpreter &interpreter, + CompletionRequest &request, + SearchFilter *searcher); + static void ProcessPluginNames(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher); diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 4ed11e14b84f..109613e223c7 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -70,6 +70,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks( {eStopHookIDCompletion, CommandCompletions::StopHookIDs}, {eThreadIndexCompletion, CommandCompletions::ThreadIndexes}, {eWatchPointIDCompletion, CommandCompletions::WatchPointIDs}, + {eBreakpointNameCompletion, CommandCompletions::BreakpointNames}, {eNoCompletion, nullptr} // This one has to be last in the list. }; @@ -617,13 +618,26 @@ void CommandCompletions::Breakpoints(CommandInterpreter &interpreter, } } +void CommandCompletions::BreakpointNames(CommandInterpreter &interpreter, + CompletionRequest &request, + SearchFilter *searcher) { + lldb::TargetSP target = interpreter.GetDebugger().GetSelectedTarget(); + if (!target) +return; + + std::vector name_list; + target->GetBreakpointNames(name_list); + + for (const std::string &name : name_list) +request.TryCompleteCurrentArg(name); +} + void CommandCompletions::ProcessPluginNames(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher) { PluginManager::AutoCompleteProcessName(request.GetCursorArgumentPrefix(), request); } - void CommandCompletions::DisassemblyFlavors(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher) { diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index b62fe6c93cd8..023ba208176a 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -2097,7 +2097,79 @@ class CommandObjectBreakpointRead : public CommandObjectParsed { return llvm::makeArrayRef(g_breakpoint_read_options); } -// Instance variables to hold the values for command options. +void HandleOptionArgumentCompletion( +CompletionRequest &request, OptionElementVector &opt_element_vector, +
[Lldb-commits] [PATCH] D80693: [lldb] tab completion for breakpoint names
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 rG22e63cba17e5: [lldb] tab completion for breakpoint names (authored by MrHate, committed by teemperor). Herald added a subscriber: lldb-commits. Changed prior to commit: https://reviews.llvm.org/D80693?vs=276295&id=286870#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80693/new/ https://reviews.llvm.org/D80693 Files: lldb/include/lldb/Interpreter/CommandCompletions.h lldb/source/Commands/CommandCompletions.cpp lldb/source/Commands/CommandObjectBreakpoint.cpp lldb/source/Interpreter/CommandObject.cpp lldb/test/API/functionalities/completion/TestCompletion.py lldb/test/API/functionalities/completion/breakpoints.json lldb/test/API/functionalities/completion/breakpoints_invalid.json Index: lldb/test/API/functionalities/completion/breakpoints_invalid.json === --- /dev/null +++ lldb/test/API/functionalities/completion/breakpoints_invalid.json @@ -0,0 +1,6 @@ +[ +{ +"Breakpoint": { +} +} +] Index: lldb/test/API/functionalities/completion/breakpoints.json === --- /dev/null +++ lldb/test/API/functionalities/completion/breakpoints.json @@ -0,0 +1,34 @@ +[ +{ +"Breakpoint": { +"BKPTOptions": { +"AutoContinue": false, +"ConditionText": "", +"EnabledState": true, +"IgnoreCount": 0, +"OneShotState": false +}, +"BKPTResolver": { +"Options": { +"NameMask": [ +56 +], +"Offset": 0, +"SkipPrologue": true, +"SymbolNames": [ +"main" +] +}, +"Type": "SymbolName" +}, +"Hardware": false, +"Names": [ +"mm" +], +"SearchFilter": { +"Options": {}, +"Type": "Unconstrained" +} +} +} +] Index: lldb/test/API/functionalities/completion/TestCompletion.py === --- lldb/test/API/functionalities/completion/TestCompletion.py +++ lldb/test/API/functionalities/completion/TestCompletion.py @@ -644,3 +644,21 @@ ['1', '2']) +def test_complete_breakpoint_with_names(self): +self.build() +target = self.dbg.CreateTarget(self.getBuildArtifact('a.out')) +self.assertTrue(target, VALID_TARGET) + +# test breakpoint read dedicated +self.complete_from_to('breakpoint read -N ', 'breakpoint read -N ') +self.complete_from_to('breakpoint read -f breakpoints.json -N ', ['mm']) +self.complete_from_to('breakpoint read -f breakpoints.json -N n', 'breakpoint read -f breakpoints.json -N n') +self.complete_from_to('breakpoint read -f breakpoints_invalid.json -N ', 'breakpoint read -f breakpoints_invalid.json -N ') + +# test common breapoint name completion +bp1 = target.BreakpointCreateByName('main', 'a.out') +self.assertTrue(bp1) +self.assertEqual(bp1.GetNumLocations(), 1) +self.complete_from_to('breakpoint set -N n', 'breakpoint set -N n') +self.assertTrue(bp1.AddNameWithErrorHandling("nn")) +self.complete_from_to('breakpoint set -N ', 'breakpoint set -N nn') Index: lldb/source/Interpreter/CommandObject.cpp === --- lldb/source/Interpreter/CommandObject.cpp +++ lldb/source/Interpreter/CommandObject.cpp @@ -1041,7 +1041,7 @@ { eArgTypeBoolean, "boolean", CommandCompletions::eNoCompletion, { nullptr, false }, "A Boolean value: 'true' or 'false'" }, { eArgTypeBreakpointID, "breakpt-id", CommandCompletions::eNoCompletion, { BreakpointIDHelpTextCallback, false }, nullptr }, { eArgTypeBreakpointIDRange, "breakpt-id-list", CommandCompletions::eNoCompletion, { BreakpointIDRangeHelpTextCallback, false }, nullptr }, -{ eArgTypeBreakpointName, "breakpoint-name", CommandCompletions::eNoCompletion, { BreakpointNameHelpTextCallback, false }, nullptr }, +{ eArgTypeBreakpointName, "breakpoint-name", CommandCompletions::eBreakpointNameCompletion, { BreakpointNameHelpTextCallback, false }, nullptr }, { eArgTypeByteSize, "byte-size", CommandCompletions::eNoCompletion, { nullptr, false }, "Number of bytes to use." }, { eArgTypeClassName, "class-name", CommandCompletions::eNoCompletion, { nullptr, false }, "Then name of a class from the debug information in the program." }, {
[Lldb-commits] [PATCH] D86311: Fix how ValueObjectVariable handles DW_AT_const_value when the DWARFExpression holds the data that represents a constant value
aprantl added a comment. The code looks fine, I think the test needs an extra REQUIRES. Comment at: lldb/source/Core/ValueObjectVariable.cpp:137 + if (m_data.GetDataStart() && m_data.GetByteSize()) +m_value.SetBytes(m_data.GetDataStart(), m_data.GetByteSize()); m_value.SetContext(Value::eContextTypeVariable, variable); I guess this looks reasonable. Comment at: lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s:2 +# RUN: llvm-mc -filetype=obj -o %t -triple x86_64-apple-macosx10.15.0 %s +# RUN: %lldb %t -o "target variable constant" -b | FileCheck %s + I think this is missing a REQUIRES: line that checks for an x86 target? Comment at: lldb/test/Shell/SymbolFile/DWARF/DW_AT_const_value.s:11 +# This is testing when how ValueObjectVariable handles the case where the +# DWARFExpression holds the data that represents a constant value. +# Compile at -O1 allows us to capture this case. Below is the code used This sentence is complicated to parse. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86311/new/ https://reviews.llvm.org/D86311 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal
aelitashen updated this revision to Diff 286885. aelitashen added a comment. @Walter Please help me fix the tests. Looks like in the new added runInTerminal tests, it cannot hit the breakpoint and capture the local variable. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84974/new/ https://reviews.llvm.org/D84974 Files: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py lldb/test/API/tools/lldb-vscode/runInTerminal/Makefile lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py lldb/test/API/tools/lldb-vscode/runInTerminal/main.c lldb/tools/lldb-vscode/VSCode.cpp lldb/tools/lldb-vscode/VSCode.h lldb/tools/lldb-vscode/lldb-vscode.cpp Index: lldb/tools/lldb-vscode/lldb-vscode.cpp === --- lldb/tools/lldb-vscode/lldb-vscode.cpp +++ lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -343,7 +343,7 @@ char buffer[1024]; size_t count; while ((count = process.GetSTDOUT(buffer, sizeof(buffer))) > 0) - g_vsc.SendOutput(OutputType::Stdout, llvm::StringRef(buffer, count)); +g_vsc.SendOutput(OutputType::Stdout, llvm::StringRef(buffer, count)); while ((count = process.GetSTDERR(buffer, sizeof(buffer))) > 0) g_vsc.SendOutput(OutputType::Stderr, llvm::StringRef(buffer, count)); } @@ -448,10 +448,10 @@ if (event_mask & lldb::SBTarget::eBroadcastBitModulesLoaded) { body.try_emplace("reason", "new"); } else if (event_mask & -lldb::SBTarget::eBroadcastBitModulesUnloaded) { + lldb::SBTarget::eBroadcastBitModulesUnloaded) { body.try_emplace("reason", "removed"); } else if (event_mask & -lldb::SBTarget::eBroadcastBitSymbolsLoaded) { + lldb::SBTarget::eBroadcastBitSymbolsLoaded) { body.try_emplace("reason", "changed"); } body.try_emplace("module", module_value); @@ -873,7 +873,9 @@ // "CompletionsRequest": { // "allOf": [ { "$ref": "#/definitions/Request" }, { // "type": "object", -// "description": "Returns a list of possible completions for a given caret position and text.\nThe CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true.", +// "description": "Returns a list of possible completions for a given caret +// position and text.\nThe CompletionsRequest may only be called if the +// 'supportsCompletionsRequest' capability exists and is true.", // "properties": { // "command": { // "type": "string", @@ -892,19 +894,23 @@ // "properties": { // "frameId": { // "type": "integer", -// "description": "Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope." +// "description": "Returns completions in the scope of this stack frame. +// If not specified, the completions are returned for the global scope." // }, // "text": { // "type": "string", -// "description": "One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion." +// "description": "One or more source lines. Typically this is the text a +// user has typed into the debug console before he asked for completion." // }, // "column": { // "type": "integer", -// "description": "The character position for which to determine the completion proposals." +// "description": "The character position for which to determine the +// completion proposals." // }, // "line": { // "type": "integer", -// "description": "An optional line for which to determine the completion proposals. If missing the first line of the text is assumed." +// "description": "An optional line for which to determine the completion +// proposals. If missing the first line of the text is assumed." // } // }, // "required": [ "text", "column" ] @@ -933,39 +939,51 @@ // }, // "CompletionItem": { // "type": "object", -// "description": "CompletionItems are the suggestions returned from the CompletionsRequest.", -// "properties": { +// "description": "CompletionItems are the suggestions returned from the +// CompletionsRequest.", "properties": { // "label": { // "type": "string", -// "description": "The label of this completion item. By default this is also the text that is inserted when selecting this completion." +// "description": "The label of this completion item. By default this is +// also the text that is inserted when selecting this completion." // }, // "text": { // "type": "string", -// "description": "If text is not falsy then it
[Lldb-commits] [PATCH] D84974: Enable Launching the Debugee in VSCode Terminal
wallace commandeered this revision. wallace edited reviewers, added: aelitashen; removed: wallace. wallace added a comment. We found a very strange issue with lldb not stopping at any breakpoint after attaching. I'll figure that out Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D84974/new/ https://reviews.llvm.org/D84974 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 921c1b7 - [lldb] Provide GetHomeDirectory wrapper in Host::FileSystem (NFC)
Author: Jonas Devlieghere Date: 2020-08-20T14:07:05-07:00 New Revision: 921c1b7df37d6f5353ed5fdffa117dcda0c941ba URL: https://github.com/llvm/llvm-project/commit/921c1b7df37d6f5353ed5fdffa117dcda0c941ba DIFF: https://github.com/llvm/llvm-project/commit/921c1b7df37d6f5353ed5fdffa117dcda0c941ba.diff LOG: [lldb] Provide GetHomeDirectory wrapper in Host::FileSystem (NFC) Provider a wrapper around llvm::sys::path::home_directory in the FileSystem class. This will make it possible for the reproducers to intercept the call in a central place. Added: Modified: lldb/include/lldb/Host/FileSystem.h lldb/source/API/SBHostOS.cpp lldb/source/Host/common/Editline.cpp lldb/source/Host/common/FileSystem.cpp lldb/source/Interpreter/CommandInterpreter.cpp lldb/source/Target/Platform.cpp Removed: diff --git a/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h index 697e799387b8..aff752699923 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -154,6 +154,10 @@ class FileSystem { /// Call into the Host to see if it can help find the file. bool ResolveExecutableLocation(FileSpec &file_spec); + /// Get the user home directory. + bool GetHomeDirectory(llvm::SmallVectorImpl &path) const; + bool GetHomeDirectory(FileSpec &file_spec) const; + enum EnumerateDirectoryResult { /// Enumerate next entry in the current directory. eEnumerateDirectoryResultNext, diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp index 9d3d119e4c2a..deca4ac81a1a 100644 --- a/lldb/source/API/SBHostOS.cpp +++ b/lldb/source/API/SBHostOS.cpp @@ -91,14 +91,13 @@ SBFileSpec SBHostOS::GetUserHomeDirectory() { LLDB_RECORD_STATIC_METHOD_NO_ARGS(lldb::SBFileSpec, SBHostOS, GetUserHomeDirectory); - SBFileSpec sb_fspec; - - llvm::SmallString<64> home_dir_path; - llvm::sys::path::home_directory(home_dir_path); - FileSpec homedir(home_dir_path.c_str()); + FileSpec homedir; + FileSystem::Instance().GetHomeDirectory(homedir); FileSystem::Instance().Resolve(homedir); + SBFileSpec sb_fspec; sb_fspec.SetFileSpec(homedir); + return LLDB_RECORD_RESULT(sb_fspec); } diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp index fc535d79b978..026a05da45b2 100644 --- a/lldb/source/Host/common/Editline.cpp +++ b/lldb/source/Host/common/Editline.cpp @@ -210,7 +210,7 @@ class EditlineHistory { // Compute the history path lazily. if (m_path.empty() && m_history && !m_prefix.empty()) { llvm::SmallString<128> lldb_history_file; - llvm::sys::path::home_directory(lldb_history_file); + FileSystem::Instance().GetHomeDirectory(lldb_history_file); llvm::sys::path::append(lldb_history_file, ".lldb"); // LLDB stores its history in ~/.lldb/. If for some reason this directory diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index 0fa27d131e1a..d295c01e6967 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -360,6 +360,18 @@ bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) { return true; } +bool FileSystem::GetHomeDirectory(SmallVectorImpl &path) const { + return llvm::sys::path::home_directory(path); +} + +bool FileSystem::GetHomeDirectory(FileSpec &file_spec) const { + SmallString<128> home_dir; + if (!GetHomeDirectory(home_dir)) +return false; + file_spec.SetPath(home_dir); + return true; +} + static int OpenWithFS(const FileSystem &fs, const char *path, int flags, int mode) { return const_cast(fs).Open(path, flags, mode); diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index 6a355cb12e8c..b3b0277ec667 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -2084,7 +2084,7 @@ static void GetHomeInitFile(llvm::SmallVectorImpl &init_file, init_file_name.append(suffix.str()); } - llvm::sys::path::home_directory(init_file); + FileSystem::Instance().GetHomeDirectory(init_file); llvm::sys::path::append(init_file, init_file_name); FileSystem::Instance().Resolve(init_file); @@ -2100,7 +2100,7 @@ static void GetHomeREPLInitFile(llvm::SmallVectorImpl &init_file, return; } - llvm::sys::path::home_directory(init_file); + FileSystem::Instance().GetHomeDirectory(init_file); llvm::sys::path::append(init_file, init_file_name); FileSystem::Instance().Resolve(init_file); diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 16787141bee0..e867b8db4723 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -85,7 +85,7 @@ PlatformProperties::PlatformProperties()
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
clayborg added inline comments. Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:174 + // end of the .text section if the .text section is less than a page size in + // length. + const uint8_t *ptr = text_data.GetDataStart(); I will try and make sure the data is there. The main issue is I don't think you can ask for more bytes than a section has, I believe it will cap the data. But I will check into this. Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:559-560 if (!match) { + // Breakpad might put a hash of the up to the first page if .text + // bytes into the UUID of a minidump. Facebook also has slightly + // modified this hash to avoid collisions. Check for UUIDs from the wallace wrote: > I don't understand well the first sentence I will try to make this clearer and rephrase a bit. Comment at: lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad.yaml:15 +AddressAlign:0x0004 +Content: 040014000300474E5500 labath wrote: > I guess this should include a custom `Fill` pseudo-section so that we can > guarantee the contents of whatever comes after it. Otherwise, yaml2obj might > decide to place anything (or nothing) there. Something like this ought to do > it: > ``` > - Type: Fill > Pattern: "DEADBEEF" > Size: 0xsomething > ``` We don't need to because I selected a multiple of 16 for the contents of the text section! If I added one more byte, then we would need to. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
clayborg added inline comments. Comment at: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:174 + // end of the .text section if the .text section is less than a page size in + // length. + const uint8_t *ptr = text_data.GetDataStart(); clayborg wrote: > I will try and make sure the data is there. The main issue is I don't think > you can ask for more bytes than a section has, I believe it will cap the > data. But I will check into this. Never mind, you are reading from the object file's data directly (not the section contents) so this should work just fine. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
clayborg updated this revision to Diff 286901. clayborg added a comment. Fixed: - Use a safer method to read the data we need for the .text section in case we need and extra 15 bytes. - Rephrase confusing comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 Files: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad.yaml lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-breakpad-uuid-match.yaml lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-facebook-uuid-match.yaml Index: lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-facebook-uuid-match.yaml === --- /dev/null +++ lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-facebook-uuid-match.yaml @@ -0,0 +1,15 @@ +--- !minidump +Streams: + - Type:SystemInfo +Processor Arch: ARM +Platform ID: Linux +CSD Version: '15E216' +CPU: + CPUID: 0x + - Type:ModuleList +Modules: + - Base of Image: 0x1000 +Size of Image: 0x1000 +Module Name: '/invalid/path/on/current/system/libbreakpad.so' +CodeView Record: 52534453141010100410101013101010575e451000 +... Index: lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-breakpad-uuid-match.yaml === --- /dev/null +++ lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-breakpad-uuid-match.yaml @@ -0,0 +1,15 @@ +--- !minidump +Streams: + - Type:SystemInfo +Processor Arch: ARM +Platform ID: Linux +CSD Version: '15E216' +CPU: + CPUID: 0x + - Type:ModuleList +Modules: + - Base of Image: 0x1000 +Size of Image: 0x1000 +Module Name: '/invalid/path/on/current/system/libbreakpad.so' +CodeView Record: 52534453040014000300474e55 +... Index: lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad.yaml === --- /dev/null +++ lldb/test/API/functionalities/postmortem/minidump-new/libbreakpad.yaml @@ -0,0 +1,15 @@ +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data:ELFDATA2LSB + Type:ET_DYN + Machine: EM_ARM + Flags: [ EF_ARM_SOFT_FLOAT, EF_ARM_EABI_VER5 ] +Sections: +Sections: + - Name:.text +Type:SHT_PROGBITS +Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +Address: 0x0001 +AddressAlign:0x0004 +Content: 040014000300474E5500 Index: lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py === --- lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py +++ lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py @@ -179,6 +179,50 @@ "/invalid/path/on/current/system/libuuidmismatch.so", "7295E17C-6668-9E05-CBB5-DEE5003865D5") +def test_breakpad_hash_match(self): +""" +Breakpad creates minidump files using CvRecord in each module whose +signature is set to PDB70 where the UUID is a hash generated by +breakpad of the .text section. This is only done when the +executable has no ELF build ID. + +This test verifies that if we have a minidump with a 16 byte UUID, +that we are able to associate a symbol file with no ELF build ID +and match it up by hashing the .text section. +""" +so_path = self.getBuildArtifact("libbreakpad.so") +self.yaml2obj("libbreakpad.yaml", so_path) +cmd = 'settings set target.exec-search-paths "%s"' % (os.path.dirname(so_path)) +self.dbg.HandleCommand(cmd) +modules = self.get_minidump_modules("linux-arm-breakpad-uuid-match.yaml") +self.assertEqual(1, len(modules)) +# LLDB makes up it own UUID as well when there is no build ID so we +# will check that this matches. +self.verify_module(modules[0], so_path, "D9C480E8") + +def test_facebook_hash_match(self): +""" +Breakpad creates minidump files using CvRecord in each module whose +signature is set to PDB70 where the UUID is a hash generated by +breakpad of the .text section and Facebook modified this hash to +avoid collisions. This is only done when the executable has no ELF +build ID. + +This
[Lldb-commits] [PATCH] D86261: Add hashing of the .text section to ProcessMinidump.
clayborg added a comment. Hopefully this should be good to go, let me know if anyone has any issues. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86261/new/ https://reviews.llvm.org/D86261 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ed17b6f - [lldb] Extract FileSystem initialization code into helper (NFC)
Author: Jonas Devlieghere Date: 2020-08-20T15:10:38-07:00 New Revision: ed17b6f6308f81273919532d422e3858d9a7c1da URL: https://github.com/llvm/llvm-project/commit/ed17b6f6308f81273919532d422e3858d9a7c1da DIFF: https://github.com/llvm/llvm-project/commit/ed17b6f6308f81273919532d422e3858d9a7c1da.diff LOG: [lldb] Extract FileSystem initialization code into helper (NFC) The FileSystem initialization depends on the reproducer mode. It has been growing organically to the point where it deserves its own helper function. This also allows for early returns to simplify the code. Added: Modified: lldb/source/Initialization/SystemInitializerCommon.cpp Removed: diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 3d07f92259be..028040b59683 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -39,6 +39,51 @@ SystemInitializerCommon::SystemInitializerCommon() {} SystemInitializerCommon::~SystemInitializerCommon() {} +/// Initialize the FileSystem based on the current reproducer mode. +static llvm::Error InitializeFileSystem() { + auto &r = repro::Reproducer::Instance(); + if (repro::Loader *loader = r.GetLoader()) { +FileSpec vfs_mapping = loader->GetFile(); +if (vfs_mapping) { + if (llvm::Error e = FileSystem::Initialize(vfs_mapping)) +return e; +} else { + FileSystem::Initialize(); +} + +llvm::Expected cwd = +loader->LoadBuffer(); +if (!cwd) + return cwd.takeError(); + +llvm::StringRef working_dir = llvm::StringRef(*cwd).rtrim(); +if (std::error_code ec = FileSystem::Instance() + .GetVirtualFileSystem() + ->setCurrentWorkingDirectory(working_dir)) { + return llvm::errorCodeToError(ec); +} + +return llvm::Error::success(); + } + + if (repro::Generator *g = r.GetGenerator()) { +repro::VersionProvider &vp = g->GetOrCreate(); +vp.SetVersion(lldb_private::GetVersion()); + +repro::FileProvider &fp = g->GetOrCreate(); +FileSystem::Initialize(fp.GetFileCollector()); + +repro::WorkingDirectoryProvider &wp = +g->GetOrCreate(); +fp.RecordInterestingDirectory(wp.GetWorkingDirectory()); + +return llvm::Error::success(); + } + + FileSystem::Initialize(); + return llvm::Error::success(); +} + llvm::Error SystemInitializerCommon::Initialize() { #if defined(_WIN32) const char *disable_crash_dialog_var = getenv("LLDB_DISABLE_CRASH_DIALOG"); @@ -69,36 +114,8 @@ llvm::Error SystemInitializerCommon::Initialize() { return e; } - auto &r = repro::Reproducer::Instance(); - if (repro::Loader *loader = r.GetLoader()) { -FileSpec vfs_mapping = loader->GetFile(); -if (vfs_mapping) { - if (llvm::Error e = FileSystem::Initialize(vfs_mapping)) -return e; -} else { - FileSystem::Initialize(); -} -if (llvm::Expected cwd = -loader->LoadBuffer()) { - llvm::StringRef working_dir = llvm::StringRef(*cwd).rtrim(); - if (std::error_code ec = FileSystem::Instance() - .GetVirtualFileSystem() - ->setCurrentWorkingDirectory(working_dir)) { -return llvm::errorCodeToError(ec); - } -} else { - return cwd.takeError(); -} - } else if (repro::Generator *g = r.GetGenerator()) { -repro::VersionProvider &vp = g->GetOrCreate(); -vp.SetVersion(lldb_private::GetVersion()); -repro::FileProvider &fp = g->GetOrCreate(); -FileSystem::Initialize(fp.GetFileCollector()); -repro::WorkingDirectoryProvider &wp = g->GetOrCreate(); -fp.RecordInterestingDirectory(wp.GetWorkingDirectory()); - } else { -FileSystem::Initialize(); - } + if (auto e = InitializeFileSystem()) +return e; Log::Initialize(); HostInfo::Initialize(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 4e266ea - Make DWARFExpression::GetLocationExpression public
Author: Eric Leese Date: 2020-08-20T15:12:28-07:00 New Revision: 4e266eaf132fa7e16eb6593dcfe4f4b9f55ea092 URL: https://github.com/llvm/llvm-project/commit/4e266eaf132fa7e16eb6593dcfe4f4b9f55ea092 DIFF: https://github.com/llvm/llvm-project/commit/4e266eaf132fa7e16eb6593dcfe4f4b9f55ea092.diff LOG: Make DWARFExpression::GetLocationExpression public This method is used to get the DataExtractor when the expression is a location list. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D86090 Added: Modified: lldb/include/lldb/Expression/DWARFExpression.h Removed: diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 6b63b186e3e43..c7d4e4b1882fd 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -219,6 +219,10 @@ class DWARFExpression { bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op); + llvm::Optional + GetLocationExpression(lldb::addr_t load_function_start, +lldb::addr_t addr) const; + private: /// Pretty-prints the location expression to a stream /// @@ -237,10 +241,6 @@ class DWARFExpression { void DumpLocation(Stream *s, const DataExtractor &data, lldb::DescriptionLevel level, ABI *abi) const; - llvm::Optional - GetLocationExpression(lldb::addr_t load_function_start, -lldb::addr_t addr) const; - /// Module which defined this expression. lldb::ModuleWP m_module_wp; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D86090: Make DWARFExpression::GetLocationExpression public
This revision was automatically updated to reflect the committed changes. Closed by commit rG4e266eaf132f: Make DWARFExpression::GetLocationExpression public (authored by Eric, committed by dschuff). Herald added a project: LLDB. Herald added a subscriber: lldb-commits. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86090/new/ https://reviews.llvm.org/D86090 Files: lldb/include/lldb/Expression/DWARFExpression.h Index: lldb/include/lldb/Expression/DWARFExpression.h === --- lldb/include/lldb/Expression/DWARFExpression.h +++ lldb/include/lldb/Expression/DWARFExpression.h @@ -219,6 +219,10 @@ bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op); + llvm::Optional + GetLocationExpression(lldb::addr_t load_function_start, +lldb::addr_t addr) const; + private: /// Pretty-prints the location expression to a stream /// @@ -237,10 +241,6 @@ void DumpLocation(Stream *s, const DataExtractor &data, lldb::DescriptionLevel level, ABI *abi) const; - llvm::Optional - GetLocationExpression(lldb::addr_t load_function_start, -lldb::addr_t addr) const; - /// Module which defined this expression. lldb::ModuleWP m_module_wp; Index: lldb/include/lldb/Expression/DWARFExpression.h === --- lldb/include/lldb/Expression/DWARFExpression.h +++ lldb/include/lldb/Expression/DWARFExpression.h @@ -219,6 +219,10 @@ bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op); + llvm::Optional + GetLocationExpression(lldb::addr_t load_function_start, +lldb::addr_t addr) const; + private: /// Pretty-prints the location expression to a stream /// @@ -237,10 +241,6 @@ void DumpLocation(Stream *s, const DataExtractor &data, lldb::DescriptionLevel level, ABI *abi) const; - llvm::Optional - GetLocationExpression(lldb::addr_t load_function_start, -lldb::addr_t addr) const; - /// Module which defined this expression. lldb::ModuleWP m_module_wp; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] a52173a - Use find_library for ncurses
Hello Jonas, Harmen, This commit broke one of our builders: http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/30809 . . . FAILED: bin/llvm-tblgen : && /usr/bin/c++ -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -static -fno-pie -Wl,-allow-shlib-undefined -Wl,-rpath-link,/home/buildslave/slave_as-bldslv8/lld-perf-testsuite/build/./lib -Wl,-O3 -Wl,--gc-sections utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmWriterEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmWriterInst.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/Attributes.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CallingConvEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeEmitterGen.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenDAGPatterns.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenHwModes.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenInstruction.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenMapTable.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenRegisters.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenTarget.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherGen.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherOpt.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcher.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DirectiveEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DisassemblerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/ExegesisEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/FastISelEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/FixedLenDecoderEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/GICombinerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/GlobalISelEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/InfoByHwMode.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/InstrInfoEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/InstrDocsEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/IntrinsicEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptParserEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptRSTEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/PredicateExpander.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/PseudoLoweringEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/RISCVCompressInstEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterBankEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterInfoEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SDNodeProperties.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SearchableTableEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SubtargetEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SubtargetFeatureInfo.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/TableGen.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/Types.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86DisassemblerTables.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86EVEX2VEXTablesEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86FoldTablesEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86ModRMFilters.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86RecognizableInstr.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/WebAssemblyDisassemblerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CTagsEmitter.cpp.o -o bin/llvm-tblgen -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.a lib/libLLVMTableGen.a -lpthread lib/libLLVMTableGenGlobalISel.a lib/libLLVMTableGen.a lib/libLLVMSupport.a -lrt -ldl /usr/lib/x86_64-linux-gnu/libtinfo.so -lpthread -lm lib/libLLVMDemangle.a && : /usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libtinfo.so' clang: error: linker command failed with exit code 1 (use -v to see invocation) The previous revision builds green: http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/30948 Please have a look ASAP? Thanks Galina On Mon, Aug 17, 2020 at 7:56 PM Jonas Devlieghere via lldb-commits < lldb-commits@lists.llvm.org> wrote: > > Author: Harmen Stoppels > Date: 2020-08-17T19:52:52-07:00 > New Revision: a52173a3e56553d7b795bcf3cdadcf6433117107 > > URL: > https://github.com/llvm/llvm-projec
[Lldb-commits] [lldb] 73af341 - [lldb] Capture and load home directory from the reproducer.
Author: Jonas Devlieghere Date: 2020-08-20T18:08:59-07:00 New Revision: 73af341beb8435c7da1dd5e7a8abacb2de6a236d URL: https://github.com/llvm/llvm-project/commit/73af341beb8435c7da1dd5e7a8abacb2de6a236d DIFF: https://github.com/llvm/llvm-project/commit/73af341beb8435c7da1dd5e7a8abacb2de6a236d.diff LOG: [lldb] Capture and load home directory from the reproducer. When replaying the reproducer, lldb should source the .lldbinit file that was captured by the reproducer and not the one in the current home directory. This requires that we store the home directory as part of the reproducer. By returning the virtual home directory during replay, we ensure the correct virtual path gets constructed which the VFS can then find and remap to the correct file in the reproducer root. This patch adds a new HomeDirectoryProvider, similar to the existing WorkingDirectoryProvider. As the home directory is not part of the VFS, it is stored in LLDB's FileSystem instance. Added: lldb/test/Shell/Reproducer/Inputs/HomeDir.in lldb/test/Shell/Reproducer/TestHomeDir.test Modified: lldb/include/lldb/Host/FileSystem.h lldb/include/lldb/Utility/Reproducer.h lldb/source/Commands/CommandObjectReproducer.cpp lldb/source/Host/common/FileSystem.cpp lldb/source/Initialization/SystemInitializerCommon.cpp lldb/source/Utility/Reproducer.cpp Removed: diff --git a/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h index aff752699923..811a10e47f1c 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -33,13 +33,14 @@ class FileSystem { FileSystem() : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr), -m_mapped(false) {} +m_home_directory(), m_mapped(false) {} FileSystem(std::shared_ptr collector) : m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)), -m_mapped(false) {} +m_home_directory(), m_mapped(false) {} FileSystem(llvm::IntrusiveRefCntPtr fs, bool mapped = false) - : m_fs(std::move(fs)), m_collector(nullptr), m_mapped(mapped) {} + : m_fs(std::move(fs)), m_collector(nullptr), m_home_directory(), +m_mapped(mapped) {} FileSystem(const FileSystem &fs) = delete; FileSystem &operator=(const FileSystem &fs) = delete; @@ -193,10 +194,13 @@ class FileSystem { void Collect(const FileSpec &file_spec); void Collect(const llvm::Twine &file); + void SetHomeDirectory(std::string home_directory); + private: static llvm::Optional &InstanceImpl(); llvm::IntrusiveRefCntPtr m_fs; std::shared_ptr m_collector; + std::string m_home_directory; bool m_mapped; }; } // namespace lldb_private diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h index da8fd6754a20..8a406658fdfb 100644 --- a/lldb/include/lldb/Utility/Reproducer.h +++ b/lldb/include/lldb/Utility/Reproducer.h @@ -181,6 +181,25 @@ class WorkingDirectoryProvider static char ID; }; +/// Provider for the home directory. +/// +/// When the reproducer is kept, it writes the user's home directory to a file +/// a file named home.txt in the reproducer root. +class HomeDirectoryProvider : public DirectoryProvider { +public: + HomeDirectoryProvider(const FileSpec &directory) + : DirectoryProvider(directory) { +llvm::SmallString<128> home_dir; +llvm::sys::path::home_directory(home_dir); +SetDirectory(std::string(home_dir)); + } + struct Info { +static const char *name; +static const char *file; + }; + static char ID; +}; + /// The recorder is a small object handed out by a provider to record data. It /// is commonly used in combination with a MultiProvider which is meant to /// record information for multiple instances of the same source of data. @@ -495,6 +514,15 @@ template class MultiLoader { unsigned m_index = 0; }; +/// Helper to read directories written by the DirectoryProvider. +template +llvm::Expected GetDirectoryFrom(repro::Loader *loader) { + llvm::Expected dir = loader->LoadBuffer(); + if (!dir) +return dir.takeError(); + return std::string(llvm::StringRef(*dir).rtrim()); +} + } // namespace repro } // namespace lldb_private diff --git a/lldb/source/Commands/CommandObjectReproducer.cpp b/lldb/source/Commands/CommandObjectReproducer.cpp index 104130b70b2b..9add2df52985 100644 --- a/lldb/source/Commands/CommandObjectReproducer.cpp +++ b/lldb/source/Commands/CommandObjectReproducer.cpp @@ -31,6 +31,7 @@ enum ReproducerProvider { eReproducerProviderProcessInfo, eReproducerProviderVersion, eReproducerProviderWorkingDirectory, + eReproducerProviderHomeDirectory, eReproducerProviderNone }; @@ -65,6 +66,11 @@ static constexpr OptionEnumValueElement g_reproducer_provider_type[] = { "cwd", "Working Directory", }, +{ +eR
[Lldb-commits] [lldb] c90ca0c - [lldb] Implement WorkingDirectoryProvider in terms of DirectoryProvider (NFC)
Author: Jonas Devlieghere Date: 2020-08-20T18:08:59-07:00 New Revision: c90ca0c8e4956e051e2f29cff0c38f9f03b32f87 URL: https://github.com/llvm/llvm-project/commit/c90ca0c8e4956e051e2f29cff0c38f9f03b32f87 DIFF: https://github.com/llvm/llvm-project/commit/c90ca0c8e4956e051e2f29cff0c38f9f03b32f87.diff LOG: [lldb] Implement WorkingDirectoryProvider in terms of DirectoryProvider (NFC) Add an abstract base class that can be used to create other directory providers. Added: Modified: lldb/include/lldb/Utility/Reproducer.h lldb/source/API/SBReproducer.cpp lldb/source/Initialization/SystemInitializerCommon.cpp lldb/source/Utility/Reproducer.cpp Removed: diff --git a/lldb/include/lldb/Utility/Reproducer.h b/lldb/include/lldb/Utility/Reproducer.h index 21f43b6ad5e0..da8fd6754a20 100644 --- a/lldb/include/lldb/Utility/Reproducer.h +++ b/lldb/include/lldb/Utility/Reproducer.h @@ -138,28 +138,46 @@ class VersionProvider : public Provider { static char ID; }; -/// Provider for the LLDB current working directory. +/// Abstract provider to storing directory paths. +template class DirectoryProvider : public repro::Provider { +public: + DirectoryProvider(const FileSpec &root) : Provider(root) {} + void SetDirectory(std::string directory) { +m_directory = std::move(directory); + } + llvm::StringRef GetDirectory() { return m_directory; } + + void Keep() override { +FileSpec file = this->GetRoot().CopyByAppendingPathComponent(T::Info::file); +std::error_code ec; +llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); +if (ec) + return; +os << m_directory << "\n"; + } + +protected: + std::string m_directory; +}; + +/// Provider for the current working directory. /// /// When the reproducer is kept, it writes lldb's current working directory to /// a file named cwd.txt in the reproducer root. -class WorkingDirectoryProvider : public Provider { +class WorkingDirectoryProvider +: public DirectoryProvider { public: - WorkingDirectoryProvider(const FileSpec &directory) : Provider(directory) { + WorkingDirectoryProvider(const FileSpec &directory) + : DirectoryProvider(directory) { llvm::SmallString<128> cwd; if (std::error_code EC = llvm::sys::fs::current_path(cwd)) return; -m_cwd = std::string(cwd.str()); +SetDirectory(std::string(cwd)); } - - void Update(llvm::StringRef path) { m_cwd = std::string(path); } - llvm::StringRef GetWorkingDirectory() { return m_cwd; } - struct Info { static const char *name; static const char *file; }; - void Keep() override; - std::string m_cwd; static char ID; }; diff --git a/lldb/source/API/SBReproducer.cpp b/lldb/source/API/SBReproducer.cpp index 9815bf11263c..7d08a88fe9e3 100644 --- a/lldb/source/API/SBReproducer.cpp +++ b/lldb/source/API/SBReproducer.cpp @@ -235,9 +235,9 @@ const char *SBReproducer::GetPath() { void SBReproducer::SetWorkingDirectory(const char *path) { if (auto *g = lldb_private::repro::Reproducer::Instance().GetGenerator()) { auto &wp = g->GetOrCreate(); -wp.Update(path); +wp.SetDirectory(path); auto &fp = g->GetOrCreate(); -fp.RecordInterestingDirectory(wp.GetWorkingDirectory()); +fp.RecordInterestingDirectory(wp.GetDirectory()); } } diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 028040b59683..c3bef4139bcc 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -75,7 +75,7 @@ static llvm::Error InitializeFileSystem() { repro::WorkingDirectoryProvider &wp = g->GetOrCreate(); -fp.RecordInterestingDirectory(wp.GetWorkingDirectory()); +fp.RecordInterestingDirectory(wp.GetDirectory()); return llvm::Error::success(); } diff --git a/lldb/source/Utility/Reproducer.cpp b/lldb/source/Utility/Reproducer.cpp index 4441f3d475ea..935e41a08a4e 100644 --- a/lldb/source/Utility/Reproducer.cpp +++ b/lldb/source/Utility/Reproducer.cpp @@ -290,15 +290,6 @@ void VersionProvider::Keep() { os << m_version << "\n"; } -void WorkingDirectoryProvider::Keep() { - FileSpec file = GetRoot().CopyByAppendingPathComponent(Info::file); - std::error_code ec; - llvm::raw_fd_ostream os(file.GetPath(), ec, llvm::sys::fs::OF_Text); - if (ec) -return; - os << m_cwd << "\n"; -} - void FileProvider::RecordInterestingDirectory(const llvm::Twine &dir) { if (m_collector) m_collector->addFile(dir); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing updated this revision to Diff 286945. Higuoxing added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 Files: llvm/include/llvm/ObjectYAML/DWARFYAML.h llvm/lib/ObjectYAML/DWARFEmitter.cpp llvm/lib/ObjectYAML/DWARFYAML.cpp llvm/lib/ObjectYAML/ELFEmitter.cpp llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml llvm/tools/obj2yaml/dwarf2yaml.cpp llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp === --- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -2487,6 +2487,7 @@ - Value: 0x - Length: 16 Version: 4 +AbbrevTableID: 0 AbbrOffset: 0 AddrSize:8 Entries: Index: llvm/tools/obj2yaml/dwarf2yaml.cpp === --- llvm/tools/obj2yaml/dwarf2yaml.cpp +++ llvm/tools/obj2yaml/dwarf2yaml.cpp @@ -23,6 +23,7 @@ void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) { auto AbbrevSetPtr = DCtx.getDebugAbbrev(); if (AbbrevSetPtr) { +uint64_t AbbrevTableID = 0; for (auto AbbrvDeclSet : *AbbrevSetPtr) { Y.DebugAbbrev.emplace_back(); for (auto AbbrvDecl : AbbrvDeclSet.second) { @@ -39,6 +40,7 @@ AttAbrv.Value = Attribute.getImplicitConstValue(); Abbrv.Attributes.push_back(AttAbrv); } +Y.DebugAbbrev.back().ID = AbbrevTableID++; Y.DebugAbbrev.back().Table.push_back(Abbrv); } } @@ -172,6 +174,14 @@ NewUnit.Version = CU->getVersion(); if (NewUnit.Version >= 5) NewUnit.Type = (dwarf::UnitType)CU->getUnitType(); +const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev(); +NewUnit.AbbrevTableID = std::distance( +DebugAbbrev->begin(), +std::find_if( +DebugAbbrev->begin(), DebugAbbrev->end(), +[&](const std::pair &P) { + return P.first == CU->getAbbreviations()->getOffset(); +})); NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset(); NewUnit.AddrSize = CU->getAddressByteSize(); for (auto DIE : CU->dies()) { Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml === --- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml +++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml @@ -206,11 +206,12 @@ - Attribute: 0x01 Form: DW_FORM_addrx4 ## 0x2c debug_info: -- Length: 0x1234 - Version:5 - UnitType: DW_UT_type - AbbrOffset: 0x1234 - AddrSize: 4 +- Length:0x1234 + Version: 5 + UnitType: DW_UT_type + AbbrevTableID: 0 + AbbrOffset:0x1234 + AddrSize: 4 Entries: - AbbrCode: 1 Values: @@ -271,6 +272,7 @@ Version: 5 ## Test another unit type. UnitType: DW_UT_compile + AbbrevTableID: 0 AbbrOffset:0x1234 AddrSize: 4 Entries: @@ -279,6 +281,7 @@ - Length:0x5678 ## Test DWARFv4 Version: 4 + AbbrevTableID: 0 AbbrOffset:0x5678 AddrSize: 4 Entries: @@ -886,7 +889,7 @@ ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV -# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table +# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0 --- !ELF FileHeader: @@ -903,11 +906,43 @@ Values: - Value: 0x1234 -## n) Test that yaml2obj emits an error message when a compilation unit has values but there is no associated abbrev table. +## o) Test that yaml2obj is able to generate compilation units according to the +## associated abbrev table that is referenced by the 'AbbrevTableID'. -## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV +# RUN: yaml2obj --docnum=17 %s -o %t17.o +# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES -# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table +# MULTI-TABLES: Hex dump of section '.debug_info': +# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4... +## ^---unit_length (4-byte) +##
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGf7ff0ace96db: [DWARFYAML] Add support for referencing different abbrev tables. (authored by Higuoxing). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 Files: llvm/include/llvm/ObjectYAML/DWARFYAML.h llvm/lib/ObjectYAML/DWARFEmitter.cpp llvm/lib/ObjectYAML/DWARFYAML.cpp llvm/lib/ObjectYAML/ELFEmitter.cpp llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml llvm/tools/obj2yaml/dwarf2yaml.cpp llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp === --- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp +++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp @@ -2487,6 +2487,7 @@ - Value: 0x - Length: 16 Version: 4 +AbbrevTableID: 0 AbbrOffset: 0 AddrSize:8 Entries: Index: llvm/tools/obj2yaml/dwarf2yaml.cpp === --- llvm/tools/obj2yaml/dwarf2yaml.cpp +++ llvm/tools/obj2yaml/dwarf2yaml.cpp @@ -23,6 +23,7 @@ void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) { auto AbbrevSetPtr = DCtx.getDebugAbbrev(); if (AbbrevSetPtr) { +uint64_t AbbrevTableID = 0; for (auto AbbrvDeclSet : *AbbrevSetPtr) { Y.DebugAbbrev.emplace_back(); for (auto AbbrvDecl : AbbrvDeclSet.second) { @@ -39,6 +40,7 @@ AttAbrv.Value = Attribute.getImplicitConstValue(); Abbrv.Attributes.push_back(AttAbrv); } +Y.DebugAbbrev.back().ID = AbbrevTableID++; Y.DebugAbbrev.back().Table.push_back(Abbrv); } } @@ -172,6 +174,14 @@ NewUnit.Version = CU->getVersion(); if (NewUnit.Version >= 5) NewUnit.Type = (dwarf::UnitType)CU->getUnitType(); +const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev(); +NewUnit.AbbrevTableID = std::distance( +DebugAbbrev->begin(), +std::find_if( +DebugAbbrev->begin(), DebugAbbrev->end(), +[&](const std::pair &P) { + return P.first == CU->getAbbreviations()->getOffset(); +})); NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset(); NewUnit.AddrSize = CU->getAddressByteSize(); for (auto DIE : CU->dies()) { Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml === --- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml +++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml @@ -206,11 +206,12 @@ - Attribute: 0x01 Form: DW_FORM_addrx4 ## 0x2c debug_info: -- Length: 0x1234 - Version:5 - UnitType: DW_UT_type - AbbrOffset: 0x1234 - AddrSize: 4 +- Length:0x1234 + Version: 5 + UnitType: DW_UT_type + AbbrevTableID: 0 + AbbrOffset:0x1234 + AddrSize: 4 Entries: - AbbrCode: 1 Values: @@ -271,6 +272,7 @@ Version: 5 ## Test another unit type. UnitType: DW_UT_compile + AbbrevTableID: 0 AbbrOffset:0x1234 AddrSize: 4 Entries: @@ -279,6 +281,7 @@ - Length:0x5678 ## Test DWARFv4 Version: 4 + AbbrevTableID: 0 AbbrOffset:0x5678 AddrSize: 4 Entries: @@ -886,7 +889,7 @@ ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV -# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table +# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0 --- !ELF FileHeader: @@ -903,11 +906,43 @@ Values: - Value: 0x1234 -## n) Test that yaml2obj emits an error message when a compilation unit has values but there is no associated abbrev table. +## o) Test that yaml2obj is able to generate compilation units according to the +## associated abbrev table that is referenced by the 'AbbrevTableID'. -## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV +# RUN: yaml2obj --docnum=17 %s -o %t17.o +# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES -# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table +# MULTI-TABLES: Hex dump of section '.debug_info': +# MULTI-TABLES-NEXT: 0x
[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.
Higuoxing reopened this revision. Higuoxing added a comment. This revision is now accepted and ready to land. This change is causing build failure, I'm going to revise this change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D83116/new/ https://reviews.llvm.org/D83116 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] c1bc4fb - [lldb] Simplify CMake logic with LLVM's append_if function
Author: Jonas Devlieghere Date: 2020-08-20T22:35:31-07:00 New Revision: c1bc4fb95e37ade1256da8ea8db1030ae84705bd URL: https://github.com/llvm/llvm-project/commit/c1bc4fb95e37ade1256da8ea8db1030ae84705bd DIFF: https://github.com/llvm/llvm-project/commit/c1bc4fb95e37ade1256da8ea8db1030ae84705bd.diff LOG: [lldb] Simplify CMake logic with LLVM's append_if function Use the append_if CMake function from HandleLLVMOptions. Since we include this file in LLDBStandalone it should work in both for in-tree and out-of-tree builds. Added: Modified: lldb/cmake/modules/LLDBConfig.cmake Removed: diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index b0c139e71ebc..b149836d2666 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -159,36 +159,21 @@ endif () include_directories("${CMAKE_CURRENT_BINARY_DIR}/../clang/include") # Disable GCC warnings -check_cxx_compiler_flag("-Wno-deprecated-declarations" -CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS) -if (CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") -endif () +check_cxx_compiler_flag("-Wno-deprecated-declarations" CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS) +append_if(CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS "-Wno-deprecated-declarations" CMAKE_CXX_FLAGS) -check_cxx_compiler_flag("-Wno-unknown-pragmas" -CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS) -if (CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") -endif () +check_cxx_compiler_flag("-Wno-unknown-pragmas" CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS) +append_if(CXX_SUPPORTS_NO_UNKNOWN_PRAGMAS "-Wno-unknown-pragmas" CMAKE_CXX_FLAGS) -check_cxx_compiler_flag("-Wno-strict-aliasing" -CXX_SUPPORTS_NO_STRICT_ALIASING) -if (CXX_SUPPORTS_NO_STRICT_ALIASING) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing") -endif () +check_cxx_compiler_flag("-Wno-strict-aliasing" CXX_SUPPORTS_NO_STRICT_ALIASING) +append_if(CXX_SUPPORTS_NO_STRICT_ALIASING "-Wno-strict-aliasing" CMAKE_CXX_FLAGS) # Disable Clang warnings -check_cxx_compiler_flag("-Wno-deprecated-register" -CXX_SUPPORTS_NO_DEPRECATED_REGISTER) -if (CXX_SUPPORTS_NO_DEPRECATED_REGISTER) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register") -endif () +check_cxx_compiler_flag("-Wno-deprecated-register" CXX_SUPPORTS_NO_DEPRECATED_REGISTER) +append_if(CXX_SUPPORTS_NO_DEPRECATED_REGISTER "-Wno-deprecated-register" CMAKE_CXX_FLAGS) -check_cxx_compiler_flag("-Wno-vla-extension" -CXX_SUPPORTS_NO_VLA_EXTENSION) -if (CXX_SUPPORTS_NO_VLA_EXTENSION) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension") -endif () +check_cxx_compiler_flag("-Wno-vla-extension" CXX_SUPPORTS_NO_VLA_EXTENSION) +append_if(CXX_SUPPORTS_NO_VLA_EXTENSION "-Wno-vla-extension" CMAKE_CXX_FLAGS) # Disable MSVC warnings if( MSVC ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e0b220d - [lldb] Remove redundant call to FindBacktrace (NFC)
Author: Jonas Devlieghere Date: 2020-08-20T22:41:49-07:00 New Revision: e0b220d22eed75b2a2a783ac45b832e961e77a9e URL: https://github.com/llvm/llvm-project/commit/e0b220d22eed75b2a2a783ac45b832e961e77a9e DIFF: https://github.com/llvm/llvm-project/commit/e0b220d22eed75b2a2a783ac45b832e961e77a9e.diff LOG: [lldb] Remove redundant call to FindBacktrace (NFC) We're not using any of the Backtrace_* CMake variables set by FindBacktrace in LLDB. Added: Modified: lldb/cmake/modules/LLDBConfig.cmake Removed: diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index b149836d2666..af94e6e223d9 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -292,5 +292,4 @@ if ((CMAKE_SYSTEM_NAME MATCHES "Android") AND LLVM_BUILD_STATIC AND add_definitions(-DANDROID_USE_ACCEPT_WORKAROUND) endif() -find_package(Backtrace) include(LLDBGenerateConfig) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 6ad3de3 - [lldb] Fix a new -Wdocumetnation issues (NFC)
Author: Jonas Devlieghere Date: 2020-08-20T22:59:13-07:00 New Revision: 6ad3de350c462399a02adccab7fc70de8ecd6224 URL: https://github.com/llvm/llvm-project/commit/6ad3de350c462399a02adccab7fc70de8ecd6224 DIFF: https://github.com/llvm/llvm-project/commit/6ad3de350c462399a02adccab7fc70de8ecd6224.diff LOG: [lldb] Fix a new -Wdocumetnation issues (NFC) Added: Modified: lldb/include/lldb/Target/Process.h lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h Removed: diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index cf0d78f24951..42f10082b981 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -728,11 +728,6 @@ class Process : public std::enable_shared_from_this, /// Attach to a remote system via a URL /// - /// \param[in] strm - /// A stream where output intended for the user - /// (if the driver has a way to display that) generated during - /// the connection. This may be nullptr if no output is needed.A - /// /// \param[in] remote_url /// The URL format that we are connecting to. /// @@ -916,11 +911,6 @@ class Process : public std::enable_shared_from_this, /// Attach to a remote system via a URL /// - /// \param[in] strm - /// A stream where output intended for the user - /// (if the driver has a way to display that) generated during - /// the connection. This may be nullptr if no output is needed.A - /// /// \param[in] remote_url /// The URL format that we are connecting to. /// @@ -2239,7 +2229,7 @@ void PruneThreadPlans(); /// Dump the thread plans associated with thread with \a tid. /// - /// \param[in/out] strm + /// \param[in,out] strm /// The stream to which to dump the output /// /// \param[in] tid @@ -2266,7 +2256,7 @@ void PruneThreadPlans(); /// Dump all the thread plans for this process. /// - /// \param[in/out] strm + /// \param[in,out] strm /// The stream to which to dump the output /// /// \param[in] desc_level diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h index 74fd9de4357f..90bf8e757c85 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h @@ -679,7 +679,7 @@ class TypeSystemClang : public TypeSystem { /// Using the current type, create a new typedef to that type using /// "typedef_name" as the name and "decl_ctx" as the decl context. - /// \param payload is an opaque TypePayloadClang. + /// \param opaque_payload is an opaque TypePayloadClang. static CompilerType CreateTypedefType(const CompilerType &type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits