[Lldb-commits] [PATCH] D44015: Fix std unique pointer not printing.
labath added a comment. Pretty close, just a couple of style issues. Comment at: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:62 if (!valobj_backend_sp) -return false; +return NULL; nullptr. Comment at: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp:78 +return obj_subchild_sp; + } else { +return obj_child_sp; no else after return https://reviews.llvm.org/D44015 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r326739 - [test] Skip pexpect-based lldb-mi tests on Darwin
For the record, our bots don't run any of the lldb-mi tests. I don't know if it is an issue with pexpect, the way we are using, or genuine issues, but I found pretty much all of lldb-mi tests flaky, and it's code too hairy to understand what is going on. On Mon, 5 Mar 2018 at 20:19, Vedant Kumar via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: vedantk > Date: Mon Mar 5 12:16:52 2018 > New Revision: 326739 > > URL: http://llvm.org/viewvc/llvm-project?rev=326739&view=rev > Log: > [test] Skip pexpect-based lldb-mi tests on Darwin > > These tests fail with a relatively frequently on Darwin machines with > errors such as: > > File ".../lldb/third_party/Python/module/pexpect-2.4/pexpect.py", line > 1444, in expect_loop > raise EOF(str(e) + '\n' + str(self)) > EOF: End Of File (EOF) in read_nonblocking(). Empty string style platform. > > The unpredictable failures make these tests noisy. > > rdar://37046976 > > Modified: > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py > > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py > > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py > > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py > > Modified: > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py?rev=326739&r1=326738&r2=326739&view=diff > > == > --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py > (original) > +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py > Mon Mar 5 12:16:52 2018 > @@ -17,6 +17,7 @@ class MiExitTestCase(lldbmi_testcase.MiT > @expectedFailureAll( > oslist=["windows"], > bugnumber="llvm.org/pr22274: need a pexpect replacement for > windows") > +@skipIfDarwin # pexpect is known to be unreliable on Darwin > @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known > thread races > @skipIfRemote # We do not currently support remote debugging via > the MI. > def test_lldbmi_gdb_exit(self): > @@ -44,6 +45,7 @@ class MiExitTestCase(lldbmi_testcase.MiT > @expectedFailureAll( > oslist=["windows"], > bugnumber="llvm.org/pr22274: need a pexpect replacement for > windows") > +@skipIfDarwin # pexpect is known to be unreliable on Darwin > @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known > thread races > @skipIfRemote # We do not currently support remote debugging via > the MI. > def test_lldbmi_quit(self): > @@ -70,6 +72,7 @@ class MiExitTestCase(lldbmi_testcase.MiT > @expectedFailureAll( > oslist=["windows"], > bugnumber="llvm.org/pr22274: need a pexpect replacement for > windows") > +@skipIfDarwin # pexpect is known to be unreliable on Darwin > @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known > thread races > @skipIfRemote # We do not currently support remote debugging via > the MI. > def test_lldbmi_q(self): > > Modified: > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py?rev=326739&r1=326738&r2=326739&view=diff > > == > --- > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py > (original) > +++ > lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py > Mon Mar 5 12:16:52 2018 > @@ -19,6 +19,7 @@ class MiGdbSetShowTestCase(lldbmi_testca > @expectedFailureAll( > oslist=["windows"], > bugnumber="llvm.org/pr22274: need a pexpect replacement for > windows") > +@skipIfDarwin # pexpect is known to be unreliable on Darwin > @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known > thread races > @skipIfRemote # We do not currently support remote debugging via > the MI. > def test_lldbmi_gdb_set_target_async_default(self): > @@ -41,6 +42,7 @@ class MiGdbSetShowTestCase(lldbmi_testca > @expectedFailureAll( > oslist=["windows"], > bugnumber="llvm.org/pr22274: need a pexpect replacement for > windows") > +@skipIfDarwin # pexpect is known to be unreliable on Darwin > @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known > thread races > @expectedFlakeyLinux("llvm.org/pr26028") # Fails in ~1% of cases > @skipIfRemote # We do not currently support remote debugging via > the MI. > @@ -74,6 +76,7 @@ class MiGdbSetShowTestCase(lldbmi_testca > oslist=["windows"], > bugnumber="llvm.org/pr22274: need a pexpect replacement for > windows") > @skipIfFreeBSD
[Lldb-commits] [PATCH] D44139: WIP: Update selected thread after loading mach core
JDevlieghere created this revision. JDevlieghere added reviewers: jingham, jasonmolenda, labath. Herald added a subscriber: llvm-commits. The OS plugins might have updated the thread list after a core file has been loaded. The physical thread in the core file may no longer be the one that should be selected. Hence we should run the thread selection logic after loading the core. WIP because of some open questions: 1. What's the best/easiest way to test this? 2. Should we also do this for ELF cores? Repository: rL LLVM https://reviews.llvm.org/D44139 Files: include/lldb/Target/Process.h source/Plugins/Process/mach-core/ProcessMachCore.cpp source/Target/Process.cpp Index: source/Target/Process.cpp === --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -1036,6 +1036,82 @@ return state; } +StopInfoSP Process::UpdateSelectedThread() { + StopInfoSP curr_thread_stop_info_sp; + ThreadList &thread_list = GetThreadList(); + + // Lock the thread list so it doesn't change on us. + std::lock_guard guard(thread_list.GetMutex()); + + ThreadSP curr_thread(thread_list.GetSelectedThread()); + StopReason curr_thread_stop_reason = eStopReasonInvalid; + if (curr_thread) { +curr_thread_stop_reason = curr_thread->GetStopReason(); +curr_thread_stop_info_sp = curr_thread->GetStopInfo(); + } + + if (!curr_thread || !curr_thread->IsValid() || + curr_thread_stop_reason == eStopReasonInvalid || + curr_thread_stop_reason == eStopReasonNone) { + +// Prefer a thread that has just completed its plan over another thread as +// current thread. +ThreadSP thread; +ThreadSP plan_thread; +ThreadSP other_thread; + +for (size_t i = 0, e = thread_list.GetSize(); i != e; ++i) { + thread = thread_list.GetThreadAtIndex(i); + StopReason thread_stop_reason = thread->GetStopReason(); + switch (thread_stop_reason) { + case eStopReasonInvalid: + case eStopReasonNone: +break; + + case eStopReasonSignal: { +// Don't select a signal thread if we weren't going to stop at that +// signal. We have to have had another reason for stopping here, and +// the user doesn't want to see this thread. +uint64_t signo = thread->GetStopInfo()->GetValue(); +if (this->GetUnixSignals()->GetShouldStop(signo)) { + if (!other_thread) +other_thread = thread; +} +break; + } + case eStopReasonTrace: + case eStopReasonBreakpoint: + case eStopReasonWatchpoint: + case eStopReasonException: + case eStopReasonExec: + case eStopReasonThreadExiting: + case eStopReasonInstrumentation: +if (!other_thread) + other_thread = thread; +break; + case eStopReasonPlanComplete: +if (!plan_thread) + plan_thread = thread; +break; + } +} +if (plan_thread) + thread_list.SetSelectedThreadByID(plan_thread->GetID()); +else if (other_thread) + thread_list.SetSelectedThreadByID(other_thread->GetID()); +else { + if (curr_thread && curr_thread->IsValid()) +thread = curr_thread; + else +thread = thread_list.GetThreadAtIndex(0); + + if (thread) +thread_list.SetSelectedThreadByID(thread->GetID()); +} + } + return curr_thread_stop_info_sp; +} + bool Process::HandleProcessStateChangedEvent(const EventSP &event_sp, Stream *stream, bool &pop_process_io_handler) { @@ -,87 +1187,8 @@ } } } else { - StopInfoSP curr_thread_stop_info_sp; - // Lock the thread list so it doesn't change on us, this is the scope for - // the locker: - { -ThreadList &thread_list = process_sp->GetThreadList(); -std::lock_guard guard(thread_list.GetMutex()); - -ThreadSP curr_thread(thread_list.GetSelectedThread()); -ThreadSP thread; -StopReason curr_thread_stop_reason = eStopReasonInvalid; -if (curr_thread) { - curr_thread_stop_reason = curr_thread->GetStopReason(); - curr_thread_stop_info_sp = curr_thread->GetStopInfo(); -} -if (!curr_thread || !curr_thread->IsValid() || -curr_thread_stop_reason == eStopReasonInvalid || -curr_thread_stop_reason == eStopReasonNone) { - // Prefer a thread that has just completed its plan over another - // thread as current thread. - ThreadSP plan_thread; - ThreadSP other_thread; - - const size_t num_threads = thread_list.GetSize(); - size_t i; - for (i = 0; i < num_threads; ++i) { -thread = thread_list.GetThreadAtIndex(i); -StopReason thread_stop_reason = thread->GetStopReason(); -switch (thread_stop_reason) { -case eStopReasonInvalid: -
[Lldb-commits] [PATCH] D44139: WIP: Update selected thread after loading mach core
labath added a comment. I don't know much about OS plugins, but I don't see a reason why this would be mach-specific (so yes, it should probably be done for elf cores as well). Oh, and we also have windows minidumps, but I'm not sure if it should be up to you to update all of these (I'm saying not sure, because the fact that each format needs to be updated specifically may mean that this should be actually done at a different level, but I have no idea if that's possible). As for testing, the only approach I can think of is a combination of a checked-in core file + a fake os plugin. We currently don't have a good way of generating core files (at least for elf, it requires some additional features in yaml2obj). We have a couple of tiny (dozens of KB) elf core files checked in, and you may be even able to reuse one of them. For an example of a fake OS plugin, you can look at TestPythonOSPlugin. I don't guarantee this will actually work (did I say I don't know OS plugins ? :D), but it's the only solution I can think of. Repository: rL LLVM https://reviews.llvm.org/D44139 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326775 - [LLDB][PPC64] Fixed issues with expedited registers
Author: labath Date: Tue Mar 6 03:54:41 2018 New Revision: 326775 URL: http://llvm.org/viewvc/llvm-project?rev=326775&view=rev Log: [LLDB][PPC64] Fixed issues with expedited registers Summary: - reg_nums were missing the end marker entry - marked FP test to be skipped for ppc64 Reviewers: labath, clayborg Reviewed By: labath, clayborg Subscribers: alexandreyy, lbianc, nemanjai, kbarton Differential Revision: https://reviews.llvm.org/D43767 Patch by Leandro Lupori Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py?rev=326775&r1=326774&r2=326775&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py Tue Mar 6 03:54:41 2018 @@ -125,6 +125,8 @@ class TestGdbRemoteExpeditedRegisters( self.set_inferior_startup_launch() self.stop_notification_contains_pc_register() +# powerpc64 has no FP register +@skipIf(triple='^powerpc64') def stop_notification_contains_fp_register(self): self.stop_notification_contains_generic_register("fp") Modified: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp?rev=326775&r1=326774&r2=326775&view=diff == --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp Tue Mar 6 03:54:41 2018 @@ -50,6 +50,7 @@ static const uint32_t g_gpr_regnums_ppc6 gpr_pc_ppc64le, gpr_msr_ppc64le, gpr_origr3_ppc64le, gpr_ctr_ppc64le, gpr_lr_ppc64le, gpr_xer_ppc64le, gpr_cr_ppc64le, gpr_softe_ppc64le, gpr_trap_ppc64le, +LLDB_INVALID_REGNUM // register sets need to end with this flag }; static const uint32_t g_fpr_regnums_ppc64le[] = { @@ -62,6 +63,7 @@ static const uint32_t g_fpr_regnums_ppc6 fpr_f24_ppc64le, fpr_f25_ppc64le, fpr_f26_ppc64le, fpr_f27_ppc64le, fpr_f28_ppc64le, fpr_f29_ppc64le, fpr_f30_ppc64le, fpr_f31_ppc64le, fpr_fpscr_ppc64le, +LLDB_INVALID_REGNUM // register sets need to end with this flag }; static const uint32_t g_vmx_regnums_ppc64le[] = { @@ -74,6 +76,7 @@ static const uint32_t g_vmx_regnums_ppc6 vmx_vr24_ppc64le, vmx_vr25_ppc64le, vmx_vr26_ppc64le, vmx_vr27_ppc64le, vmx_vr28_ppc64le, vmx_vr29_ppc64le, vmx_vr30_ppc64le, vmx_vr31_ppc64le, vmx_vscr_ppc64le, vmx_vrsave_ppc64le, +LLDB_INVALID_REGNUM // register sets need to end with this flag }; static const uint32_t g_vsx_regnums_ppc64le[] = { @@ -93,6 +96,7 @@ static const uint32_t g_vsx_regnums_ppc6 vsx_vs52_ppc64le, vsx_vs53_ppc64le, vsx_vs54_ppc64le, vsx_vs55_ppc64le, vsx_vs56_ppc64le, vsx_vs57_ppc64le, vsx_vs58_ppc64le, vsx_vs59_ppc64le, vsx_vs60_ppc64le, vsx_vs61_ppc64le, vsx_vs62_ppc64le, vsx_vs63_ppc64le, +LLDB_INVALID_REGNUM // register sets need to end with this flag }; namespace { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44015: Fix std unique pointer not printing.
alexandreyy updated this revision to Diff 137153. alexandreyy added a comment. Changed NULL pointer https://reviews.llvm.org/D44015 Files: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp === --- source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -43,6 +43,8 @@ ValueObjectSP m_ptr_obj; ValueObjectSP m_obj_obj; ValueObjectSP m_del_obj; + + ValueObjectSP GetTuple(); }; } // end of anonymous namespace @@ -53,17 +55,34 @@ Update(); } -bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { +ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() { ValueObjectSP valobj_backend_sp = m_backend.GetSP(); + if (!valobj_backend_sp) -return false; +return nullptr; ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue(); if (!valobj_sp) -return false; +return nullptr; - ValueObjectSP tuple_sp = + ValueObjectSP obj_child_sp = valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true); + + ValueObjectSP obj_subchild_sp = + obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true); + + // if there is a _M_t subchild, the tuple is found in + // the obj_subchild_sp (for libstdc++ 6.0.23). + if (obj_subchild_sp) { +return obj_subchild_sp; + } + + return obj_child_sp; +} + +bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { + ValueObjectSP tuple_sp = GetTuple(); + if (!tuple_sp) return false; Index: source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp === --- source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -43,6 +43,8 @@ ValueObjectSP m_ptr_obj; ValueObjectSP m_obj_obj; ValueObjectSP m_del_obj; + + ValueObjectSP GetTuple(); }; } // end of anonymous namespace @@ -53,17 +55,34 @@ Update(); } -bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { +ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() { ValueObjectSP valobj_backend_sp = m_backend.GetSP(); + if (!valobj_backend_sp) -return false; +return nullptr; ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue(); if (!valobj_sp) -return false; +return nullptr; - ValueObjectSP tuple_sp = + ValueObjectSP obj_child_sp = valobj_sp->GetChildMemberWithName(ConstString("_M_t"), true); + + ValueObjectSP obj_subchild_sp = + obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true); + + // if there is a _M_t subchild, the tuple is found in + // the obj_subchild_sp (for libstdc++ 6.0.23). + if (obj_subchild_sp) { +return obj_subchild_sp; + } + + return obj_child_sp; +} + +bool LibStdcppUniquePtrSyntheticFrontEnd::Update() { + ValueObjectSP tuple_sp = GetTuple(); + if (!tuple_sp) return false; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326777 - HostThreadPosix::Cancel: remove android-specific implementation
Author: labath Date: Tue Mar 6 04:46:05 2018 New Revision: 326777 URL: http://llvm.org/viewvc/llvm-project?rev=326777&view=rev Log: HostThreadPosix::Cancel: remove android-specific implementation Noone is calling this function on android, so we can just use the generic llvm_unreachable "implementation". Modified: lldb/trunk/source/Host/posix/HostThreadPosix.cpp Modified: lldb/trunk/source/Host/posix/HostThreadPosix.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostThreadPosix.cpp?rev=326777&r1=326776&r2=326777&view=diff == --- lldb/trunk/source/Host/posix/HostThreadPosix.cpp (original) +++ lldb/trunk/source/Host/posix/HostThreadPosix.cpp Tue Mar 6 04:46:05 2018 @@ -41,14 +41,11 @@ Status HostThreadPosix::Join(lldb::threa Status HostThreadPosix::Cancel() { Status error; if (IsJoinable()) { -#ifndef __ANDROID__ #ifndef __FreeBSD__ llvm_unreachable("someone is calling HostThread::Cancel()"); -#endif +#else int err = ::pthread_cancel(m_thread); error.SetError(err, eErrorTypePOSIX); -#else -error.SetErrorString("HostThreadPosix::Cancel() not supported on Android"); #endif } return error; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44056: [lldb] Fix "code unreachable" warning in HostThreadPosix::Cancel
labath added a comment. Since the android part wasn't obviously NFC, I figured I should be the one to do it. And since the pthread_cancel is not available on android, I've had to add the #else clause as well, which should fix the unreachable warning as well. So I guess you could say this got committed as r326777. https://reviews.llvm.org/D44056 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44074: ObjectFileMachO: split CreateSections mega-function into more manageable chunks
labath added a comment. I agree we should move things to the cpp file when possible, and this is possible. I'm going to update the patch before committing. Thanks for the review. https://reviews.llvm.org/D44074 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D42955: Make Module::GetSectionList output consistent
labath added a comment. In https://reviews.llvm.org/D42955#1027142, @clayborg wrote: > Again, we need any objects coming out of the ObjectFile to have the correct > sections. Not sure how we would accomplish that with a solution where the > dSYM file uses it own useless sections. I think we have different definitions of "correct" sections. I agree that the nulled out sections in the dSYM file are (nearly) useless, but I think they are also correct, because that's exactly what's in that object file (and I think a single ObjectFile instance should represent information from a single object file -- nothing more, nothing less). If we need (and we do need) to have a view of combined information from multiple object files, then there should be a separate entity that does that (I think that's what the unified section list is supposed to be). Then, anything that needs to operate on the unified view should be taught to operate on the unified view and not on the individual object files. Now, I have no idea how hard is it to achieve this, but the fact that this is already how things work for elf gives me hope that it will not be that hard. Btw, do you know how much I can rely on the test suite to catch any issues here? I've tried simply commenting out the line where we add the section from the unified list into the dsym file, and all tests still passed. Is there any particular scenario I should look at in more detail? https://reviews.llvm.org/D42955 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326791 - ObjectFileMachO: split CreateSections mega-function into more manageable chunks
Author: labath Date: Tue Mar 6 05:53:26 2018 New Revision: 326791 URL: http://llvm.org/viewvc/llvm-project?rev=326791&view=rev Log: ObjectFileMachO: split CreateSections mega-function into more manageable chunks Summary: In an effort to understand the function's operation, I've split it into logical pieces. Parsing of a single segment is moved to a separate function (and the parsing state that is carried from one segment to another is explicitly captured in the SegmentParsingContext object). I've also extracted some pieces of code which were already standalone (validation of the segment load command, determining the section type, determining segment permissions) into separate functions. Parsing of a single section within the segment should probably also be a separate function, but I've left that for a separate patch. This patch is intended to be NFC. Reviewers: clayborg, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D44074 Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=326791&r1=326790&r2=326791&view=diff == --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Mar 6 05:53:26 2018 @@ -1349,25 +1349,12 @@ bool ObjectFileMachO::IsStripped() { return false; } -void ObjectFileMachO::CreateSections(SectionList &unified_section_list) { - if (m_sections_ap) -return; - - m_sections_ap.reset(new SectionList()); - - const bool is_dsym = (m_header.filetype == MH_DSYM); - lldb::user_id_t segID = 0; - lldb::user_id_t sectID = 0; +ObjectFileMachO::EncryptedFileRanges ObjectFileMachO::GetEncryptedFileRanges() { + EncryptedFileRanges result; lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); - uint32_t i; - const bool is_core = GetType() == eTypeCoreFile; - // bool dump_sections = false; - ModuleSP module_sp(GetModule()); - // First look up any LC_ENCRYPTION_INFO load commands - typedef RangeArray EncryptedFileRanges; - EncryptedFileRanges encrypted_file_ranges; + encryption_info_command encryption_cmd; - for (i = 0; i < m_header.ncmds; ++i) { + for (uint32_t i = 0; i < m_header.ncmds; ++i) { const lldb::offset_t load_cmd_offset = offset; if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL) break; @@ -1381,526 +1368,536 @@ void ObjectFileMachO::CreateSections(Sec EncryptedFileRanges::Entry entry; entry.SetRangeBase(encryption_cmd.cryptoff); entry.SetByteSize(encryption_cmd.cryptsize); - encrypted_file_ranges.Append(entry); + result.Append(entry); } } } offset = load_cmd_offset + encryption_cmd.cmdsize; } - bool section_file_addresses_changed = false; + return result; +} - offset = MachHeaderSizeFromMagic(m_header.magic); +void ObjectFileMachO::SanitizeSegmentCommand(segment_command_64 &seg_cmd, + uint32_t cmd_idx) { + if (m_length == 0 || seg_cmd.filesize == 0) +return; - struct segment_command_64 load_cmd; - for (i = 0; i < m_header.ncmds; ++i) { -const lldb::offset_t load_cmd_offset = offset; -if (m_data.GetU32(&offset, &load_cmd, 2) == NULL) + if (seg_cmd.fileoff > m_length) { +// We have a load command that says it extends past the end of the file. +// This is likely a corrupt file. We don't have any way to return an error +// condition here (this method was likely invoked from something like +// ObjectFile::GetSectionList()), so we just null out the section contents, +// and dump a message to stdout. The most common case here is core file +// debugging with a truncated file. +const char *lc_segment_name = +seg_cmd.cmd == LC_SEGMENT_64 ? "LC_SEGMENT_64" : "LC_SEGMENT"; +GetModule()->ReportWarning( +"load command %u %s has a fileoff (0x%" PRIx64 +") that extends beyond the end of the file (0x%" PRIx64 +"), ignoring this section", +cmd_idx, lc_segment_name, seg_cmd.fileoff, m_length); + +seg_cmd.fileoff = 0; +seg_cmd.filesize = 0; + } + + if (seg_cmd.fileoff + seg_cmd.filesize > m_length) { +// We have a load command that says it extends past the end of the file. +// This is likely a corrupt file. We don't have any way to return an error +// condition here (this method was likely invoked from something like +// ObjectFile::GetSectionList()), so we just null out the section contents, +// and dump a message to stdout. The most common case here is core file +// debugging with a truncated file. +const char *lc
[Lldb-commits] [PATCH] D44074: ObjectFileMachO: split CreateSections mega-function into more manageable chunks
This revision was automatically updated to reflect the committed changes. Closed by commit rL326791: ObjectFileMachO: split CreateSections mega-function into more manageable chunks (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D44074?vs=136932&id=137178#toc Repository: rL LLVM https://reviews.llvm.org/D44074 Files: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp === --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1349,25 +1349,12 @@ return false; } -void ObjectFileMachO::CreateSections(SectionList &unified_section_list) { - if (m_sections_ap) -return; - - m_sections_ap.reset(new SectionList()); - - const bool is_dsym = (m_header.filetype == MH_DSYM); - lldb::user_id_t segID = 0; - lldb::user_id_t sectID = 0; +ObjectFileMachO::EncryptedFileRanges ObjectFileMachO::GetEncryptedFileRanges() { + EncryptedFileRanges result; lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); - uint32_t i; - const bool is_core = GetType() == eTypeCoreFile; - // bool dump_sections = false; - ModuleSP module_sp(GetModule()); - // First look up any LC_ENCRYPTION_INFO load commands - typedef RangeArray EncryptedFileRanges; - EncryptedFileRanges encrypted_file_ranges; + encryption_info_command encryption_cmd; - for (i = 0; i < m_header.ncmds; ++i) { + for (uint32_t i = 0; i < m_header.ncmds; ++i) { const lldb::offset_t load_cmd_offset = offset; if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL) break; @@ -1381,526 +1368,536 @@ EncryptedFileRanges::Entry entry; entry.SetRangeBase(encryption_cmd.cryptoff); entry.SetByteSize(encryption_cmd.cryptsize); - encrypted_file_ranges.Append(entry); + result.Append(entry); } } } offset = load_cmd_offset + encryption_cmd.cmdsize; } - bool section_file_addresses_changed = false; + return result; +} - offset = MachHeaderSizeFromMagic(m_header.magic); +void ObjectFileMachO::SanitizeSegmentCommand(segment_command_64 &seg_cmd, + uint32_t cmd_idx) { + if (m_length == 0 || seg_cmd.filesize == 0) +return; - struct segment_command_64 load_cmd; - for (i = 0; i < m_header.ncmds; ++i) { -const lldb::offset_t load_cmd_offset = offset; -if (m_data.GetU32(&offset, &load_cmd, 2) == NULL) - break; + if (seg_cmd.fileoff > m_length) { +// We have a load command that says it extends past the end of the file. +// This is likely a corrupt file. We don't have any way to return an error +// condition here (this method was likely invoked from something like +// ObjectFile::GetSectionList()), so we just null out the section contents, +// and dump a message to stdout. The most common case here is core file +// debugging with a truncated file. +const char *lc_segment_name = +seg_cmd.cmd == LC_SEGMENT_64 ? "LC_SEGMENT_64" : "LC_SEGMENT"; +GetModule()->ReportWarning( +"load command %u %s has a fileoff (0x%" PRIx64 +") that extends beyond the end of the file (0x%" PRIx64 +"), ignoring this section", +cmd_idx, lc_segment_name, seg_cmd.fileoff, m_length); + +seg_cmd.fileoff = 0; +seg_cmd.filesize = 0; + } + + if (seg_cmd.fileoff + seg_cmd.filesize > m_length) { +// We have a load command that says it extends past the end of the file. +// This is likely a corrupt file. We don't have any way to return an error +// condition here (this method was likely invoked from something like +// ObjectFile::GetSectionList()), so we just null out the section contents, +// and dump a message to stdout. The most common case here is core file +// debugging with a truncated file. +const char *lc_segment_name = +seg_cmd.cmd == LC_SEGMENT_64 ? "LC_SEGMENT_64" : "LC_SEGMENT"; +GetModule()->ReportWarning( +"load command %u %s has a fileoff + filesize (0x%" PRIx64 +") that extends beyond the end of the file (0x%" PRIx64 +"), the segment will be truncated to match", +cmd_idx, lc_segment_name, seg_cmd.fileoff + seg_cmd.filesize, m_length); + +// Truncate the length +seg_cmd.filesize = m_length - seg_cmd.fileoff; + } +} -if (load_cmd.cmd == LC_SEGMENT || load_cmd.cmd == LC_SEGMENT_64) { - if (m_data.GetU8(&offset, (uint8_t *)load_cmd.segname, 16)) { -bool add_section = true; -bool add_to_unified = true; -ConstString const_segname(load_cmd.segname, - std::min(strlen(load_cmd.segname), -
[Lldb-commits] [PATCH] D44139: WIP: Update selected thread after loading mach core
clayborg added a comment. Change looks fine to me. > What's the best/easiest way to test this? You can just run: (lldb) process save-core /tmp/test.core" This will allow you to take any process and save a core file for it from lldb. Then you could obj2yaml it and check that part in. This is only implemented for mach-o right now. But at least that is a way to test something. Like Pavel stated, write a simple OS plug-in that adds a thread with a stop reason and have the test auto select it. Probably best to test that a core file with a stop reason also still selects the thread it used to when there is no OS plug-in to ensure we don't break anything. > Should we also do this for ELF cores? We can. Repository: rL LLVM https://reviews.llvm.org/D44139 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44139: WIP: Update selected thread after loading mach core
JDevlieghere planned changes to this revision. JDevlieghere added a comment. Alright, sounds good. Thank you both for the help! Repository: rL LLVM https://reviews.llvm.org/D44139 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44015: Fix std unique pointer not printing.
alexandreyy added a comment. Thanks, @labath @clayborg . @labath Could you please commit this patch? https://reviews.llvm.org/D44015 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326805 - Rewrite TestTargetSymbolsBuildidCase to be more focused
Author: labath Date: Tue Mar 6 07:56:20 2018 New Revision: 326805 URL: http://llvm.org/viewvc/llvm-project?rev=326805&view=rev Log: Rewrite TestTargetSymbolsBuildidCase to be more focused Summary: The test was failing in remote debugging scenario with windows as a host as cmd.exe is not able to parse the complicated shell commands in the Makefile. The test seemed like a perfect candidate for a more focused testing approach, so I have rewritten in on top of lldb-test's module-sections functionality. The slight gotcha there was that the Module::GetSectionList does not include the sections from the symbol file until someone manually calls Module::GetSymbolVendor. Normally, this is not an issue, because someone will have initialized the symbol vendor by the time anyone starts looking at the sections. However, when all one this is dump the section list, we run into this problem. I've tried making this behavior more automatic, but it turns out it's not that easy, so for now, I just manually initialize the Symbol Vendor before dumping out the sections in lldb-test. Reviewers: jankratochvil Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D42914 Added: lldb/trunk/lit/Modules/build-id-case.yaml Removed: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp Added: lldb/trunk/lit/Modules/build-id-case.yaml URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Modules/build-id-case.yaml?rev=326805&view=auto == --- lldb/trunk/lit/Modules/build-id-case.yaml (added) +++ lldb/trunk/lit/Modules/build-id-case.yaml Tue Mar 6 07:56:20 2018 @@ -0,0 +1,42 @@ +# RUN: mkdir -p %t/.build-id/1b +# RUN: yaml2obj %s > %t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug +# RUN: cd %t +# RUN: llvm-objcopy --strip-all --add-gnu-debuglink=.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/stripped.out +# RUN: lldb-test module-sections %t/stripped.out | FileCheck %s + +# CHECK: Name: .debug_frame +# CHECK-NEXT: VM size: 0 +# CHECK-NEXT: File size: 8 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_X86_64 + Entry: 0x004003D0 +Sections: + - Name:.note.gnu.build-id +Type:SHT_NOTE +Flags: [ SHF_ALLOC ] +Address: 0x00400274 +AddressAlign:0x0004 +Content: 040014000300474E55001B8A73AC238390E32A7FF4AC8EBE4D6A41ECF5C9 + - Name:.text +Type:SHT_PROGBITS +Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +Address: 0x004003D0 +AddressAlign:0x0010 +Content: DEADBEEFBAADF00D + - Name:.debug_frame +Type:SHT_PROGBITS +AddressAlign:0x0008 +Content: DEADBEEFBAADF00D +Symbols: + Local: +- Name:main + Type:STT_FUNC + Section: .text + Value: 0x004003D0 + Size:0x0008 +... Removed: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile?rev=326804&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile (original) +++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile (removed) @@ -1,20 +0,0 @@ -LEVEL = ../../make -C_SOURCES := main.c -LD_EXTRAS += -Wl,--build-id=sha1 - -all: stripped.out - -.PHONY: .build-id -stripped.out .build-id: a.out - $(OBJCOPY) -j .note.gnu.build-id -O binary $< tmp - rm -rf .build-id - fn=`od -An -tx1 http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py?rev=326804&view=auto == --- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py (removed) @@ -1,22 +0,0 @@ -""" Testing separate debug info loading by its .build-id. """ -import os -import time -import lldb -import sys -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestTargetSymbolsBuildidCase(TestBase): - -mydir = TestBase.compute_mydir(__file__) - -@no_de
[Lldb-commits] [PATCH] D42914: Rewrite TestTargetSymbolsBuildidCase to be more focused
This revision was automatically updated to reflect the committed changes. Closed by commit rL326805: Rewrite TestTargetSymbolsBuildidCase to be more focused (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D42914?vs=132851&id=137197#toc Repository: rL LLVM https://reviews.llvm.org/D42914 Files: lldb/trunk/lit/Modules/build-id-case.yaml lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c lldb/trunk/tools/lldb-test/lldb-test.cpp Index: lldb/trunk/tools/lldb-test/lldb-test.cpp === --- lldb/trunk/tools/lldb-test/lldb-test.cpp +++ lldb/trunk/tools/lldb-test/lldb-test.cpp @@ -191,9 +191,11 @@ for (const auto &File : opts::module::InputFilenames) { ModuleSpec Spec{FileSpec(File, false)}; -Spec.GetSymbolFileSpec().SetFile(File, false); auto ModulePtr = std::make_shared(Spec); +// Fetch symbol vendor before we get the section list to give the symbol +// vendor a chance to populate it. +ModulePtr->GetSymbolVendor(); SectionList *Sections = ModulePtr->GetSectionList(); if (!Sections) { llvm::errs() << "Could not load sections for module " << File << "\n"; Index: lldb/trunk/lit/Modules/build-id-case.yaml === --- lldb/trunk/lit/Modules/build-id-case.yaml +++ lldb/trunk/lit/Modules/build-id-case.yaml @@ -0,0 +1,42 @@ +# RUN: mkdir -p %t/.build-id/1b +# RUN: yaml2obj %s > %t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug +# RUN: cd %t +# RUN: llvm-objcopy --strip-all --add-gnu-debuglink=.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/stripped.out +# RUN: lldb-test module-sections %t/stripped.out | FileCheck %s + +# CHECK: Name: .debug_frame +# CHECK-NEXT: VM size: 0 +# CHECK-NEXT: File size: 8 + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_X86_64 + Entry: 0x004003D0 +Sections: + - Name:.note.gnu.build-id +Type:SHT_NOTE +Flags: [ SHF_ALLOC ] +Address: 0x00400274 +AddressAlign:0x0004 +Content: 040014000300474E55001B8A73AC238390E32A7FF4AC8EBE4D6A41ECF5C9 + - Name:.text +Type:SHT_PROGBITS +Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +Address: 0x004003D0 +AddressAlign:0x0010 +Content: DEADBEEFBAADF00D + - Name:.debug_frame +Type:SHT_PROGBITS +AddressAlign:0x0008 +Content: DEADBEEFBAADF00D +Symbols: + Local: +- Name:main + Type:STT_FUNC + Section: .text + Value: 0x004003D0 + Size:0x0008 +... Index: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c === --- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c +++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/main.c @@ -1,3 +0,0 @@ -int main() { - return 0; -} Index: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py === --- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py +++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/TestTargetSymbolsBuildidCase.py @@ -1,22 +0,0 @@ -""" Testing separate debug info loading by its .build-id. """ -import os -import time -import lldb -import sys -from lldbsuite.test.decorators import * -from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil - - -class TestTargetSymbolsBuildidCase(TestBase): - -mydir = TestBase.compute_mydir(__file__) - -@no_debug_info_test # Prevent the genaration of the dwarf version of this test -@skipUnlessPlatform(['linux']) -@skipIf(hostoslist=['windows']) -def test_target_symbols_buildid_case(self): -self.build(clean=True) -exe = self.getBuildArtifact("stripped.out") - -lldbutil.run_to_name_breakpoint(self, "main", exe_name = exe) Index: lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile === --- lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile +++ lldb/trunk/packages/Python/lldbsuite/test/linux/buildidcase/Makefile @@ -1,20 +0,0 @@ -LEVEL = ../../make -C_SOURCES := main.c -LD_EXTRAS += -Wl,--build-id=sha1 -
[Lldb-commits] [PATCH] D44041: Only replace object file sections when non-empty
labath added a comment. Ok, as of r326805 it should be very easy to write a test for this. You can look at the test in that commit for inspiration. Btw, do you happen to know why we have two copies of the section merging code? While working on that patch I noticed an issue that is caused (in part*) by the fact that we merge the sections three times. I've tried to remove the copy in ObjectFileELF, and everything seems to work fine, but our test support coverage for the debug-info-in-separate-file is not that awesome. If you have any other tests for this, I'd appreciate if you can run them before I check that in (I'll send you a patch soon). (*) The problem is that we are replacing the sections by their IDs, but (ELF?) section IDs are unique only if they all come from a single object file. So when we start replacing them the second time round, we end up overwriting random sections. When we replace the sections only once, the code will be technically correct, but the replacement-by-id idea seems still a bit sketchy. https://reviews.llvm.org/D44041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44157: [elf] Remove one copy of the section merging code
labath created this revision. labath added reviewers: fjricci, jankratochvil. Herald added subscribers: arichardson, emaste. Besides being superfluous, this double merging was actually wrong and causing some sections to be added twice. The reason for that was that the code assumes sectoin IDs are unique in the section list, but this is only true if all sections in the list come from the same object file. https://reviews.llvm.org/D44157 Files: lit/Modules/elf-duplicate-section.yaml source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1986,38 +1986,10 @@ } } - if (m_sections_ap.get()) { -if (GetType() == eTypeDebugInfo) { - static const SectionType g_sections[] = { - eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, - eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugCuIndex, - eSectionTypeDWARFDebugFrame,eSectionTypeDWARFDebugInfo, - eSectionTypeDWARFDebugLine, eSectionTypeDWARFDebugLoc, - eSectionTypeDWARFDebugMacInfo, eSectionTypeDWARFDebugPubNames, - eSectionTypeDWARFDebugPubTypes, eSectionTypeDWARFDebugRanges, - eSectionTypeDWARFDebugStr, eSectionTypeDWARFDebugStrOffsets, - eSectionTypeELFSymbolTable, - }; - SectionList *elf_section_list = m_sections_ap.get(); - for (size_t idx = 0; idx < sizeof(g_sections) / sizeof(g_sections[0]); - ++idx) { -SectionType section_type = g_sections[idx]; -SectionSP section_sp( -elf_section_list->FindSectionByType(section_type, true)); -if (section_sp) { - SectionSP module_section_sp( - unified_section_list.FindSectionByType(section_type, true)); - if (module_section_sp) -unified_section_list.ReplaceSection(module_section_sp->GetID(), -section_sp); - else -unified_section_list.AddSection(section_sp); -} - } -} else { - unified_section_list = *m_sections_ap; -} - } + // For eTypeDebugInfo files, the Symbol Vendor will take care of updating the + // unified section list. + if (GetType() != eTypeDebugInfo) +unified_section_list = *m_sections_ap; } // Find the arm/aarch64 mapping symbol character in the given symbol name. Index: lit/Modules/elf-duplicate-section.yaml === --- /dev/null +++ lit/Modules/elf-duplicate-section.yaml @@ -0,0 +1,42 @@ +# RUN: mkdir -p %t/.build-id/1b +# RUN: yaml2obj %s > %t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug +# RUN: cd %t +# RUN: llvm-objcopy --strip-all --add-gnu-debuglink=.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/.build-id/1b/8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9.debug %t/stripped.out +# RUN: lldb-test module-sections %t/stripped.out | FileCheck %s + +# Make sure that the debug_frame section is present only once. +# CHECK: Name: .debug_frame +# CHECK-NOT: .debug_frame + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data:ELFDATA2LSB + Type:ET_EXEC + Machine: EM_X86_64 + Entry: 0x004003D0 +Sections: + - Name:.note.gnu.build-id +Type:SHT_NOTE +Flags: [ SHF_ALLOC ] +Address: 0x00400274 +AddressAlign:0x0004 +Content: 040014000300474E55001B8A73AC238390E32A7FF4AC8EBE4D6A41ECF5C9 + - Name:.text +Type:SHT_PROGBITS +Flags: [ SHF_ALLOC, SHF_EXECINSTR ] +Address: 0x004003D0 +AddressAlign:0x0010 +Content: DEADBEEFBAADF00D + - Name:.debug_frame +Type:SHT_PROGBITS +AddressAlign:0x0008 +Content: DEADBEEFBAADF00D +Symbols: + Local: +- Name:main + Type:STT_FUNC + Section: .text + Value: 0x004003D0 + Size:0x0008 +... Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1986,38 +1986,10 @@ } } - if (m_sections_ap.get()) { -if (GetType() == eTypeDebugInfo) { - static const SectionType g_sections[] = { - eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, - eSectionTypeDWARFDebugAranges, eSectionTypeDWARFDebugCuIndex, - eSectionTypeDWARFDebugFrame,eSectionTypeDWARFDebugInfo, - eSectionTypeDWARFDebugLine, eSectionTypeDWARFDebugLoc, -
[Lldb-commits] [PATCH] D44159: Next batch of test-tree-cleaning changes
labath created this revision. labath added a reviewer: aprantl. Herald added subscribers: mehdi_amini, ki.stfu. The changes here fall into several categories. - some tests were redirecting inferior stdout/err to a file. For these I make sure we use an absolute path for the file. I also create a lldbutil.read_file_on_target helper function to encapsulate the differences between reading a file locally and remotely. - some tests were redirecting the pexpect I/O into a file. For these I use a python StringIO object to avoid creating a file altogether. - the TestSettings inferior was creating a file. Here, I make sure the inferior is launched with pwd=build-dir so that the files end up created there. - lldb-mi --log (used by some tests) creates a log file in PWD without the ability say differently. To make this work I make sure to run lldb-mi with PWD=build_dir. This in turn necessitated a couple of changes in other lldb-mi tests, which were using relative paths to access the source tree. https://reviews.llvm.org/D44159 Files: packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py packages/Python/lldbsuite/test/lldbutil.py packages/Python/lldbsuite/test/settings/TestSettings.py packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py Index: packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py === --- packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py @@ -47,7 +47,7 @@ """Test that 'lldb-mi --interpreter' handles complicated strings.""" # Create an alias for myexe -complicated_myexe = "C--mpl-x file's`s @#$%^&*()_+-={}[]| name" +complicated_myexe = self.getBuildArtifact("C--mpl-x file's`s @#$%^&*()_+-={}[]| name") os.symlink(self.myexe, complicated_myexe) self.addTearDownHook(lambda: os.unlink(complicated_myexe)) Index: packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py === --- packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py @@ -90,7 +90,7 @@ """Test that 'lldb-mi --interpreter %s' loads executable which is specified via relative path.""" # Prepare path to executable -path = os.path.relpath(self.myexe) +path = os.path.relpath(self.myexe, self.getBuildDir()) self.spawnLldbMi(args="%s" % path) # Test that the executable is loaded when file was specified using @@ -249,7 +249,7 @@ def test_lldbmi_log_option(self): """Test that 'lldb-mi --log' creates a log file in the current directory.""" -logDirectory = "." +logDirectory = self.getBuildDir() self.spawnLldbMi(args="%s --log" % self.myexe) # Test that the executable is loaded when file was specified Index: packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py === --- packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py @@ -44,7 +44,7 @@ def spawnLldbMi(self, args=None): import pexpect self.child = pexpect.spawn("%s --interpreter %s" % ( -self.lldbMiExec, args if args else "")) +self.lldbMiExec, args if args else ""), cwd=self.getBuildDir()) self.child.setecho(True) self.mylog = self.getBuildArtifact("child.log") self.child.logfile_read = open(self.mylog, "w") Index: packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py === --- packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py @@ -59,7 +59,7 @@ # Test that -file-exec-and-symbols works for relative path import os -path = os.path.relpath(self.myexe) +path = os.path.relpath(self.myexe, self.getBuildDir()) self.runCmd("-file-exec-and-symbols %s" % path) self.expect("\^done") Index: packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py === --- packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py +++ packages/Python/lldbsuite/
[Lldb-commits] [PATCH] D44164: [SymbolFilePDB] Get line number for PDBSymbolTypeEnum
asmith created this revision. asmith added reviewers: zturner, lldb-commits, rnk. Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D44164 Files: lit/SymbolFile/PDB/enums-layout.test source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -170,14 +170,17 @@ bool GetDeclarationForSymbol(const PDBSymbol &symbol, Declaration &decl) { auto &raw_sym = symbol.getRawSymbol(); - auto lines_up = symbol.getSession().findLineNumbersByAddress( - raw_sym.getVirtualAddress(), raw_sym.getLength()); - if (!lines_up) -return false; - auto first_line_up = lines_up->getNext(); - if (!first_line_up) -return false; - + auto first_line_up = raw_sym.getSrcLineOnTypeDefn(); + + if (!first_line_up) { +auto lines_up = symbol.getSession().findLineNumbersByAddress( +raw_sym.getVirtualAddress(), raw_sym.getLength()); +if (!lines_up) + return false; +first_line_up = lines_up->getNext(); +if (!first_line_up) + return false; + } uint32_t src_file_id = first_line_up->getSourceFileId(); auto src_file_up = symbol.getSession().getSourceFileById(src_file_id); if (!src_file_up) @@ -269,6 +272,7 @@ if (ClangASTContext::StartTagDeclarationDefinition(ast_enum)) ClangASTContext::CompleteTagDeclarationDefinition(ast_enum); +GetDeclarationForSymbol(type, decl); return std::make_shared( type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name), bytes, nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, Index: lit/SymbolFile/PDB/enums-layout.test === --- lit/SymbolFile/PDB/enums-layout.test +++ lit/SymbolFile/PDB/enums-layout.test @@ -8,35 +8,35 @@ CHECK: Module [[CU:.*]] CHECK-DAG: {{^[0-9A-F]+}}: SymbolVendor ([[CU]]) -CHECK: Type{{.*}} , name = "Enum", size = 4, compiler_type = {{.*}} enum Enum { +CHECK: Type{{.*}} , name = "Enum", size = 4, decl = SimpleTypesTest.cpp:19, compiler_type = {{.*}} enum Enum { CHECK-NEXT:RED, CHECK-NEXT:GREEN, CHECK-NEXT:BLUE CHECK-NEXT:} -CHECK: Type{{.*}} , name = "EnumConst", size = 4, compiler_type = {{.*}} enum EnumConst { +CHECK: Type{{.*}} , name = "EnumConst", size = 4, decl = SimpleTypesTest.cpp:22, compiler_type = {{.*}} enum EnumConst { CHECK-NEXT:LOW, CHECK-NEXT:NORMAL, CHECK-NEXT:HIGH CHECK-NEXT:} -CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, compiler_type = {{.*}} enum EnumEmpty { +CHECK: Type{{.*}} , name = "EnumEmpty", size = 4, decl = SimpleTypesTest.cpp:25, compiler_type = {{.*}} enum EnumEmpty { CHECK-NEXT:} -CHECK: Type{{.*}} , name = "EnumUChar", size = 1, compiler_type = {{.*}} enum EnumUChar { +CHECK: Type{{.*}} , name = "EnumUChar", size = 1, decl = SimpleTypesTest.cpp:28, compiler_type = {{.*}} enum EnumUChar { CHECK-NEXT:ON, CHECK-NEXT:OFF, CHECK-NEXT:AUTO CHECK-NEXT:} ; Note that `enum EnumClass` is tested instead of `enum class EnumClass` -CHECK: Type{{.*}} , name = "EnumClass", size = 4, compiler_type = {{.*}} enum EnumClass { +CHECK: Type{{.*}} , name = "EnumClass", size = 4, decl = SimpleTypesTest.cpp:32, compiler_type = {{.*}} enum EnumClass { CHECK-NEXT:YES, CHECK-NEXT:NO, CHECK-NEXT:DEFAULT CHECK-NEXT:} -CHECK: Type{{.*}} , name = "EnumStruct", size = 4, compiler_type = {{.*}} enum EnumStruct { +CHECK: Type{{.*}} , name = "EnumStruct", size = 4, decl = SimpleTypesTest.cpp:35, compiler_type = {{.*}} enum EnumStruct { CHECK-NEXT:red, CHECK-NEXT:blue, CHECK-NEXT:black Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -170,14 +170,17 @@ bool GetDeclarationForSymbol(const PDBSymbol &symbol, Declaration &decl) { auto &raw_sym = symbol.getRawSymbol(); - auto lines_up = symbol.getSession().findLineNumbersByAddress( - raw_sym.getVirtualAddress(), raw_sym.getLength()); - if (!lines_up) -return false; - auto first_line_up = lines_up->getNext(); - if (!first_line_up) -return false; - + auto first_line_up = raw_sym.getSrcLineOnTypeDefn(); + + if (!first_line_up) { +auto lines_up = symbol.getSession().findLineNumbersByAddress( +raw_sym.getVirtualAddress(), raw_sym.getLength()); +if (!lines_up) + return false; +first_line_up = lines_up->getNext(); +if (!first_line_up) + return false; + } uint32_t src_file_id = first_line_up->getSourceFileId(); auto src_file_up = symbol.getSession().getSourceFileById(src_file_id); if (!src_file_up)
[Lldb-commits] [PATCH] D44165: [SymbolFilePDB] Minor cleanup
asmith created this revision. asmith added reviewers: zturner, rnk, lldb-commits. Herald added a subscriber: llvm-commits. - Remove unused code - Adding `break` statement conditionally - Ignore empty strings in FindTypeByName Repository: rL LLVM https://reviews.llvm.org/D44165 Files: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -282,16 +282,12 @@ if (!func_range.GetBaseAddress().IsValid()) return nullptr; - user_id_t func_type_uid = pdb_func->getSignatureId(); - // TODO: Function symbol with invalid signature won't be handled. We'll set up - // a white list to trace them. - if (!pdb_func->getSignature()) -return nullptr; - lldb_private::Type* func_type = ResolveTypeUID(pdb_func->getSymIndexId()); if (!func_type) return nullptr; + user_id_t func_type_uid = pdb_func->getSignatureId(); + Mangled mangled = GetMangledForPDBFunc(pdb_func); FunctionSP func_sp = std::make_shared(sc.comp_unit, @@ -500,7 +496,8 @@ if (result.get()) { m_types.insert(std::make_pair(type_uid, result)); auto type_list = GetTypeList(); -type_list->Insert(result); +if (type_list) + type_list->Insert(result); } return result.get(); } @@ -607,8 +604,8 @@ std::string file_name = pdb_compiland->getSourceFileName(); if (!file_name.empty()) { auto one_src_file_up = - m_session_up->findOneSourceFile(pdb_compiland, file_name, - PDB_NameSearchFlags::NS_CaseInsensitive); +m_session_up->findOneSourceFile(pdb_compiland, file_name, +PDB_NameSearchFlags::NS_CaseInsensitive); if (one_src_file_up) source_file_name = one_src_file_up->getFileName(); } @@ -622,7 +619,7 @@ auto details_up = pdb_compiland->findOneChild(); PDB_Lang pdb_lang = details_up ? details_up->getLanguage() : PDB_Lang::Cpp; auto src_files_up = -m_session_up->getSourceFilesForCompiland(*pdb_compiland); + m_session_up->getSourceFilesForCompiland(*pdb_compiland); if (src_files_up) { while (auto file_up = src_files_up->getNext()) { FileSpec file_spec(file_up->getFileName(), false, @@ -700,9 +697,7 @@ if ((resolve_scope & eSymbolContextLineEntry) && !has_line_table) { // The query asks for line entries, but we can't get them for the // compile unit. This is not normal for `line` = 0. So just assert it. - if (line == 0) { -assert(0 && "Couldn't get all line entries!\n"); - } + assert(line && "Couldn't get all line entries!\n"); // Current compiland does not have the requested line. Search next. continue; @@ -825,14 +820,15 @@ if (auto results_up = m_global_scope_up->findAllChildren()) { while (auto pdb_func_up = results_up->getNext()) { - auto uid = pdb_func_up->getSymIndexId(); + if (pdb_func_up->isCompilerGenerated()) +continue; + auto name = pdb_func_up->getName(); auto demangled_name = pdb_func_up->getUndecoratedName(); if (name.empty() && demangled_name.empty()) continue; - if (pdb_func_up->isCompilerGenerated()) -continue; + auto uid = pdb_func_up->getSymIndexId(); if (!demangled_name.empty() && pdb_func_up->getVirtualAddress()) addr_ids.insert(std::make_pair(pdb_func_up->getVirtualAddress(), uid)); @@ -902,8 +898,6 @@ continue; if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) { -auto demangled_name = pub_sym_up->getUndecoratedName(); -std::vector ids; auto vm_addr = pub_sym_up->getVirtualAddress(); // PDB public symbol has mangled name for its associated function. @@ -1092,6 +1086,8 @@ uint32_t max_matches, lldb_private::TypeMap &types) { std::unique_ptr results; + if (name.empty()) +return; results = m_global_scope_up->findChildren(PDB_SymType::None, name, PDB_NameSearchFlags::NS_Default); if (!results) @@ -1254,17 +1250,21 @@ auto compiland_up = GetPDBCompilandByUID(id); if (!compiland_up) return CompUnitSP(); - std::string path = GetSourceFileNameForPDBCompiland(compiland_up.get()); - if (path.empty()) -return CompUnitSP(); lldb::LanguageType lang; auto details = compiland_up->findOneChild(); if (!details) lang = lldb::eLanguageTypeC_plus_plus; else lang = TranslateLanguage(details->getLanguage()); + if (lang == lldb::LanguageType::eLanguageTypeUnknown) +return CompUnitSP(); + + std::string path = GetSourceFileNameForPDBCompiland(compiland_up.get()); + if (path.empty()) +return CompUnitSP(); +
[Lldb-commits] [PATCH] D44166: [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
asmith created this revision. asmith added reviewers: zturner, rnk, lldb-commits. Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D44166 Files: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -59,6 +59,8 @@ case PDB_BuiltinType::Int: case PDB_BuiltinType::Long: case PDB_BuiltinType::Char: + case PDB_BuiltinType::Char16: + case PDB_BuiltinType::Char32: return lldb::eEncodingSint; case PDB_BuiltinType::Bool: case PDB_BuiltinType::UInt: @@ -126,6 +128,10 @@ if (width == ast->getTypeSize(ast->WCharTy)) return CompilerType(ast, ast->WCharTy); break; + case PDB_BuiltinType::Char16: +return CompilerType(ast, ast->Char16Ty); + case PDB_BuiltinType::Char32: +return CompilerType(ast, ast->Char32Ty); case PDB_BuiltinType::Float: // Note: types `long double` and `double` have same bit size in MSVC and there // is no information in the PDB to distinguish them. So when falling back @@ -162,6 +168,10 @@ return ConstString("HRESULT"); case PDB_BuiltinType::BCD: return ConstString("BCD"); + case PDB_BuiltinType::Char16: +return ConstString("char16_t"); + case PDB_BuiltinType::Char32: +return ConstString("char32_t"); case PDB_BuiltinType::None: return ConstString("..."); } Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -59,6 +59,8 @@ case PDB_BuiltinType::Int: case PDB_BuiltinType::Long: case PDB_BuiltinType::Char: + case PDB_BuiltinType::Char16: + case PDB_BuiltinType::Char32: return lldb::eEncodingSint; case PDB_BuiltinType::Bool: case PDB_BuiltinType::UInt: @@ -126,6 +128,10 @@ if (width == ast->getTypeSize(ast->WCharTy)) return CompilerType(ast, ast->WCharTy); break; + case PDB_BuiltinType::Char16: +return CompilerType(ast, ast->Char16Ty); + case PDB_BuiltinType::Char32: +return CompilerType(ast, ast->Char32Ty); case PDB_BuiltinType::Float: // Note: types `long double` and `double` have same bit size in MSVC and there // is no information in the PDB to distinguish them. So when falling back @@ -162,6 +168,10 @@ return ConstString("HRESULT"); case PDB_BuiltinType::BCD: return ConstString("BCD"); + case PDB_BuiltinType::Char16: +return ConstString("char16_t"); + case PDB_BuiltinType::Char32: +return ConstString("char32_t"); case PDB_BuiltinType::None: return ConstString("..."); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44166: [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
clayborg added a comment. Test? Repository: rL LLVM https://reviews.llvm.org/D44166 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44167: [SymbolFilePDB] Add support for CVR pointer type qualifier
asmith created this revision. asmith added reviewers: zturner, rnk, lldb-commits. Herald added a subscriber: llvm-commits. - Complete element type of PDBSymbolTypeArray. - Add a test to check types of multi-dimensional array and pointers with CVR. Repository: rL LLVM https://reviews.llvm.org/D44167 Files: lit/SymbolFile/PDB/Inputs/TypeQualsTest.cpp lit/SymbolFile/PDB/type-quals.test source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -288,6 +288,9 @@ m_ast.GetSymbolFile()->GetDeclContextForUID(target_type->GetID()); CompilerType ast_typedef = m_ast.CreateTypedefType(target_ast_type, name.c_str(), target_decl_ctx); +if (!ast_typedef) + return nullptr; + return std::make_shared( type_def->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name), bytes, nullptr, target_type->GetID(), @@ -361,20 +364,35 @@ auto array_type = llvm::dyn_cast(&type); assert(array_type); uint32_t num_elements = array_type->getCount(); -uint32_t element_uid = array_type->getElementType()->getSymIndexId(); +uint32_t element_uid = array_type->getElementTypeId(); uint32_t bytes = array_type->getLength(); +// If array rank > 0, PDB gives the element type at N=0. So element type +// will parsed in the order N=0, N=1,..., N=rank sequentially. lldb_private::Type *element_type = m_ast.GetSymbolFile()->ResolveTypeUID(element_uid); if (!element_type) return nullptr; -CompilerType element_ast_type = element_type->GetFullCompilerType(); + +CompilerType element_ast_type = element_type->GetForwardCompilerType(); +// If element type is UDT, it needs to be complete. +if (ClangASTContext::IsCXXClassType(element_ast_type) && +element_ast_type.GetCompleteType() == false) { + if (ClangASTContext::StartTagDeclarationDefinition(element_ast_type)) { +ClangASTContext::CompleteTagDeclarationDefinition(element_ast_type); + } else { +// We are not able to start defintion. +return nullptr; + } +} CompilerType array_ast_type = -m_ast.CreateArrayType(element_ast_type, num_elements, false); -return std::make_shared( +m_ast.CreateArrayType(element_ast_type, num_elements, /*is_gnu_vector*/false); +TypeSP type_sp = std::make_shared( array_type->getSymIndexId(), m_ast.GetSymbolFile(), ConstString(), bytes, nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, array_ast_type, lldb_private::Type::eResolveStateFull); +type_sp->SetEncodingType(element_type); +return type_sp; } break; case PDB_SymType::BuiltinType: { auto *builtin_type = llvm::dyn_cast(&type); @@ -388,20 +406,17 @@ CompilerType builtin_ast_type = GetBuiltinTypeForPDBEncodingAndBitSize( &m_ast, builtin_type, encoding, bytes * 8); -Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID; -if (builtin_type->isConstType()) { - encoding_data_type = Type::eEncodingIsConstUID; +if (builtin_type->isConstType()) builtin_ast_type = builtin_ast_type.AddConstModifier(); -} -if (builtin_type->isVolatileType()) { - encoding_data_type = Type::eEncodingIsVolatileUID; + +if (builtin_type->isVolatileType()) builtin_ast_type = builtin_ast_type.AddVolatileModifier(); -} + auto type_name = GetPDBBuiltinTypeName(builtin_type, builtin_ast_type); return std::make_shared( builtin_type->getSymIndexId(), m_ast.GetSymbolFile(), type_name, -bytes, nullptr, LLDB_INVALID_UID, encoding_data_type, +bytes, nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, builtin_ast_type, lldb_private::Type::eResolveStateFull); } break; case PDB_SymType::PointerType: { @@ -413,18 +428,27 @@ return nullptr; CompilerType pointer_ast_type; -Type::EncodingDataType encoding_data_type = Type::eEncodingIsPointerUID; -if (pointer_type->isReference()) { - encoding_data_type = Type::eEncodingIsLValueReferenceUID; - pointer_ast_type = - pointee_type->GetFullCompilerType().GetLValueReferenceType(); -} else - pointer_ast_type = pointee_type->GetFullCompilerType().GetPointerType(); +pointer_ast_type = pointee_type->GetFullCompilerType(); +if (pointer_type->isReference()) + pointer_ast_type = pointer_ast_type.GetLValueReferenceType(); +else if (pointer_type->getRawSymbol().isRValueReference()) + pointer_ast_type = pointer_ast_type.GetRValueReferenceType(); +else + pointer_ast_type = pointer_ast_type.GetPointerType(); + +if (pointer_type->isConstType()) + pointer_ast_type = pointer_ast_type.AddConstModifier(); + +if (pointer_typ
[Lldb-commits] [PATCH] D44165: [SymbolFilePDB] Minor cleanup
zturner accepted this revision. zturner added inline comments. This revision is now accepted and ready to land. Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:499 auto type_list = GetTypeList(); -type_list->Insert(result); +if (type_list) + type_list->Insert(result); Why would this return `nullptr`? Repository: rL LLVM https://reviews.llvm.org/D44165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326847 - Add test for lldb-mi interpreter
Author: adrian Date: Tue Mar 6 15:25:04 2018 New Revision: 326847 URL: http://llvm.org/viewvc/llvm-project?rev=326847&view=rev Log: Add test for lldb-mi interpreter Test that "lldb-mi --interpreter" can interpret "target list" CLI command. Patch by Alex Polyakov! Differential Revision: https://reviews.llvm.org/D44040 Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py?rev=326847&r1=326846&r2=326847&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py Tue Mar 6 15:25:04 2018 @@ -34,6 +34,26 @@ class MiCliSupportTestCase(lldbmi_testca self.expect("\^running") self.expect("\*stopped,reason=\"breakpoint-hit\"") +@skipIfRemote # We do not currently support remote debugging via the MI. +@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows. +@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races. +def test_lldbmi_target_list(self): +"""Test that 'lldb-mi --interpreter' can list targets by 'target list' command.""" + +self.spawnLldbMi(args=None) + +# Test that initially there are no targets. +self.runCmd("target list") +self.expect(r"~\"No targets.\\n\"") +self.expect("\^done") + +# Add target. +self.runCmd("-file-exec-and-symbols %s" % self.myexe) + +# Test that "target list" lists added target. +self.runCmd("target list") +self.expect(r"~\"Current targets:\\n\* target #0: %s" % self.myexe) + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py?rev=326847&r1=326846&r2=326847&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py Tue Mar 6 15:25:04 2018 @@ -36,6 +36,25 @@ class MiInterpreterExecTestCase(lldbmi_t self.expect("\^running") self.expect("\*stopped,reason=\"breakpoint-hit\"") +@skipIfRemote # We do not currently support remote debugging via the MI. +@skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows. +@skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races. +def test_lldbmi_target_list(self): +"""Test that 'lldb-mi --interpreter' can list targets by 'target list' command.""" + +self.spawnLldbMi(args=None) + +# Test that initially there are no targets. +self.runCmd("-interpreter-exec console \"target list\"") +self.expect(r"~\"No targets.\\n\"") + +# Add target. +self.runCmd("-file-exec-and-symbols %s" % self.myexe) + +# Test that "target list" lists added target. +self.runCmd("-interpreter-exec console \"target list\"") +self.expect(r"~\"Current targets:\\n\* target #0: %s" % self.myexe) + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races @skipIfRemote # We do not currently support remote debugging via the MI. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r326849 - the thread id is easier to read in base16.
Author: jmolenda Date: Tue Mar 6 15:33:02 2018 New Revision: 326849 URL: http://llvm.org/viewvc/llvm-project?rev=326849&view=rev Log: the thread id is easier to read in base16. Modified: lldb/trunk/tools/darwin-threads/examine-threads.c Modified: lldb/trunk/tools/darwin-threads/examine-threads.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/darwin-threads/examine-threads.c?rev=326849&r1=326848&r2=326849&view=diff == --- lldb/trunk/tools/darwin-threads/examine-threads.c (original) +++ lldb/trunk/tools/darwin-threads/examine-threads.c Tue Mar 6 15:33:02 2018 @@ -403,7 +403,7 @@ int main(int argc, char **argv) { int wordsize; uint64_t pc = get_current_pc(thread_list[i], &wordsize); - printf("thread #%d, system-wide-unique-tid %lld, suspend count is %d, ", + printf("thread #%d, system-wide-unique-tid 0x%llx, suspend count is %d, ", i, identifier_info.thread_id, basic_info->suspend_count); if (wordsize == 8) printf("pc 0x%016llx, ", pc); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44182: [SymbolFilePDB] Keep searching until the file name is found for the pdb compiland
asmith created this revision. asmith added reviewers: zturner, rnk, lldb-commits. Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D44182 Files: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -630,9 +630,10 @@ auto file_extension = file_spec.GetFileNameExtension(); if (pdb_lang == PDB_Lang::Cpp || pdb_lang == PDB_Lang::C) { static const char* exts[] = { "cpp", "c", "cc", "cxx" }; -if (llvm::is_contained(exts, file_extension.GetStringRef().lower())) +if (llvm::is_contained(exts, file_extension.GetStringRef().lower())) { source_file_name = file_up->getFileName(); -break; + break; +} } else if (pdb_lang == PDB_Lang::Masm && ConstString::Compare(file_extension, ConstString("ASM"), false) == 0) { Index: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp === --- source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -630,9 +630,10 @@ auto file_extension = file_spec.GetFileNameExtension(); if (pdb_lang == PDB_Lang::Cpp || pdb_lang == PDB_Lang::C) { static const char* exts[] = { "cpp", "c", "cc", "cxx" }; -if (llvm::is_contained(exts, file_extension.GetStringRef().lower())) +if (llvm::is_contained(exts, file_extension.GetStringRef().lower())) { source_file_name = file_up->getFileName(); -break; + break; +} } else if (pdb_lang == PDB_Lang::Masm && ConstString::Compare(file_extension, ConstString("ASM"), false) == 0) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44165: [SymbolFilePDB] Minor cleanup
asmith marked an inline comment as done. asmith added inline comments. Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:499 auto type_list = GetTypeList(); -type_list->Insert(result); +if (type_list) + type_list->Insert(result); zturner wrote: > Why would this return `nullptr`? No idea but it does. TypeList *Module::GetTypeList() { SymbolVendor *symbols = GetSymbolVendor(); if (symbols) return &symbols->GetTypeList(); return nullptr; } Repository: rL LLVM https://reviews.llvm.org/D44165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44166: [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
asmith updated this revision to Diff 137324. asmith added a comment. Add test https://reviews.llvm.org/D44166 Files: lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp lit/SymbolFile/PDB/typedefs.test source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -59,6 +59,8 @@ case PDB_BuiltinType::Int: case PDB_BuiltinType::Long: case PDB_BuiltinType::Char: + case PDB_BuiltinType::Char16: + case PDB_BuiltinType::Char32: return lldb::eEncodingSint; case PDB_BuiltinType::Bool: case PDB_BuiltinType::UInt: @@ -126,6 +128,10 @@ if (width == ast->getTypeSize(ast->WCharTy)) return CompilerType(ast, ast->WCharTy); break; + case PDB_BuiltinType::Char16: +return CompilerType(ast, ast->Char16Ty); + case PDB_BuiltinType::Char32: +return CompilerType(ast, ast->Char32Ty); case PDB_BuiltinType::Float: // Note: types `long double` and `double` have same bit size in MSVC and there // is no information in the PDB to distinguish them. So when falling back @@ -162,6 +168,10 @@ return ConstString("HRESULT"); case PDB_BuiltinType::BCD: return ConstString("BCD"); + case PDB_BuiltinType::Char16: +return ConstString("char16_t"); + case PDB_BuiltinType::Char32: +return ConstString("char32_t"); case PDB_BuiltinType::None: return ConstString("..."); } Index: lit/SymbolFile/PDB/typedefs.test === --- lit/SymbolFile/PDB/typedefs.test +++ lit/SymbolFile/PDB/typedefs.test @@ -14,6 +14,8 @@ CHECK: Module [[MOD:.*]] CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) +CHECK-DAG: name = "char32_t", size = 4, compiler_type = {{.*}} char32_t +CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = {{.*}} unsigned long CHECK-DAG: Type{{.*}} , size = 40, compiler_type = {{.*}} unsigned long [10] CHECK-DAG: Type{{.*}} , name = "ULongArrayTypedef", compiler_type = {{.*}} typedef ULongArrayTypedef Index: lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp === --- lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp +++ lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp @@ -35,6 +35,12 @@ enum struct EnumStruct { red, blue, black }; EnumStruct EnumStructVar; +typedef char16_t WChar16Typedef; +WChar16Typedef WC16Var; + +typedef char32_t WChar32Typedef; +WChar32Typedef WC32Var; + int main() { return 0; } Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -59,6 +59,8 @@ case PDB_BuiltinType::Int: case PDB_BuiltinType::Long: case PDB_BuiltinType::Char: + case PDB_BuiltinType::Char16: + case PDB_BuiltinType::Char32: return lldb::eEncodingSint; case PDB_BuiltinType::Bool: case PDB_BuiltinType::UInt: @@ -126,6 +128,10 @@ if (width == ast->getTypeSize(ast->WCharTy)) return CompilerType(ast, ast->WCharTy); break; + case PDB_BuiltinType::Char16: +return CompilerType(ast, ast->Char16Ty); + case PDB_BuiltinType::Char32: +return CompilerType(ast, ast->Char32Ty); case PDB_BuiltinType::Float: // Note: types `long double` and `double` have same bit size in MSVC and there // is no information in the PDB to distinguish them. So when falling back @@ -162,6 +168,10 @@ return ConstString("HRESULT"); case PDB_BuiltinType::BCD: return ConstString("BCD"); + case PDB_BuiltinType::Char16: +return ConstString("char16_t"); + case PDB_BuiltinType::Char32: +return ConstString("char32_t"); case PDB_BuiltinType::None: return ConstString("..."); } Index: lit/SymbolFile/PDB/typedefs.test === --- lit/SymbolFile/PDB/typedefs.test +++ lit/SymbolFile/PDB/typedefs.test @@ -14,6 +14,8 @@ CHECK: Module [[MOD:.*]] CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) +CHECK-DAG: name = "char32_t", size = 4, compiler_type = {{.*}} char32_t +CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = {{.*}} unsigned long CHECK-DAG: Type{{.*}} , size = 40, compiler_type = {{.*}} unsigned long [10] CHECK-DAG: Type{{.*}} , name = "ULongArrayTypedef", compiler_type = {{.*}} typedef ULongArrayTypedef Index: lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp === --- lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp +++ lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp @@ -35,6 +35,12 @@ enum struct EnumStruct { re
Re: [Lldb-commits] [PATCH] D44166: [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
Lgtm On Tue, Mar 6, 2018 at 9:14 PM Aaron Smith via Phabricator < revi...@reviews.llvm.org> wrote: > asmith updated this revision to Diff 137324. > asmith added a comment. > > Add test > > > https://reviews.llvm.org/D44166 > > Files: > lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp > lit/SymbolFile/PDB/typedefs.test > source/Plugins/SymbolFile/PDB/PDBASTParser.cpp > > > Index: source/Plugins/SymbolFile/PDB/PDBASTParser.cpp > === > --- source/Plugins/SymbolFile/PDB/PDBASTParser.cpp > +++ source/Plugins/SymbolFile/PDB/PDBASTParser.cpp > @@ -59,6 +59,8 @@ >case PDB_BuiltinType::Int: >case PDB_BuiltinType::Long: >case PDB_BuiltinType::Char: > + case PDB_BuiltinType::Char16: > + case PDB_BuiltinType::Char32: > return lldb::eEncodingSint; >case PDB_BuiltinType::Bool: >case PDB_BuiltinType::UInt: > @@ -126,6 +128,10 @@ > if (width == ast->getTypeSize(ast->WCharTy)) >return CompilerType(ast, ast->WCharTy); > break; > + case PDB_BuiltinType::Char16: > +return CompilerType(ast, ast->Char16Ty); > + case PDB_BuiltinType::Char32: > +return CompilerType(ast, ast->Char32Ty); >case PDB_BuiltinType::Float: > // Note: types `long double` and `double` have same bit size in MSVC > and there > // is no information in the PDB to distinguish them. So when falling > back > @@ -162,6 +168,10 @@ > return ConstString("HRESULT"); >case PDB_BuiltinType::BCD: > return ConstString("BCD"); > + case PDB_BuiltinType::Char16: > +return ConstString("char16_t"); > + case PDB_BuiltinType::Char32: > +return ConstString("char32_t"); >case PDB_BuiltinType::None: > return ConstString("..."); >} > Index: lit/SymbolFile/PDB/typedefs.test > === > --- lit/SymbolFile/PDB/typedefs.test > +++ lit/SymbolFile/PDB/typedefs.test > @@ -14,6 +14,8 @@ > > CHECK: Module [[MOD:.*]] > CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) > +CHECK-DAG: name = "char32_t", size = 4, compiler_type = {{.*}} char32_t > +CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t > CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = > {{.*}} unsigned long > CHECK-DAG: Type{{.*}} , size = 40, compiler_type = {{.*}} unsigned long > [10] > CHECK-DAG: Type{{.*}} , name = "ULongArrayTypedef", compiler_type = > {{.*}} typedef ULongArrayTypedef > Index: lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp > === > --- lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp > +++ lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp > @@ -35,6 +35,12 @@ > enum struct EnumStruct { red, blue, black }; > EnumStruct EnumStructVar; > > +typedef char16_t WChar16Typedef; > +WChar16Typedef WC16Var; > + > +typedef char32_t WChar32Typedef; > +WChar32Typedef WC32Var; > + > int main() { >return 0; > } > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D44166: [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
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 rL326875: [SymbolFilePDB] Add missing Char16 and Char32 types in a few places (authored by asmith, committed by ). Changed prior to commit: https://reviews.llvm.org/D44166?vs=137324&id=137325#toc Repository: rL LLVM https://reviews.llvm.org/D44166 Files: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp lldb/trunk/lit/SymbolFile/PDB/typedefs.test lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -59,6 +59,8 @@ case PDB_BuiltinType::Int: case PDB_BuiltinType::Long: case PDB_BuiltinType::Char: + case PDB_BuiltinType::Char16: + case PDB_BuiltinType::Char32: return lldb::eEncodingSint; case PDB_BuiltinType::Bool: case PDB_BuiltinType::UInt: @@ -126,6 +128,10 @@ if (width == ast->getTypeSize(ast->WCharTy)) return CompilerType(ast, ast->WCharTy); break; + case PDB_BuiltinType::Char16: +return CompilerType(ast, ast->Char16Ty); + case PDB_BuiltinType::Char32: +return CompilerType(ast, ast->Char32Ty); case PDB_BuiltinType::Float: // Note: types `long double` and `double` have same bit size in MSVC and there // is no information in the PDB to distinguish them. So when falling back @@ -162,6 +168,10 @@ return ConstString("HRESULT"); case PDB_BuiltinType::BCD: return ConstString("BCD"); + case PDB_BuiltinType::Char16: +return ConstString("char16_t"); + case PDB_BuiltinType::Char32: +return ConstString("char32_t"); case PDB_BuiltinType::None: return ConstString("..."); } Index: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp === --- lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp +++ lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp @@ -35,6 +35,12 @@ enum struct EnumStruct { red, blue, black }; EnumStruct EnumStructVar; +typedef char16_t WChar16Typedef; +WChar16Typedef WC16Var; + +typedef char32_t WChar32Typedef; +WChar32Typedef WC32Var; + int main() { return 0; } Index: lldb/trunk/lit/SymbolFile/PDB/typedefs.test === --- lldb/trunk/lit/SymbolFile/PDB/typedefs.test +++ lldb/trunk/lit/SymbolFile/PDB/typedefs.test @@ -14,6 +14,8 @@ CHECK: Module [[MOD:.*]] CHECK: {{^[0-9A-F]+}}: SymbolVendor ([[MOD]]) +CHECK-DAG: name = "char32_t", size = 4, compiler_type = {{.*}} char32_t +CHECK-DAG: name = "char16_t", size = 2, compiler_type = {{.*}} char16_t CHECK-DAG: Type{{.*}} , name = "unsigned long", size = 4, compiler_type = {{.*}} unsigned long CHECK-DAG: Type{{.*}} , size = 40, compiler_type = {{.*}} unsigned long [10] CHECK-DAG: Type{{.*}} , name = "ULongArrayTypedef", compiler_type = {{.*}} typedef ULongArrayTypedef Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp === --- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -59,6 +59,8 @@ case PDB_BuiltinType::Int: case PDB_BuiltinType::Long: case PDB_BuiltinType::Char: + case PDB_BuiltinType::Char16: + case PDB_BuiltinType::Char32: return lldb::eEncodingSint; case PDB_BuiltinType::Bool: case PDB_BuiltinType::UInt: @@ -126,6 +128,10 @@ if (width == ast->getTypeSize(ast->WCharTy)) return CompilerType(ast, ast->WCharTy); break; + case PDB_BuiltinType::Char16: +return CompilerType(ast, ast->Char16Ty); + case PDB_BuiltinType::Char32: +return CompilerType(ast, ast->Char32Ty); case PDB_BuiltinType::Float: // Note: types `long double` and `double` have same bit size in MSVC and there // is no information in the PDB to distinguish them. So when falling back @@ -162,6 +168,10 @@ return ConstString("HRESULT"); case PDB_BuiltinType::BCD: return ConstString("BCD"); + case PDB_BuiltinType::Char16: +return ConstString("char16_t"); + case PDB_BuiltinType::Char32: +return ConstString("char32_t"); case PDB_BuiltinType::None: return ConstString("..."); } Index: lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp === --- lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp +++ lldb/trunk/lit/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp @@ -35,6 +35,12 @@ enum struct EnumStruct { red, blue, black }; EnumStruct EnumStructVar; +typedef char16_t WChar16Typedef; +WChar16Typedef WC16Var; + +typedef char32_t WChar32Typedef; +WChar32Typedef WC32Var; + int main() {