[Lldb-commits] [lldb] r190698 - test: Update FreeBSD failure decorators
Author: emaste Date: Fri Sep 13 10:34:59 2013 New Revision: 190698 URL: http://llvm.org/viewvc/llvm-project?rev=190698view=rev Log: test: Update FreeBSD failure decorators llvm.org/pr15261 missing size for static arrays llvm.org/pr15278 expressions generating signals llvm.org/pr15824 thread states aren't properly maintained llvm.org/pr16696 threaded inferior debugging not yet on FreeBSD llvm.org/pr17214 inline stepping fails on FreeBSD llvm.org/pr17225 Clang assertion failure llvm.org/pr17226 frame info lost after failed expression evaluation llvm.org/pr17228 test timeout The first three are existing Linux issues that also affect FreeBSD. Modified: lldb/trunk/test/api/multithreaded/TestMultithreaded.py lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py lldb/trunk/test/functionalities/inferior-assert/TestInferiorAssert.py lldb/trunk/test/functionalities/inline-stepping/TestInlineStepping.py lldb/trunk/test/functionalities/thread/state/TestThreadStates.py lldb/trunk/test/lang/c/stepping/TestStepAndBreakpoints.py lldb/trunk/test/lang/cpp/class_static/TestStaticVariables.py lldb/trunk/test/lang/cpp/dynamic-value/TestDynamicValue.py Modified: lldb/trunk/test/api/multithreaded/TestMultithreaded.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/multithreaded/TestMultithreaded.py?rev=190698r1=190697r2=190698view=diff == --- lldb/trunk/test/api/multithreaded/TestMultithreaded.py (original) +++ lldb/trunk/test/api/multithreaded/TestMultithreaded.py Fri Sep 13 10:34:59 2013 @@ -19,6 +19,7 @@ class SBBreakpointCallbackCase(TestBase) self.addTearDownHook(lambda: os.remove(self.inferior)) @unittest2.expectedFailure # llvm.org/pr16000: SBBreakpoint.SetCallback() does nothing +@skipIfFreeBSD # llvm.org/pr16696 - also build issues with libstdc++ on FreeBSD 10.0 @skipIfi386 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11 def test_breakpoint_callback(self): @@ -26,6 +27,7 @@ class SBBreakpointCallbackCase(TestBase) self.build_and_test('driver.cpp test_breakpoint_callback.cpp', 'test_breakpoint_callback') +@skipIfFreeBSD # llvm.org/pr16696 @skipIfi386 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11 def test_sb_api_listener_event_description(self): @@ -34,6 +36,7 @@ class SBBreakpointCallbackCase(TestBase) 'test_listener_event_description') pass +@skipIfFreeBSD # llvm.org/pr16696 @skipIfi386 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11 def test_sb_api_listener_event_process_state(self): @@ -45,6 +48,7 @@ class SBBreakpointCallbackCase(TestBase) pass +@skipIfFreeBSD # llvm.org/pr16696 @skipIfi386 @skipIfLinuxClang # buildbot clang version unable to use libstdc++ with c++11 @skipIfLinux # llvm.org/pr16016 assertion failure in ProcessPOSIX.cpp. Modified: lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py?rev=190698r1=190697r2=190698view=diff == --- lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py (original) +++ lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py Fri Sep 13 10:34:59 2013 @@ -26,6 +26,7 @@ class ExprCommandWithTimeoutsTestCase(Te self.buildDsym() self.call_function() +@skipIfFreeBSD # llvm.org/pr15278 @skipIfLinux # llvm.org/pr15278: handle expressions that generate signals on Linux @dwarf_test def test_with_dwarf(self): Modified: lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py?rev=190698r1=190697r2=190698view=diff == --- lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py (original) +++ lldb/trunk/test/functionalities/embedded_interpreter/TestConvenienceVariables.py Fri Sep 13 10:34:59 2013 @@ -18,6 +18,7 @@ class ConvenienceVariablesCase(TestBase) self.convenience_variables() @dwarf_test +@skipIfFreeBSD # llvm.org/pr17228 @skipIfLinux # llvm.org/pr14637: this test case fails sometimes because the input prompt (lldb) is missing def test_with_dwarf_and_run_commands(self): Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame. Modified:
[Lldb-commits] [lldb] r190727 - This fixes two issues with the POSIX dynamic loader:
Author: mkopec Date: Fri Sep 13 17:14:50 2013 New Revision: 190727 URL: http://llvm.org/viewvc/llvm-project?rev=190727view=rev Log: This fixes two issues with the POSIX dynamic loader: 1. existing breakpoints weren't being re-resolved after the sections of a library were loaded (ie. through dlopen). 2. loaded sections weren't being removed after a shared library had been unloaded. Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=190727r1=190726r2=190727view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Fri Sep 13 17:14:50 2013 @@ -211,9 +211,11 @@ DynamicLoaderPOSIXDYLD::CanLoadImage() void DynamicLoaderPOSIXDYLD::UpdateLoadedSections(ModuleSP module, addr_t base_addr) { -ObjectFile *obj_file = module-GetObjectFile(); -SectionList *sections = obj_file-GetSectionList(); SectionLoadList load_list = m_process-GetTarget().GetSectionLoadList(); +const SectionList *sections = GetSectionListFromModule(module); + +assert(sections SectionList missing from loaded module.); + const size_t num_sections = sections-GetSize(); for (unsigned i = 0; i num_sections; ++i) @@ -234,6 +236,22 @@ DynamicLoaderPOSIXDYLD::UpdateLoadedSect } void +DynamicLoaderPOSIXDYLD::UnloadSections(const ModuleSP module) +{ +SectionLoadList load_list = m_process-GetTarget().GetSectionLoadList(); +const SectionList *sections = GetSectionListFromModule(module); + +assert(sections SectionList missing from unloaded module.); + +const size_t num_sections = sections-GetSize(); +for (auto i = 0; i num_sections; ++i) +{ +SectionSP section_sp (sections-GetSectionAtIndex(i)); +load_list.SetSectionUnloaded(section_sp); +} +} + +void DynamicLoaderPOSIXDYLD::ProbeEntry() { Breakpoint *entry_break; @@ -321,8 +339,12 @@ DynamicLoaderPOSIXDYLD::RefreshModules() FileSpec file(I-path.c_str(), true); ModuleSP module_sp = LoadModuleAtAddress(file, I-base_addr); if (module_sp.get()) +{ loaded_modules.AppendIfNeeded(module_sp); +new_modules.Append(module_sp); +} } +m_process-GetTarget().ModulesDidLoad(new_modules); } if (m_rendezvous.ModulesDidUnload()) @@ -336,10 +358,15 @@ DynamicLoaderPOSIXDYLD::RefreshModules() ModuleSpec module_spec (file); ModuleSP module_sp = loaded_modules.FindFirstModule (module_spec); + if (module_sp.get()) +{ old_modules.Append(module_sp); +UnloadSections(module_sp); +} } loaded_modules.Remove(old_modules); +m_process-GetTarget().ModulesDidUnload(old_modules); } } @@ -479,3 +506,18 @@ DynamicLoaderPOSIXDYLD::GetEntryPoint() m_entry_point = static_castaddr_t(I-value); return m_entry_point; } + +const SectionList * +DynamicLoaderPOSIXDYLD::GetSectionListFromModule(const ModuleSP module) const +{ +SectionList *sections = nullptr; +if (module.get()) +{ +ObjectFile *obj_file = module-GetObjectFile(); +if (obj_file) +{ +sections = obj_file-GetSectionList(); +} +} +return sections; +} Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h?rev=190727r1=190726r2=190727view=diff == --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h (original) +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h Fri Sep 13 17:14:50 2013 @@ -122,6 +122,12 @@ protected: UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t base_addr = 0); +/// Removes the loaded sections from the target in @p module. +/// +/// @param module The module to traverse. +void +UnloadSections(const lldb::ModuleSP module); + /// Locates or creates a module given by @p file and updates/loads the /// resulting module at the virtual base address @p base_addr. lldb::ModuleSP @@ -165,6 +171,9 @@ protected: private: DISALLOW_COPY_AND_ASSIGN(DynamicLoaderPOSIXDYLD); + +const lldb_private::SectionList * +GetSectionListFromModule(const
[Lldb-commits] [PATCH] Improve stability of ProcessMonitor -- use a thread-safe queue instead of file descriptors with unchecked read/write calls to transfer Operation* between threads.
This commit simplifies the Linux ProcessMonitor: - DoOperation() and ServeOperation() no longer depend on file descriptors! - remove EnableIPC() helper. ProcessMonitor will not have to run as a separate process. - added a semaphore to signal when an operation is complete (previously signaling happened through a file descriptor) - under heavy stress tests (i.e. running tests while compiling) we noticed that the previous ProcessMonitor implementation would break because the read/write calls were not error-checked, causing LLDB to hang. Add lldb_private::Queue class: - implemented on top of lldb's Mutex and Condition classes - supports pop(), push() and empty() from multiple threads http://llvm-reviews.chandlerc.com/D1682 Files: include/lldb/Host/Queue.h source/Plugins/Process/Linux/ProcessMonitor.cpp source/Plugins/Process/Linux/ProcessMonitor.h Index: include/lldb/Host/Queue.h === --- /dev/null +++ include/lldb/Host/Queue.h @@ -0,0 +1,80 @@ +//===-- Queue.h -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +// A minimal thread-safe queue. +// +//===--===// + +#ifndef LLDB_PRIVATE_HOST_QUEUE +#define LLDB_PRIVATE_HOST_QUEUE + +#include lldb/Host/Mutex.h +#include lldb/Host/Condition.h +#include queue + +namespace lldb_private { + +//--- +/// @class Queue Queue.h lldb/Host/Queue.h +/// @brief A thread-safe FIFO queue. +//--- +templatetypename T +class Queue { +public: +//--- +/// Pops the element from the front of the queue. +/// +/// Removes the front-most element from the queue wrapped by this object, +/// and returns it by reference. If the queue is empty, this function +/// blocks until an element is pushed. +/// +/// @return +/// A reference to the element that was previously at the front of the +/// queue. +//--- +T pop() { +Mutex::Locker lock(m_mutex); +while(m_queue.empty()) { +m_condition.Wait(m_mutex); +} +T item = m_queue.front(); +m_queue.pop(); +return item; +} + +//--- +/// Pushes an element to the back of the queue. +/// +/// Appends an element to the queue. If any threads are blocked inside a +/// pop() call (for an empty queue) this function unblocks one of them. +//--- +void push(const T item) { +Mutex::Locker lock(m_mutex); +m_queue.push(item); +m_condition.Signal(); +} + +//--- +/// Queries if the queue is empty. +/// +/// @return +/// True if the queue has no elements, false otherwise. +//--- +bool empty() { +Mutex::Locker lock(m_mutex); +return m_queue.empty(); +} + +private: +std::queueT m_queue; +lldb_private::Mutex m_mutex; +lldb_private::Condition m_condition; +}; + +} // namespace lldb_private + +#endif // defined LLDB_PRIVATE_HOST_QUEUE Index: source/Plugins/Process/Linux/ProcessMonitor.cpp === --- source/Plugins/Process/Linux/ProcessMonitor.cpp +++ source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -37,7 +37,6 @@ #include ProcessPOSIXLog.h #include ProcessMonitor.h - #define DEBUG_PTRACE_MAXBYTES 20 // Support ptrace extensions even when compiled without required kernel support @@ -936,22 +935,14 @@ m_operation_thread(LLDB_INVALID_HOST_THREAD), m_monitor_thread(LLDB_INVALID_HOST_THREAD), m_pid(LLDB_INVALID_PROCESS_ID), - m_terminal_fd(-1), - m_client_fd(-1), - m_server_fd(-1) + m_terminal_fd(-1) { +sem_init(m_operation_semaphore, 0, 0); std::unique_ptrLaunchArgs args; args.reset(new LaunchArgs(this, module, argv, envp, stdin_path, stdout_path, stderr_path, working_dir)); -// Server/client descriptors. -if (!EnableIPC()) -{ -error.SetErrorToGenericError(); -error.SetErrorString(Monitor failed to initialize.); -} - StartLaunchOpThread(args.get(), error); if (!error.Success()) return; @@ -995,22 +986,13 @@ m_operation_thread(LLDB_INVALID_HOST_THREAD), m_monitor_thread(LLDB_INVALID_HOST_THREAD),
[Lldb-commits] [lldb] r190734 - This changes how the --source driver argument works. I split this into four arguments:
Author: jingham Date: Fri Sep 13 19:20:24 2013 New Revision: 190734 URL: http://llvm.org/viewvc/llvm-project?rev=190734view=rev Log: This changes how the --source driver argument works. I split this into four arguments: -S : Specifies a command file which will get sourced after the ~/.lldbinit but before file arguments are processed -O : Specifies a single (one-line) command that will get ditto and -s : Specifies a command file which will get sourced after `pwd`/.lldbinit -o : Specifies a command file which ditto I also changed it so that by default these sourced commands will print their command result, but there's a -q option to change that if you wish. Modified: lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Driver.h Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=190734r1=190733r2=190734view=diff == --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Fri Sep 13 19:20:24 2013 @@ -99,13 +99,21 @@ static OptionDefinition g_options[] = extensions have been implemented. }, { LLDB_3_TO_5, false, debug , 'd', no_argument , 0, eArgTypeNone, Tells the debugger to print out extra information for debugging itself. }, +{ LLDB_3_TO_5, false, source-quietly , 'b', no_argument , 0, eArgTypeNone, +Tells the debugger to print out extra information for debugging itself. }, { LLDB_3_TO_5, false, source , 's', required_argument, 0, eArgTypeFilename, Tells the debugger to read in and execute the file file, which should contain lldb commands. }, +{ LLDB_3_TO_5, false, one-line , 'o', required_argument, 0, eArgTypeNone, +Tells the debugger to execute this one-line lldb command. }, +{ LLDB_3_TO_5, false, source-before-file , 'S', required_argument, 0, eArgTypeFilename, +Tells the debugger to read in and execute the file file, which should contain lldb commands. }, +{ LLDB_3_TO_5, false, one-line-before-file , 'O', required_argument, 0, eArgTypeNone, +Tells the debugger to execute this one-line lldb command. }, { LLDB_3_TO_5, false, editor , 'e', no_argument , 0, eArgTypeNone, Tells the debugger to open source files using the host's \external editor\ mechanism. }, { LLDB_3_TO_5, false, no-lldbinit, 'x', no_argument , 0, eArgTypeNone, Do not automatically parse any '.lldbinit' files. }, -{ LLDB_3_TO_5, false, no-use-colors , 'o', no_argument , 0, eArgTypeNone, +{ LLDB_3_TO_5, false, no-use-colors , 'X', no_argument , 0, eArgTypeNone, Do not use colors. }, { LLDB_OPT_SET_6,true , python-path, 'P', no_argument , 0, eArgTypeNone, Prints out the path to the lldb.py file for this version of lldb. }, @@ -390,8 +398,10 @@ Driver::OptionData::OptionData () : m_script_lang (lldb::eScriptLanguageDefault), m_core_file (), m_crash_log (), -m_source_command_files (), +m_initial_commands (), +m_after_file_commands (), m_debug_mode (false), +m_source_quietly(false), m_print_version (false), m_print_python_path (false), m_print_help (false), @@ -412,8 +422,10 @@ Driver::OptionData::Clear () { m_args.clear (); m_script_lang = lldb::eScriptLanguageDefault; -m_source_command_files.clear (); +m_initial_commands.clear (); +m_after_file_commands.clear (); m_debug_mode = false; +m_source_quietly = false; m_print_help = false; m_print_version = false; m_print_python_path = false; @@ -424,6 +436,34 @@ Driver::OptionData::Clear () } void +Driver::OptionData::AddInitialCommand (const char *command, bool before_file, bool is_file, SBError error) +{ +std::vectorstd::pairbool, std::string *command_set; +if (before_file) +command_set = (m_initial_commands); +else +command_set = (m_after_file_commands); + +if (is_file) +{ +SBFileSpec file(command); +if (file.Exists()) +command_set-push_back (std::pairbool, std::string (true, optarg)); +else if (file.ResolveExecutableLocation()) +{ +char final_path[PATH_MAX]; +file.GetPath (final_path, sizeof(final_path)); +std::string path_str (final_path); +command_set-push_back (std::pairbool, std::string (true, path_str)); +} +else +error.SetErrorStringWithFormat(file specified in --source (-s) option doesn't exist: '%s', optarg); +} +else +command_set-push_back (std::pairbool, std::string (false, optarg)); +} + +void Driver::ResetOptionValues () { m_option_data.Clear (); @@ -451,18 +491,60
[Lldb-commits] [lldb] r190742 - One bit of that last commit wasn't meant to be included.
Author: jmolenda Date: Sat Sep 14 00:22:33 2013 New Revision: 190742 URL: http://llvm.org/viewvc/llvm-project?rev=190742view=rev Log: One bit of that last commit wasn't meant to be included. Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=190742r1=190741r2=190742view=diff == --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original) +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Sat Sep 14 00:22:33 2013 @@ -174,10 +174,6 @@ ProcessMachCore::GetDynamicLoaderAddress case llvm::MachO::MH_DYLINKER: //printf(0x%16.16 PRIx64 : file_type = MH_DYLINKER\n, vaddr); // Address of dyld struct mach_header in the core file -if (m_dyld_addr != LLDB_INVALID_ADDRESS) -{ -assert (!already had user process dyld); -} m_dyld_addr = addr; return true; ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits