Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
dawn accepted this revision. dawn added a comment. lgtm. Patch was applied locally and tested with no regressions. Thanks for fixing the patch. http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254593 - [Fix] fix build failure due to rL254588
Author: mohit.bhakkad Date: Thu Dec 3 02:44:33 2015 New Revision: 254593 URL: http://llvm.org/viewvc/llvm-project?rev=254593&view=rev Log: [Fix] fix build failure due to rL254588 Modified: lldb/trunk/include/lldb/Core/Debugger.h Modified: lldb/trunk/include/lldb/Core/Debugger.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=254593&r1=254592&r2=254593&view=diff == --- lldb/trunk/include/lldb/Core/Debugger.h (original) +++ lldb/trunk/include/lldb/Core/Debugger.h Thu Dec 3 02:44:33 2015 @@ -268,6 +268,7 @@ public: enum StopDisassemblyType { eStopDisassemblyTypeNever = 0, +eStopDisassemblyTypeNoDebugInfo, eStopDisassemblyTypeNoSource, eStopDisassemblyTypeAlways }; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254602 - Fix TestLoadUnload for Windows -> POSIX remote debugging
Author: tberghammer Date: Thu Dec 3 05:02:10 2015 New Revision: 254602 URL: http://llvm.org/viewvc/llvm-project?rev=254602&view=rev Log: Fix TestLoadUnload for Windows -> POSIX remote debugging Previously we used sys.os.path for appending target pathes what failed when cased dlopen to fail on the target because of the '\'. The fix won't work for local Windows tests but dlopen don't available on Windows anyway so the test don't make sense in that context. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py?rev=254602&r1=254601&r2=254602&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/load_unload/TestLoadUnload.py Thu Dec 3 05:02:10 2015 @@ -211,7 +211,8 @@ class LoadUnloadTestCase(TestBase): dylibName = 'libloadunload_a.so' if lldb.remote_platform: -dylibPath = os.path.join(shlib_dir, dylibName) +# Don't use os.path.join as we have to use the path separator for the target +dylibPath = shlib_dir + '/' + dylibName else: dylibPath = dylibName ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15172: Fix in-memory section loading for JIT-ed code.
tberghammer accepted this revision. tberghammer added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D15172 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15182: [MIPS] Fix TestCrashDuringStep.py for MIPS
jaydeep created this revision. jaydeep added a reviewer: clayborg. jaydeep added subscribers: bhushan, sagar, mohit.bhakkad, nitesh.jain, lldb-commits. jaydeep set the repository for this revision to rL LLVM. Single stepping requires setting software breakpoint at address 0x0. This results in input/output error instead of SIGSEGV. Using “continue” instead of single stepping avoids setting of software breakpoint at address 0x0. Repository: rL LLVM http://reviews.llvm.org/D15182 Files: packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py Index: packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py === --- packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -43,9 +43,16 @@ thread = process.GetThreadAtIndex(0) self.assertTrue(thread and thread.IsValid(), "Thread is valid") -# Keep stepping until the inferior crashes -while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): -thread.StepInstruction(False) +# Single stepping requires setting software breakpoint at address 0x0. +# This results in input/output error instead of SIGSEGV. Using "continue" +# instead of single stepping avoids setting of software breakpoint at address 0x0. +arch = self.getArchitecture() +if re.match("mips", arch): +self.runCmd("continue") +else: +# Keep stepping until the inferior crashes +while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): +thread.StepInstruction(False) self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has crashed") Index: packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py === --- packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -43,9 +43,16 @@ thread = process.GetThreadAtIndex(0) self.assertTrue(thread and thread.IsValid(), "Thread is valid") -# Keep stepping until the inferior crashes -while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): -thread.StepInstruction(False) +# Single stepping requires setting software breakpoint at address 0x0. +# This results in input/output error instead of SIGSEGV. Using "continue" +# instead of single stepping avoids setting of software breakpoint at address 0x0. +arch = self.getArchitecture() +if re.match("mips", arch): +self.runCmd("continue") +else: +# Keep stepping until the inferior crashes +while process.GetState() == lldb.eStateStopped and not lldbutil.is_thread_crashed(self, thread): +thread.StepInstruction(False) self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) self.assertTrue(lldbutil.is_thread_crashed(self, thread), "Thread has crashed") ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15183: Remove some duplicated code from PlatformPOSIX/Android
tberghammer created this revision. tberghammer added a reviewer: labath. tberghammer added a subscriber: lldb-commits. Herald added subscribers: srhines, danalbert, tberghammer, emaste. Remove some duplicated code from PlatformPOSIX/Android The code was duplicated to handle the custom symbol name for functions in libdl.so for android. This change modify the way we handle the issue to eliminate a lot of duplicated code. http://reviews.llvm.org/D15183 Files: source/Plugins/Platform/Android/PlatformAndroid.cpp source/Plugins/Platform/Android/PlatformAndroid.h source/Plugins/Platform/POSIX/PlatformPOSIX.cpp source/Plugins/Platform/POSIX/PlatformPOSIX.h Index: source/Plugins/Platform/POSIX/PlatformPOSIX.h === --- source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ source/Plugins/Platform/POSIX/PlatformPOSIX.h @@ -191,6 +191,9 @@ const char *expr_prefix, lldb::ValueObjectSP& result_valobj_sp); +virtual const char* +GetLibdlFunctionDeclarations() const; + private: DISALLOW_COPY_AND_ASSIGN (PlatformPOSIX); }; Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp === --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -918,10 +918,7 @@ the_result; )", path); -const char *prefix = R"( -extern "C" void* dlopen (const char *path, int mode); -extern "C" const char *dlerror (void); -)"; +const char *prefix = GetLibdlFunctionDeclarations(); lldb::ValueObjectSP result_valobj_sp; error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); if (error.Fail()) @@ -970,7 +967,7 @@ StreamString expr; expr.Printf("dlclose((void *)0x%" PRIx64 ")", image_addr); -const char *prefix = "extern \"C\" int dlclose(void* handle);\n"; +const char *prefix = GetLibdlFunctionDeclarations(); lldb::ValueObjectSP result_valobj_sp; Error error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); if (error.Fail()) @@ -988,3 +985,14 @@ } return Error(); } + +const char* +PlatformPOSIX::GetLibdlFunctionDeclarations() const +{ +return R"( + extern "C" void* dlopen(const char*, int); + extern "C" void* dlsym(void*, const char*); + extern "C" int dlclose(void*); + extern "C" char* dlerror(void); + )"; +} Index: source/Plugins/Platform/Android/PlatformAndroid.h === --- source/Plugins/Platform/Android/PlatformAndroid.h +++ source/Plugins/Platform/Android/PlatformAndroid.h @@ -84,14 +84,6 @@ uint32_t GetDefaultMemoryCacheLineSize() override; -uint32_t -LoadImage (lldb_private::Process* process, - const lldb_private::FileSpec& image_spec, - lldb_private::Error& error) override; - -lldb_private::Error -UnloadImage (lldb_private::Process* process, uint32_t image_token) override; - protected: const char * GetCacheHostname () override; @@ -106,6 +98,9 @@ DownloadSymbolFile (const lldb::ModuleSP& module_sp, const FileSpec& dst_file_spec) override; +const char* +GetLibdlFunctionDeclarations() const override; + private: std::string m_device_id; uint32_t m_sdk_version; Index: source/Plugins/Platform/Android/PlatformAndroid.cpp === --- source/Plugins/Platform/Android/PlatformAndroid.cpp +++ source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -377,90 +377,13 @@ return m_major_os_version != 0; } -uint32_t -PlatformAndroid::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error) -{ -char path[PATH_MAX]; -image_spec.GetPath(path, sizeof(path)); - -StreamString expr; -expr.Printf(R"( - struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; - the_result.image_ptr = __dl_dlopen ("%s", 2); - if (the_result.image_ptr == (void*)0x0) - the_result.error_str = __dl_dlerror(); - else - the_result.error_str = (const char*)0x0; - the_result; - )", - path); -const char *prefix = R"( -extern "C" void* __dl_dlopen(const char* path, int mode); -extern "C" const char *__dl_dlerror(void); -)"; -lldb::ValueObjectSP result_valobj_sp; -error = Eva
Re: [Lldb-commits] [PATCH] D11465: Fix "process load/unload" on android
tberghammer added a comment. In http://reviews.llvm.org/D11465#300606, @labath wrote: > In http://reviews.llvm.org/D11465#300581, @jingham wrote: > > > It seems like an awful lot of logic is duplicated between the POSIX & > > Android versions of LoadImage when all that really changes is the name of > > the function you are calling. Is it possible to centralize this some more? > > > We've been discussing this offline. I believe Tamas is working on resolving > that. I uploaded http://reviews.llvm.org/D15183 to fix the issue Repository: rL LLVM http://reviews.llvm.org/D11465 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
tberghammer added a comment. What is the opinion about adding just a boolean flag to specify if the path provided is a local path or a remote path? In case it is a remote path (will be the default to keep current behavior) then we don't do any copying and if it is a local path then we copy the library over to the current working directory. On Linux it isn't matter where we install the shared library as we can give full path to dlopen and I think it should be true for all other system so I don't see any advantage of specifying the install directory. Note: I also plan to add a new method to the SB API where we can specify the same information. http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15182: [MIPS] Fix TestCrashDuringStep.py for MIPS
labath added a subscriber: labath. labath added a comment. I believe this defeats the purpose of the whole test, which (I think) is to check that crashes during the actual "step" operation are handled correctly. We already have other tests which test crashing after a "continue" so I don't think this adds any value. A better course of action in my opinion would be to xfail or skip this test. It will be tricky, but I think the proper way to make these kinds of things work with software single stepping is to detect (during the instruction emulation phase) that the instruction will crash (because it jumps to unmapped memory, for instance). Then you can omit putting the breakpoint and just issue the "continue" command normally, and the process will stop anyway because of the signal. This way the higher levels of the debugger (and the user) can be oblivious to the fact that software single stepping is in use, and everything will work normally. But if having this working is not important for you, then I suggest you just go with XFAIL. Repository: rL LLVM http://reviews.llvm.org/D15182 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15183: Remove some duplicated code from PlatformPOSIX/Android
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Looks great, thanks for fixing this. http://reviews.llvm.org/D15183 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254608 - Remove some duplicated code from PlatformPOSIX/Android
Author: tberghammer Date: Thu Dec 3 06:58:03 2015 New Revision: 254608 URL: http://llvm.org/viewvc/llvm-project?rev=254608&view=rev Log: Remove some duplicated code from PlatformPOSIX/Android The code was duplicated to handle the custom symbol name for functions in libdl.so for android. This change modify the way we handle the issue to eliminate a lot of duplicated code. Differential revision: http://reviews.llvm.org/D15183 Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h Modified: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp?rev=254608&r1=254607&r2=254608&view=diff == --- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp (original) +++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp Thu Dec 3 06:58:03 2015 @@ -377,90 +377,13 @@ PlatformAndroid::GetRemoteOSVersion () return m_major_os_version != 0; } -uint32_t -PlatformAndroid::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error) +const char* +PlatformAndroid::GetLibdlFunctionDeclarations() const { -char path[PATH_MAX]; -image_spec.GetPath(path, sizeof(path)); - -StreamString expr; -expr.Printf(R"( - struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; - the_result.image_ptr = __dl_dlopen ("%s", 2); - if (the_result.image_ptr == (void*)0x0) - the_result.error_str = __dl_dlerror(); - else - the_result.error_str = (const char*)0x0; - the_result; - )", - path); -const char *prefix = R"( -extern "C" void* __dl_dlopen(const char* path, int mode); -extern "C" const char *__dl_dlerror(void); -)"; -lldb::ValueObjectSP result_valobj_sp; -error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); -if (error.Fail()) -return LLDB_INVALID_IMAGE_TOKEN; - -error = result_valobj_sp->GetError(); -if (error.Fail()) -return LLDB_INVALID_IMAGE_TOKEN; - -Scalar scalar; -ValueObjectSP image_ptr_sp = result_valobj_sp->GetChildAtIndex(0, true); -if (!image_ptr_sp || !image_ptr_sp->ResolveValue(scalar)) -{ -error.SetErrorStringWithFormat("unable to load '%s'", path); -return LLDB_INVALID_IMAGE_TOKEN; -} - -addr_t image_ptr = scalar.ULongLong(LLDB_INVALID_ADDRESS); -if (image_ptr != 0 && image_ptr != LLDB_INVALID_ADDRESS) -return process->AddImageToken(image_ptr); - -if (image_ptr == 0) -{ -ValueObjectSP error_str_sp = result_valobj_sp->GetChildAtIndex(1, true); -if (error_str_sp && error_str_sp->IsCStringContainer(true)) -{ -DataBufferSP buffer_sp(new DataBufferHeap(10240,0)); -size_t num_chars = error_str_sp->ReadPointedString (buffer_sp, error, 10240).first; -if (error.Success() && num_chars > 0) -error.SetErrorStringWithFormat("dlopen error: %s", buffer_sp->GetBytes()); -else -error.SetErrorStringWithFormat("dlopen failed for unknown reasons."); -return LLDB_INVALID_IMAGE_TOKEN; -} -} -error.SetErrorStringWithFormat("unable to load '%s'", path); -return LLDB_INVALID_IMAGE_TOKEN; -} - -Error -PlatformAndroid::UnloadImage (lldb_private::Process* process, uint32_t image_token) -{ -const addr_t image_addr = process->GetImagePtrFromToken(image_token); -if (image_addr == LLDB_INVALID_ADDRESS) -return Error("Invalid image token"); - -StreamString expr; -expr.Printf("__dl_dlclose((void*)0x%" PRIx64 ")", image_addr); -const char *prefix = "extern \"C\" int __dl_dlclose(void* handle);\n"; -lldb::ValueObjectSP result_valobj_sp; -Error error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); -if (error.Fail()) -return error; - -if (result_valobj_sp->GetError().Fail()) -return result_valobj_sp->GetError(); - -Scalar scalar; -if (result_valobj_sp->ResolveValue(scalar)) -{ -if (scalar.UInt(1)) -return Error("expression failed: \"%s\"", expr.GetData()); -process->ResetImageToken(image_token); -} -return Error(); +return R"( + extern "C" void* dlopen(const char*, int) asm("__dl_dlopen"); + extern "C" void* dlsym(void*, const char*) asm("__dl_dlsym"); + extern "C" int dlclose(v
Re: [Lldb-commits] [PATCH] D15183: Remove some duplicated code from PlatformPOSIX/Android
This revision was automatically updated to reflect the committed changes. Closed by commit rL254608: Remove some duplicated code from PlatformPOSIX/Android (authored by tberghammer). Changed prior to commit: http://reviews.llvm.org/D15183?vs=41735&id=41742#toc Repository: rL LLVM http://reviews.llvm.org/D15183 Files: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.h lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h Index: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp === --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -918,10 +918,7 @@ the_result; )", path); -const char *prefix = R"( -extern "C" void* dlopen (const char *path, int mode); -extern "C" const char *dlerror (void); -)"; +const char *prefix = GetLibdlFunctionDeclarations(); lldb::ValueObjectSP result_valobj_sp; error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); if (error.Fail()) @@ -970,7 +967,7 @@ StreamString expr; expr.Printf("dlclose((void *)0x%" PRIx64 ")", image_addr); -const char *prefix = "extern \"C\" int dlclose(void* handle);\n"; +const char *prefix = GetLibdlFunctionDeclarations(); lldb::ValueObjectSP result_valobj_sp; Error error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); if (error.Fail()) @@ -988,3 +985,14 @@ } return Error(); } + +const char* +PlatformPOSIX::GetLibdlFunctionDeclarations() const +{ +return R"( + extern "C" void* dlopen(const char*, int); + extern "C" void* dlsym(void*, const char*); + extern "C" int dlclose(void*); + extern "C" char* dlerror(void); + )"; +} Index: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h === --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h @@ -191,6 +191,9 @@ const char *expr_prefix, lldb::ValueObjectSP& result_valobj_sp); +virtual const char* +GetLibdlFunctionDeclarations() const; + private: DISALLOW_COPY_AND_ASSIGN (PlatformPOSIX); }; Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp === --- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -377,90 +377,13 @@ return m_major_os_version != 0; } -uint32_t -PlatformAndroid::LoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error) +const char* +PlatformAndroid::GetLibdlFunctionDeclarations() const { -char path[PATH_MAX]; -image_spec.GetPath(path, sizeof(path)); - -StreamString expr; -expr.Printf(R"( - struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; - the_result.image_ptr = __dl_dlopen ("%s", 2); - if (the_result.image_ptr == (void*)0x0) - the_result.error_str = __dl_dlerror(); - else - the_result.error_str = (const char*)0x0; - the_result; - )", - path); -const char *prefix = R"( -extern "C" void* __dl_dlopen(const char* path, int mode); -extern "C" const char *__dl_dlerror(void); -)"; -lldb::ValueObjectSP result_valobj_sp; -error = EvaluateLibdlExpression(process, expr.GetData(), prefix, result_valobj_sp); -if (error.Fail()) -return LLDB_INVALID_IMAGE_TOKEN; - -error = result_valobj_sp->GetError(); -if (error.Fail()) -return LLDB_INVALID_IMAGE_TOKEN; - -Scalar scalar; -ValueObjectSP image_ptr_sp = result_valobj_sp->GetChildAtIndex(0, true); -if (!image_ptr_sp || !image_ptr_sp->ResolveValue(scalar)) -{ -error.SetErrorStringWithFormat("unable to load '%s'", path); -return LLDB_INVALID_IMAGE_TOKEN; -} - -addr_t image_ptr = scalar.ULongLong(LLDB_INVALID_ADDRESS); -if (image_ptr != 0 && image_ptr != LLDB_INVALID_ADDRESS) -return process->AddImageToken(image_ptr); - -if (image_ptr == 0) -{ -ValueObjectSP error_str_sp = result_valobj_sp->GetChildAtIndex(1, true); -if (error_str_sp && error_str_sp->IsCStringContainer(true)) -{ -DataBufferSP buffer_sp(n
[Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber
tberghammer created this revision. tberghammer added reviewers: clayborg, granata.enrico. tberghammer added a subscriber: lldb-commits. Improve the functionality of JSONNumber * Add support for representing signed integers * Add new constructors taking any signed or unsigned integer types http://reviews.llvm.org/D15187 Files: include/lldb/Utility/JSON.h source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp source/Utility/JSON.cpp Index: source/Utility/JSON.cpp === --- source/Utility/JSON.cpp +++ source/Utility/JSON.cpp @@ -60,38 +60,63 @@ s.Printf("\"%s\"", json_string_quote_metachars(m_data).c_str()); } -JSONNumber::JSONNumber () : -JSONValue(JSONValue::Kind::Number), -m_is_integer(true), -m_data(0), -m_double(0.0) +uint64_t +JSONNumber::GetAsUnsigned() const { +switch (m_data_type) +{ +case DataType::Unsigned: +return m_data.m_unsigned; +case DataType::Signed: +return (uint64_t)m_data.m_signed; +case DataType::Double: +return (uint64_t)m_data.m_double; +} } -JSONNumber::JSONNumber (uint64_t i) : -JSONValue(JSONValue::Kind::Number), -m_is_integer(true), -m_data(i), -m_double(0.0) +uint64_t +JSONNumber::GetAsSigned() const { +switch (m_data_type) +{ +case DataType::Unsigned: +return (int64_t)m_data.m_unsigned; +case DataType::Signed: +return m_data.m_signed; +case DataType::Double: +return (int64_t)m_data.m_double; +} } - -JSONNumber::JSONNumber (double d) : -JSONValue(JSONValue::Kind::Number), -m_is_integer(false), -m_data(0), -m_double(d) +double +JSONNumber::GetAsDouble() const { +switch (m_data_type) +{ +case DataType::Unsigned: +return (double)m_data.m_unsigned; +case DataType::Signed: +return (double)m_data.m_signed; +case DataType::Double: +return m_data.m_double; +} } void JSONNumber::Write (Stream& s) { -if (m_is_integer) -s.Printf("%" PRIu64, m_data); -else -s.Printf("%g", m_double); +switch (m_data_type) +{ +case DataType::Unsigned: +s.Printf("%" PRIu64, m_data.m_unsigned); +break; +case DataType::Signed: +s.Printf("%" PRId64, m_data.m_signed); +break; +case DataType::Double: +s.Printf("%g", m_data.m_double); +break; +} } JSONTrue::JSONTrue () : @@ -617,10 +642,20 @@ case JSONParser::Token::Integer: { -bool success = false; -uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success); -if (success) -return JSONValue::SP(new JSONNumber(uval)); +if (value.front() == '-') +{ +bool success = false; +int64_t sval = StringConvert::ToSInt64(value.c_str(), 0, 0, &success); +if (success) +return JSONValue::SP(new JSONNumber(sval)); +} +else +{ +bool success = false; +uint64_t uval = StringConvert::ToUInt64(value.c_str(), 0, 0, &success); +if (success) +return JSONValue::SP(new JSONNumber(uval)); +} } break; Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp === --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -566,7 +566,7 @@ thread_obj_sp->SetObject("tid", std::make_shared(tid)); if (signum != 0) -thread_obj_sp->SetObject("signal", std::make_shared(uint64_t(signum))); +thread_obj_sp->SetObject("signal", std::make_shared(signum)); const std::string thread_name = thread_sp->GetName (); if (! thread_name.empty()) Index: include/lldb/Utility/JSON.h === --- include/lldb/Utility/JSON.h +++ include/lldb/Utility/JSON.h @@ -97,42 +97,74 @@ class JSONNumber : public JSONValue { public: -JSONNumber (); -explicit JSONNumber (uint64_t i); -explicit JSONNumber (double d); +typedef std::shared_ptr SP; + +template {} && + std::is_unsigned{}>::type* = nullptr> +explicit JSONNumber (T u) : +JSONValue(JSONValue::Kind::Number), +m_data_type(DataType::Unsigned) +{ +m_data.m_unsigned = u; +} + +template {} && + std::is_signed{}>::type* = nullptr> +explicit JSONNumber (T s) : +
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
clayborg added a comment. Maybe Platform::LoadImage() should keep its current arguments and the path that is specified should always be correct for the platform. Other code should do the copy over if it needs to and call Platform::LoadImage() with a path that makes sense for the platform. The we can add all the options we want to "process load" to do the installing to a certain location. http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber
clayborg added a comment. Everything looks good, just wondering why we need the template code? See inlined comments. Comment at: include/lldb/Utility/JSON.h:102-104 @@ +101,5 @@ + +template {} && + std::is_unsigned{}>::type* = nullptr> +explicit JSONNumber (T u) : What value is the template code giving us? Why can't we omit this and just have a constructor with int64_t and double? http://reviews.llvm.org/D15187 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber
granata.enrico added a subscriber: granata.enrico. granata.enrico added a comment. IIU my C++ correctly, this code covers neither int64_t nor double; it covers the unsigned variety of int64 - as well as any other unsigned integer type. The main advantage (other than not relying on implicit promotions) would be that if someone writes their new integral data type (BigNum), and mark it with the appropriate traits, it would Just Work - Enrico http://reviews.llvm.org/D15187 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber
IIU my C++ correctly, this code covers neither int64_t nor double; it covers the unsigned variety of int64 - as well as any other unsigned integer type. The main advantage (other than not relying on implicit promotions) would be that if someone writes their new integral data type (BigNum), and mark it with the appropriate traits, it would Just Work - Enrico Sent from my iPhone > On Dec 3, 2015, at 9:34 AM, Greg Clayton wrote: > > clayborg added a comment. > > Everything looks good, just wondering why we need the template code? See > inlined comments. > > > > Comment at: include/lldb/Utility/JSON.h:102-104 > @@ +101,5 @@ > + > +template + typename std::enable_if{} && > + std::is_unsigned{}>::type* = > nullptr> > +explicit JSONNumber (T u) : > > What value is the template code giving us? Why can't we omit this and just > have a constructor with int64_t and double? > > > http://reviews.llvm.org/D15187 > > > ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber
tberghammer added inline comments. Comment at: include/lldb/Utility/JSON.h:102-104 @@ +101,5 @@ + +template {} && + std::is_unsigned{}>::type* = nullptr> +explicit JSONNumber (T u) : clayborg wrote: > What value is the template code giving us? Why can't we omit this and just > have a constructor with int64_t and double? If we have a constructor with int64_t and one with double then we will get a compilation error when we try to call it with an int32_t because the 2 overload will be ambiguous. We can work it around at each call site with casting the value to the type what the constructor takes but I would prefer to handle the issue it in 1 place instead of all call site. http://reviews.llvm.org/D15187 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15187: Improve the functionality of JSONNumber
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Ok, thanks for the explanation. You might add a comment saying something like you just said above the template stuff so people can see why it is needed. http://reviews.llvm.org/D15187 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
tberghammer added a comment. I would like to exposed the ability to specify if we want the specified file to be copied over to the target or not both at the command line and on the SB API. To do this without duplicating the logic what do the file installation into CommandObjectProcess and SBProcess I think we have to keep the logic inside the Platform plugin and then we should change the signature of Platform::LoadImage. One possible solution what can cover all scenario is the following syntax LoadImage(Process* process, const FileSpec& local_file, const FileSpec& remote_file) with the following meaning: - If both file spec is specified then we copy over the file to the target - If only the remote file is specified then we open the specified file from the target - If only the local file is specified the we copy the file over to the current working directory and open it from there http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
clayborg added a comment. I like that solution. http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
clayborg added a comment. Be sure to add nice HeaderDoc to the LoadImage() declaration in Platform.h so everyone knows what is expected. We still might want to split this up so that only Platform has LoadImage and we make everyone else just implement: virtual uint32_t DoLoadImage(lldb_private::Process* process, const FileSpec& image_spec, Error& error); These functions would _only_ load the native "image_spec", but the Platform::LoadImage() would take care of all of the common code that checks the two FileSpec parameters and installs the stuff if needed, then calls through to the DoLoadImage() in subclasses. How does that sound? http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
tberghammer added a comment. Sounds reasonable. The only question is that currently only PlatformPOSIX supports LoadImage. Do we want to add the DoLoadImage function now, or do we want to wait until some other platform also want to implement image loading? http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15183: Remove some duplicated code from PlatformPOSIX/Android
jingham added a comment. Cute! That's much nicer. Repository: rL LLVM http://reviews.llvm.org/D15183 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15152: Change Platform::LoadImage to copy the file to the remote platform
clayborg added a comment. PlatformPOSIX::LoadImage() and PlatformAndroid::LoadImage() should now become PlatformPOSIX::DoLoadImage() and PlatformAndroid::DoLoadImage() and the common code between them removed, add Platform::LoadImage() and move the common code that looks at both FileSpec arguments, does the remote path fixup and install, then call the virtual DoLoadImage(). It is ok to have a base implementation of Platform::DoLoadImage() that returns an error. http://reviews.llvm.org/D15152 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.
sivachandra added a comment. @dawn: Thanks for accepting the patch. I guess I still need to wait for sign-off/comments from a CODE_OWNER. http://reviews.llvm.org/D12809 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254633 - Un XFAIL some tests that are now passing on Windows.
Author: zturner Date: Thu Dec 3 13:20:05 2015 New Revision: 254633 URL: http://llvm.org/viewvc/llvm-project?rev=254633&view=rev Log: Un XFAIL some tests that are now passing on Windows. Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py?rev=254633&r1=254632&r2=254633&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/conditional_break/TestConditionalBreak.py Thu Dec 3 13:20:05 2015 @@ -21,7 +21,6 @@ class ConditionalBreakTestCase(TestBase) mydir = TestBase.compute_mydir(__file__) -@expectedFailureWindows("llvm.org/pr24778") @add_test_categories(['pyapi']) def test_with_python(self): """Exercise some thread and frame APIs to break if c() is called by a().""" Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py?rev=254633&r1=254632&r2=254633&view=diff == --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py Thu Dec 3 13:20:05 2015 @@ -18,7 +18,6 @@ class ThreadSpecificBreakTestCase(TestBa @skipIfFreeBSD # test frequently times out or hangs @expectedFailureFreeBSD('llvm.org/pr18522') # hits break in another thread in testrun -@expectedFailureWindows("llvm.org/pr24777") @add_test_categories(['pyapi']) @expectedFlakeyLinux # this test fails 6/100 dosep runs def test_python(self): ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254634 - Update .gitignore to include __pycache__ directories.
Author: zturner Date: Thu Dec 3 13:20:11 2015 New Revision: 254634 URL: http://llvm.org/viewvc/llvm-project?rev=254634&view=rev Log: Update .gitignore to include __pycache__ directories. Modified: lldb/trunk/.gitignore Modified: lldb/trunk/.gitignore URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/.gitignore?rev=254634&r1=254633&r2=254634&view=diff == --- lldb/trunk/.gitignore (original) +++ lldb/trunk/.gitignore Thu Dec 3 13:20:11 2015 @@ -34,6 +34,7 @@ llvm-build/ *xcuserdata xcshareddata/ test/20* +__pycache__/ # We should ignore Xcode-style embedding of llvm/ at lldb root dir. # Do not add trailing '/'s, they skip symlinks. ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254638 - Fix in-memory section loading for JIT-ed code.
Author: ovyalov Date: Thu Dec 3 13:41:21 2015 New Revision: 254638 URL: http://llvm.org/viewvc/llvm-project?rev=254638&view=rev Log: Fix in-memory section loading for JIT-ed code. http://reviews.llvm.org/D15172 Modified: lldb/trunk/source/Symbol/ObjectFile.cpp Modified: lldb/trunk/source/Symbol/ObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=254638&r1=254637&r2=254638&view=diff == --- lldb/trunk/source/Symbol/ObjectFile.cpp (original) +++ lldb/trunk/source/Symbol/ObjectFile.cpp Thu Dec 3 13:41:21 2015 @@ -537,6 +537,7 @@ ObjectFile::ReadSectionData (const Secti } } } +return GetData(section->GetFileOffset(), section->GetFileSize(), section_data); } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15172: Fix in-memory section loading for JIT-ed code.
ovyalov closed this revision. ovyalov added a comment. Submitted as http://reviews.llvm.org/rL254638 http://reviews.llvm.org/D15172 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3
zturner created this revision. zturner added reviewers: granata.enrico, tfiala. zturner added a subscriber: lldb-commits. I think this patch may require some xcode changes. This is because of the `from six.moves import reload_module`. In the CMake build as part of the swig wrapper python script we symlink the `six` module from `lldb/third_party/Python/modules/six` to be in LLDB's private `lib/site-packages` directory. This way we can `import six` from within lldb. This may not be happening on the Xcode build yet, which if so this will fail on Xcode build. Would someone mind helping me out with this part? LMK if I should submit as is and you fix up the xcode build later, or you want to do it as one patch. http://reviews.llvm.org/D15209 Files: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -286,10 +286,15 @@ PyRun_SimpleString (run_string.GetData()); run_string.Clear(); - run_string.Printf ("run_one_line (%s, 'import copy, keyword, os, re, sys, uuid, lldb')", m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); +// Reloading modules requires a different syntax in Python 2 and Python 3. This provides +// a consistent syntax no matter what version of Python. +run_string.Clear(); +run_string.Printf("run_one_line (%s, 'from six.moves import reload_module')", m_dictionary_name.c_str()); +PyRun_SimpleString(run_string.GetData()); + // WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set // and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task run_string.Clear(); @@ -2626,9 +2631,9 @@ if (was_imported) { if (!was_imported_locally) -command_stream.Printf("import %s ; reload(%s)",basename.c_str(),basename.c_str()); +command_stream.Printf("import %s ; reload_module(%s)",basename.c_str(),basename.c_str()); else -command_stream.Printf("reload(%s)",basename.c_str()); +command_stream.Printf("reload_module(%s)",basename.c_str()); } else command_stream.Printf("import %s",basename.c_str()); Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp === --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -286,10 +286,15 @@ PyRun_SimpleString (run_string.GetData()); run_string.Clear(); - run_string.Printf ("run_one_line (%s, 'import copy, keyword, os, re, sys, uuid, lldb')", m_dictionary_name.c_str()); PyRun_SimpleString (run_string.GetData()); +// Reloading modules requires a different syntax in Python 2 and Python 3. This provides +// a consistent syntax no matter what version of Python. +run_string.Clear(); +run_string.Printf("run_one_line (%s, 'from six.moves import reload_module')", m_dictionary_name.c_str()); +PyRun_SimpleString(run_string.GetData()); + // WARNING: temporary code that loads Cocoa formatters - this should be done on a per-platform basis rather than loading the whole set // and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task run_string.Clear(); @@ -2626,9 +2631,9 @@ if (was_imported) { if (!was_imported_locally) -command_stream.Printf("import %s ; reload(%s)",basename.c_str(),basename.c_str()); +command_stream.Printf("import %s ; reload_module(%s)",basename.c_str(),basename.c_str()); else -command_stream.Printf("reload(%s)",basename.c_str()); +command_stream.Printf("reload_module(%s)",basename.c_str()); } else command_stream.Printf("import %s",basename.c_str()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3
tfiala added a comment. Yep - I can make sure this works on Xcode tonight. I'll either direct send you the diff or incorporate it with what you have here. It probably won't be until much later tonight, but I'll definitely hit this. http://reviews.llvm.org/D15209 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15175: Fix breakpoint language filtering for other C variants (like C99) and Pascal.
jingham requested changes to this revision. jingham added a comment. This revision now requires changes to proceed. If we really can't tell whether a symbol is CPP or Pascal based on the name, then GetLanguageForSymbolByName should be reworked to take a std::vector& in which to return the "possible" language types. Then for Pascal or C++ symbols it should return "Pascal or CPP". Then the rest of the breakpoint filtering would pass the symbol if the requested language was one of the return values in the vector. It would mean "breakpoint set -l pascal/c++" will not limit the breakpoint to only Pascal/C++ symbols, but to Pascal and C++. But by definition we can't do any better here. Alternatively, you could replace GetLanguageForSymbolByName with "GetLanguageForSymbolContext(SymbolContext &sc)" instead, and if there's more info in the Symbol Context that can help you figure out that it is Pascal then you could do a better job that way. This function is currently only used to filter breakpoints, and it always has a SymbolContext, so that would also be appropriate. Or do both... Comment at: source/Breakpoint/BreakpointResolverName.cpp:297-302 @@ -295,2 +296,8 @@ { +// Note: This code prevents us from being able to find symbols +// like 'printf' if the target language's option is set. It +// would be better to limit this filtering to only when the +// breakpoint's language option is set (and not the target's), +// but we can't know if m_language was set from the target or +// breakpoint option. remove_it = true; Maybe it is not appropriate to use Target::GetLanguage to prime the breakpoint language (in the Target::CreateBreakpoint* routines.) I was never really clear what the target level language setting was for. But if it isn't appropriate to seed the breakpoint language with the target language, I'm fine with the breakpoint language defaulting to eLanguageTypeAny and then you will only get breakpoint language filtering if you call it out explicitly. Repository: rL LLVM http://reviews.llvm.org/D15175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254666 - Add a newline at the end of this file
Author: enrico Date: Thu Dec 3 17:53:45 2015 New Revision: 254666 URL: http://llvm.org/viewvc/llvm-project?rev=254666&view=rev Log: Add a newline at the end of this file Modified: lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=254666&r1=254665&r2=254666&view=diff == --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Thu Dec 3 17:53:45 2015 @@ -6527,4 +6527,4 @@ Process::ResetImageToken(size_t token) { if (token < m_image_tokens.size()) m_image_tokens[token] = LLDB_INVALID_IMAGE_TOKEN; -} \ No newline at end of file +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.
amccarth created this revision. amccarth added a reviewer: zturner. amccarth added a subscriber: lldb-commits. Also tweaked process save-core to include the memory info list so that we can see the regions in the list. There are no commands or SBInterfaces yet that make it possible to test this directly, but I'll look for an opportunity to do so as I continue to work toward working backtraces from mini dumps. http://reviews.llvm.org/D15218 Files: source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h === --- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h +++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h @@ -84,6 +84,9 @@ lldb_private::ArchSpec GetArchitecture(); +lldb_private::Error +GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &range_info) override; + protected: void Clear(); Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp === --- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp +++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp @@ -27,6 +27,7 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/DynamicLoader.h" +#include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Target/UnixSignals.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" @@ -272,6 +273,60 @@ return overlap; } + +Error +ProcessWinMiniDump::GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &info) +{ +Error error; +size_t size; +const auto list = reinterpret_cast(FindDumpStream(MemoryInfoListStream, &size)); +if (list == nullptr || size < sizeof(MINIDUMP_MEMORY_INFO_LIST)) +{ +error.SetErrorString("the mini dump contains no memory range information"); +return error; +} + +if (list->SizeOfEntry < sizeof(MINIDUMP_MEMORY_INFO)) +{ +error.SetErrorString("the entries in the mini dump memory info list are smaller than expected"); +return error; +} + +if (size < list->SizeOfHeader + list->SizeOfEntry * list->NumberOfEntries) +{ +error.SetErrorString("the mini dump memory info list is incomplete"); +return error; +} + +const auto entries = reinterpret_cast(reinterpret_cast(list) + list->SizeOfHeader); + +for (int i = 0; i < list->NumberOfEntries; ++i) +{ +const auto entry = reinterpret_cast(reinterpret_cast(list) + list->SizeOfHeader + i*list->SizeOfEntry); +const auto head = entry->BaseAddress; +const auto tail = head + entry->RegionSize; +if (head <= load_addr && load_addr < tail) +{ +// The Windows page protection bits are not independent masks that can +// be bitwise-ORed together. For example, PAGE_EXECUTE_READ is not +// (PAGE_EXECUTE | PAGE_READ). To test for an access type, it's +// necessary to test for any of the bits that provide that access type. +const bool readable = entry->Protect & (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READONLY | PAGE_READWRITE); +info.SetReadable(readable ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo); +const bool writable = entry->Protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_READWRITE | PAGE_WRITECOPY); +info.SetWritable(writable ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo); +const bool executable = entry->Protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY); +info.SetExecutable(executable ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo); +return error; +} +} +// Note that the memory info list doesn't seem to contain ranges in kernel space, +// so if you're walking a stack that has kernel frames, the stack may appear +// truncated. +error.SetErrorString("address is not in a known range"); +return error; +} + void ProcessWinMiniDump::Clear() { Index: source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp === --- source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp +++ source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp @@ -39,7 +39,7 @@ return false; } HANDLE file_handle = ::CreateFileW(wide_name.c_str(), GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); -const auto result = ::MiniDumpWriteDump(process_handle, process_sp->GetID(), file_handle, MiniDumpNormal, NULL, NULL, NULL); +const auto result = ::MiniDumpWriteDump(proc
Re: [Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.
amccarth updated this revision to Diff 41828. amccarth added a comment. Ran clang-format and removed initialization of a local variable that was no longer used. Note that clang-format re-ordered the include because the change added one include. http://reviews.llvm.org/D15218 Files: source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h === --- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h +++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h @@ -84,7 +84,10 @@ lldb_private::ArchSpec GetArchitecture(); -protected: +lldb_private::Error GetMemoryRegionInfo(lldb::addr_t load_addr, +lldb_private::MemoryRegionInfo &range_info) override; + + protected: void Clear(); Index: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp === --- source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp +++ source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp @@ -17,21 +17,22 @@ #include #include -#include "lldb/Core/PluginManager.h" +#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" +#include "lldb/Core/DataBufferHeap.h" +#include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/PluginManager.h" #include "lldb/Core/Section.h" #include "lldb/Core/State.h" -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/Log.h" +#include "lldb/Target/DynamicLoader.h" +#include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" -#include "lldb/Target/DynamicLoader.h" #include "lldb/Target/UnixSignals.h" +#include "llvm/Support/ConvertUTF.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Support/ConvertUTF.h" -#include "Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h" #include "ExceptionRecord.h" #include "ThreadWinMiniDump.h" @@ -272,6 +273,61 @@ return overlap; } +Error +ProcessWinMiniDump::GetMemoryRegionInfo(lldb::addr_t load_addr, lldb_private::MemoryRegionInfo &info) +{ +Error error; +size_t size; +const auto list = reinterpret_cast(FindDumpStream(MemoryInfoListStream, &size)); +if (list == nullptr || size < sizeof(MINIDUMP_MEMORY_INFO_LIST)) +{ +error.SetErrorString("the mini dump contains no memory range information"); +return error; +} + +if (list->SizeOfEntry < sizeof(MINIDUMP_MEMORY_INFO)) +{ +error.SetErrorString("the entries in the mini dump memory info list are smaller than expected"); +return error; +} + +if (size < list->SizeOfHeader + list->SizeOfEntry * list->NumberOfEntries) +{ +error.SetErrorString("the mini dump memory info list is incomplete"); +return error; +} + +for (int i = 0; i < list->NumberOfEntries; ++i) +{ +const auto entry = reinterpret_cast(reinterpret_cast(list) + + list->SizeOfHeader + i * list->SizeOfEntry); +const auto head = entry->BaseAddress; +const auto tail = head + entry->RegionSize; +if (head <= load_addr && load_addr < tail) +{ +// The Windows page protection bits are not independent masks that can +// be bitwise-ORed together. For example, PAGE_EXECUTE_READ is not +// (PAGE_EXECUTE | PAGE_READ). To test for an access type, it's +// necessary to test for any of the bits that provide that access type. +const bool readable = +entry->Protect & (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READONLY | PAGE_READWRITE); +info.SetReadable(readable ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo); +const bool writable = +entry->Protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY | PAGE_READWRITE | PAGE_WRITECOPY); +info.SetWritable(writable ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo); +const bool executable = +entry->Protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY); +info.SetExecutable(executable ? MemoryRegionInfo::eYes : MemoryRegionInfo::eNo); +return error; +} +} +// Note that the memory info list doesn't seem to contain ranges in kernel space, +// so if you're walking a stack that has kernel frames, the stack may appear +// truncated. +error.SetErrorString("address is not in a known range"); +return error; +} + void ProcessWinMiniDump::Clear() { Index: sour
Re: [Lldb-commits] [PATCH] D15218: Implement GetMemoryRegionInfo for mini dumps.
zturner added inline comments. Comment at: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp:312 @@ +311,3 @@ +// necessary to test for any of the bits that provide that access type. +const bool readable = +entry->Protect & (PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE | PAGE_READONLY | PAGE_READWRITE); `ProcessWindowsLive::GetMemoryRegionInfo` already has this same logic built in. Would it be worth putting something in `Plugins/Process/Windows/Common` that does this conversion and then calling into it from both here and `ProcessWindowsLive`? Comment at: source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.h:87-88 @@ -86,2 +86,4 @@ -protected: +lldb_private::Error GetMemoryRegionInfo(lldb::addr_t load_addr, +lldb_private::MemoryRegionInfo &range_info) override; + Oh yea, I forgot to mention. `clang-format` screws this up currently. You'll have to fix this part manually :( I keep meaning to go look at clang-format's source and make it support return type on new line, but so far you have to fix these manually. http://reviews.llvm.org/D15218 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r254698 - Add a space char so step logging doesn't print things like
Author: jmolenda Date: Thu Dec 3 20:52:49 2015 New Revision: 254698 URL: http://llvm.org/viewvc/llvm-project?rev=254698&view=rev Log: Add a space char so step logging doesn't print things like "Stepping out from a.out`bar at a.c:3returning to frame" Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=254698&r1=254697&r2=254698&view=diff == --- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Thu Dec 3 20:52:49 2015 @@ -192,7 +192,7 @@ ThreadPlanStepOut::GetDescription (Strea // FIXME: find some useful way to present the m_return_id, since there may be multiple copies of the // same function on the stack. -s->Printf ("returning to frame at "); +s->Printf (" returning to frame at "); if (tmp_address.SetLoadAddress (m_return_addr, &GetTarget())) { tmp_address.Dump(s, &GetThread(), Address::DumpStyleResolvedDescription, Address::DumpStyleLoadAddress); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15209: Fix script import --allow-reload on Python 3
tfiala added a comment. Doesn't look like I can hit this until the morning. But it'll be first thing on my list. http://reviews.llvm.org/D15209 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15175: Fix breakpoint language filtering for other C variants (like C99) and Pascal.
dawn added a comment. Jim, this patch doesn't attempt to fix the issue I raised in my comment - it just fixes the oversight of other C variants (clang picks C99 for example) and renames your function to a more meaningful name (and matches Mangled::GuessLanguage which is also uses the name to guess the language). I see no reason why to reject it. I didn't want to try and tackle the bigger problem in this patch, but wanted to raise the question so I might know how to resolve it in a different patch. Thank you for the feedback however - I like your "Any" suggestion and will submit another patch for it. Please accept this patch? Repository: rL LLVM http://reviews.llvm.org/D15175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15182: [MIPS] Fix TestCrashDuringStep.py for MIPS
jaydeep updated this revision to Diff 41840. jaydeep added a comment. Marked as XFAIL Repository: rL LLVM http://reviews.llvm.org/D15182 Files: packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py Index: packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py === --- packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -21,6 +21,7 @@ @expectedFailureWindows("llvm.org/pr24778") @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64']) +@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])# IO error due to breakpoint at invalid address def test_step_inst_with(self): """Test thread creation during step-inst handling.""" self.build(dictionary=self.getBuildFlags()) Index: packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py === --- packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py +++ packages/Python/lldbsuite/test/functionalities/thread/crash_during_step/TestCrashDuringStep.py @@ -21,6 +21,7 @@ @expectedFailureWindows("llvm.org/pr24778") @expectedFailureAndroid("llvm.org/pr24497", archs=['arm', 'aarch64']) +@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])# IO error due to breakpoint at invalid address def test_step_inst_with(self): """Test thread creation during step-inst handling.""" self.build(dictionary=self.getBuildFlags()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15065: Define new builder_netbsd
tfiala accepted this revision. tfiala added a comment. This revision is now accepted and ready to land. I'm not sure exactly how these were divided up initially, but I'd suspect a substantial amount of it is similar along the vein of POSIX vs. non-POSIX, probably with some diffs for OS X supporting frameworks, dsyms, etc. More than likely this fracturing happened because it was first just OS X, then some combo of FreeBSD and Linux. I'd be okay with this as is for now, but we should probably file a bugzilla to go back and see if at least the Linux, FreeBSD and NetBSD ones can be combined (and perhaps even OS X). But I'd need to spend some time looking, which I haven't done here. Repository: rL LLVM http://reviews.llvm.org/D15065 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D14944: [LLDB][MIPS] Marking some expected failures
mohit.bhakkad updated this revision to Diff 41843. mohit.bhakkad added a comment. Addressed comments Repository: rL LLVM http://reviews.llvm.org/D14944 Files: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py Index: packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -54,17 +54,6 @@ error.GetCString()) self.assertTrue(read_watchpoint, "Failed to set read watchpoint.") -write_value = frame.FindValue('g_watch_me_write', - lldb.eValueTypeVariableGlobal) -self.assertTrue(write_value, "Failed to find write value.") - -# resolve_location=True, read=False, write=True -write_watchpoint = write_value.Watch(True, False, True, error) -self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") -self.assertTrue(error.Success(), -"Error while setting watchpoint: %s" % -error.GetCString()) - thread.StepOver() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, STOPPED_DUE_TO_WATCHPOINT) @@ -77,6 +66,22 @@ self.step_inst_for_watchpoint(1) +write_value = frame.FindValue('g_watch_me_write', + lldb.eValueTypeVariableGlobal) +self.assertTrue(write_value, "Failed to find write value.") + +# Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet +arch = self.getArchitecture() +if arch in ['mips', 'mipsel', 'mips64', 'mips64el']: +self.runCmd("watchpoint delete 1") + +# resolve_location=True, read=False, write=True +write_watchpoint = write_value.Watch(True, False, True, error) +self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") +self.assertTrue(error.Success(), +"Error while setting watchpoint: %s" % +error.GetCString()) + thread.StepOver() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, STOPPED_DUE_TO_WATCHPOINT) Index: packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py @@ -31,6 +31,7 @@ @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported @expectedFailureWindows("llvm.org/pr24446") # WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows +@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # Most of the MIPS boards provide only one H/W watchpoints, and S/W watchpoints are not supported yet def test_hello_watchlocation(self): """Test watching a location with '-s size' option.""" self.build(dictionary=self.d) Index: packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py === --- packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py +++ packages/Python/lldbsuite/test/functionalities/watchpoint/step_over_watchpoint/TestStepOverWatchpoint.py @@ -54,17 +54,6 @@ error.GetCString()) self.assertTrue(read_watchpoint, "Failed to set read watchpoint.") -write_value = frame.FindValue('g_watch_me_write', - lldb.eValueTypeVariableGlobal) -self.assertTrue(write_value, "Failed to find write value.") - -# resolve_location=True, read=False, write=True -write_watchpoint = write_value.Watch(True, False, True, error) -self.assertTrue(read_watchpoint, "Failed to set write watchpoint.") -self.assertTrue(error.Success(), -"Error while setting watchpoint: %s" % -error.GetCString()) - thread.StepOver() self.assertTrue(thread.GetStopReason() == lldb.eStopReasonWatchpoint, STOPPED_DUE_TO_WATCHPOINT) @@ -77,6 +66,22 @@ self.step_inst_for_watchpoint(1) +write_value = frame.FindValue('g_watch_me_write', +