From gclayton at apple.com Mon Oct 10 11:33:45 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 10 Oct 2011 16:33:45 -0000 Subject: [Lldb-commits] [lldb] r141546 - /lldb/trunk/include/lldb/Symbol/Block.h Message-ID: <20111010163345.0A38D2A6C12C@llvm.org> Author: gclayton Date: Mon Oct 10 11:33:44 2011 New Revision: 141546 URL: http://llvm.org/viewvc/llvm-project?rev=141546&view=rev Log: Patch from Dragos Tatulea regarding typedefs with the new RangeArray template class. Modified: lldb/trunk/include/lldb/Symbol/Block.h Modified: lldb/trunk/include/lldb/Symbol/Block.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=141546&r1=141545&r2=141546&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/Block.h (original) +++ lldb/trunk/include/lldb/Symbol/Block.h Mon Oct 10 11:33:44 2011 @@ -43,8 +43,8 @@ public SymbolContextScope { public: - typedef RangeArray RangeArray; - typedef RangeArray::Entry Range; + typedef RangeArray RangeList; + typedef RangeList::Entry Range; //------------------------------------------------------------------ /// Construct with a User ID \a uid, \a depth. @@ -459,7 +459,7 @@ //------------------------------------------------------------------ SymbolContextScope *m_parent_scope; collection m_children; - RangeArray m_ranges; + RangeList m_ranges; lldb::InlineFunctionInfoSP m_inlineInfoSP; ///< Inlined function information. lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local, static and paramter variables scoped to this block. bool m_parsed_block_info:1, ///< Set to true if this block and it's children have all been parsed From johnny.chen at apple.com Mon Oct 10 12:58:30 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 10 Oct 2011 17:58:30 -0000 Subject: [Lldb-commits] [lldb] r141554 - /lldb/trunk/utils/emacs/ Message-ID: <20111010175830.765152A6C12C@llvm.org> Author: johnny Date: Mon Oct 10 12:58:30 2011 New Revision: 141554 URL: http://llvm.org/viewvc/llvm-project?rev=141554&view=rev Log: Remove utils/emacs directory from lldb. Removed: lldb/trunk/utils/emacs/ From johnny.chen at apple.com Mon Oct 10 13:06:09 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 10 Oct 2011 18:06:09 -0000 Subject: [Lldb-commits] [lldb] r141556 - in /lldb/trunk/www: emacs-integration.html lldb-gud-window.png sidebar.incl Message-ID: <20111010180609.B4365312800A@llvm.org> Author: johnny Date: Mon Oct 10 13:06:09 2011 New Revision: 141556 URL: http://llvm.org/viewvc/llvm-project?rev=141556&view=rev Log: Modify sidebar.incl and remove files to reflect r141554 change. Removed: lldb/trunk/www/emacs-integration.html lldb/trunk/www/lldb-gud-window.png Modified: lldb/trunk/www/sidebar.incl Removed: lldb/trunk/www/emacs-integration.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/emacs-integration.html?rev=141555&view=auto ============================================================================== --- lldb/trunk/www/emacs-integration.html (original) +++ lldb/trunk/www/emacs-integration.html (removed) @@ -1,60 +0,0 @@ - - - - - -LLDB Status - - - -
- The Emacs Integration -
- -
-
- - -
-
-

Status

-
- -

LLDB supports emacs integration through customizing the GUD (Grand Unified Debugger) library. - Take a look at Grand Unified Debugger - and the Emacs Wiki Page for more details.

- -

The lldb-enhanced gud.el is based on the emacs 22.3.1 version from Aquamacs 1.8c distribution. - To use it, within emacs, load the gud.el file located under the utils/emacs directory. - Type M-x lldb to invoke lldb. The first time you do this, emacs will ask you to supply the command line to invoke lldb. - If lldb is not in your PATH, be sure to specify the full path to the lldb executable.

- -

This is a screen shot of the gud (with lldb) at work on Aquamacs distribution 2.1 by loading gud.el and then M-x lldb - on the a.out file in the test/functionalities/conditional_break directory:

- -

- -

- -

For a very simple interaction using 'M-x lldb', you can supply your executable to the "Run lldb (like this)" prompt. - For example:

- - Run lldb (like this): /Volumes/data/lldb/svn/trunk/build/Debug/lldb a.out -

- -

Visit your source code buffer, go to the line where you want to set the breakpoint on, type C-x <SPC> - to set a breakpoint on the source line that point is on, and then run the inferior program. The inferior should then stop and emacs - shows the buffer and marks the line where it breaks on.

- -

We welcome any help fleshing out missing pieces and improving the elisp code.

- -

Last Update: Oct 06, 2011.

- -
- -
-
-
-
- - Removed: lldb/trunk/www/lldb-gud-window.png URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/lldb-gud-window.png?rev=141555&view=auto ============================================================================== Binary file - no diff available. Modified: lldb/trunk/www/sidebar.incl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/sidebar.incl?rev=141556&r1=141555&r2=141556&view=diff ============================================================================== --- lldb/trunk/www/sidebar.incl (original) +++ lldb/trunk/www/sidebar.incl Mon Oct 10 13:06:09 2011 @@ -21,7 +21,6 @@
  • LLDB and GDB
  • Python Scripting
  • Tutorial
  • -
  • Emacs Integration
  • From johnny.chen at apple.com Mon Oct 10 17:03:44 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 10 Oct 2011 22:03:44 -0000 Subject: [Lldb-commits] [lldb] r141584 - in /lldb/trunk/test: benchmarks/stepping/ benchmarks/stepping/TestSteppingSpeed.py dotest.py Message-ID: <20111010220344.B1194312800A@llvm.org> Author: johnny Date: Mon Oct 10 17:03:44 2011 New Revision: 141584 URL: http://llvm.org/viewvc/llvm-project?rev=141584&view=rev Log: Add '-e' and '-x' options to the test driver to be able to specify an executable (full path) and the breakpoint specification for the benchmark purpose. This is used by TestSteppingSpeed.py to benchmark the lldb stepping speed. Without '-e' and 'x' specified, the test defaults to run the built lldb against itself and stopped on Driver::MainLoop, then stepping for 50 times. rdar://problem/7511193 Added: lldb/trunk/test/benchmarks/stepping/ lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py Modified: lldb/trunk/test/dotest.py Added: lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py?rev=141584&view=auto ============================================================================== --- lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py (added) +++ lldb/trunk/test/benchmarks/stepping/TestSteppingSpeed.py Mon Oct 10 17:03:44 2011 @@ -0,0 +1,82 @@ +"""Test lldb's stepping speed.""" + +import os, sys +import unittest2 +import lldb +import pexpect +from lldbbench import * + +class SteppingSpeedBench(BenchBase): + + mydir = os.path.join("benchmarks", "stepping") + + def setUp(self): + BenchBase.setUp(self) + if lldb.bmExecutable: + self.exe = lldb.bmExecutable + bmExecutableDefauled = False + else: + self.exe = self.lldbHere + bmExecutableDefauled = True + if lldb.bmBreakpointSpec: + self.break_spec = lldb.bmBreakpointSpec + else: + if bmExecutableDefauled: + self.break_spec = '-F Driver::MainLoop()' + else: + self.break_spec = '-n main' + self.stepping_avg = None + #print "self.exe=%s" % self.exe + #print "self.break_spec=%s" % self.break_spec + + @benchmarks_test + def test_run_lldb_steppings(self): + """Test lldb steppings on a large executable.""" + print + self.run_lldb_steppings(self.exe, self.break_spec, 50) + print "lldb stepping benchmark:", self.stopwatch + + def run_lldb_steppings(self, exe, break_spec, count): + # Set self.child_prompt, which is "(lldb) ". + self.child_prompt = '(lldb) ' + prompt = self.child_prompt + + # So that the child gets torn down after the test. + self.child = pexpect.spawn('%s %s %s' % (self.lldbHere, self.lldbOption, exe)) + child = self.child + + # Turn on logging for what the child sends back. + if self.TraceOn(): + child.logfile_read = sys.stdout + + child.expect_exact(prompt) + child.sendline('breakpoint set %s' % break_spec) + child.expect_exact(prompt) + child.sendline('run') + child.expect_exact(prompt) + + # Reset the stopwatch now. + self.stopwatch.reset() + for i in range(count): + with self.stopwatch: + # Disassemble the function. + child.sendline('next') # Aka 'thread step-over'. + child.expect_exact(prompt) + + child.sendline('quit') + try: + self.child.expect(pexpect.EOF) + except: + pass + + self.stepping_avg = self.stopwatch.avg() + if self.TraceOn(): + print "lldb stepping benchmark:", str(self.stopwatch) + self.child = None + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=141584&r1=141583&r2=141584&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Mon Oct 10 17:03:44 2011 @@ -103,6 +103,11 @@ # Dump the Python sys.path variable. Use '-D' to dump sys.path. dumpSysPath = False +# Full path of the benchmark executable, as specified by the '-e' option. +bmExecutable = None +# The breakpoint specification of bmExecutable, as specified by the '-x' option. +bmBreakpointSpec = None + # By default, failfast is False. Use '-F' to overwrite it. failfast = False @@ -174,6 +179,8 @@ will override those specified via a config file (see also lldb-trunk/example/test/usage-config) -d : delay startup for 10 seconds (in order for the debugger to attach) +-e : specify the full path of an executable used for benchmark purpose; + see also '-x', which provides the breakpoint sepcification -F : failfast, stop the test suite on the first error/failure -f : specify a filter, which consists of the test class name, a dot, followed by the test method, to only admit such test into the test suite @@ -193,6 +200,8 @@ timestamp as the session dir name -t : turn on tracing of lldb command and other detailed test executions -v : do verbose mode of unittest framework (print out each test case invocation) +-x : specify the breakpoint specification for the benchmark executable; + see also '-e', which provides the full path of the executable -w : insert some wait time (currently 0.5 sec) between consecutive test cases -# : Repeat the test suite for a specified number of times @@ -302,6 +311,8 @@ global count global delay global dumpSysPath + global bmExecutable + global bmBreakpointSpec global failfast global filters global fs4all @@ -383,6 +394,15 @@ elif sys.argv[index].startswith('-d'): delay = True index += 1 + elif sys.argv[index].startswith('-e'): + # Increment by 1 to fetch the full path of the benchmark executable. + index += 1 + if index >= len(sys.argv) or sys.argv[index].startswith('-'): + usage() + bmExecutable = sys.argv[index] + if not is_exe(bmExecutable): + usage() + index += 1 elif sys.argv[index].startswith('-F'): failfast = True index += 1 @@ -435,6 +455,13 @@ elif sys.argv[index].startswith('-w'): os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] = 'YES' index += 1 + elif sys.argv[index].startswith('-x'): + # Increment by 1 to fetch the breakpoint specification of the benchmark executable. + index += 1 + if index >= len(sys.argv) or sys.argv[index].startswith('-'): + usage() + bmBreakpointSpec = sys.argv[index] + index += 1 elif sys.argv[index].startswith('-#'): # Increment by 1 to fetch the repeat count argument. index += 1 @@ -854,11 +881,15 @@ # Put the blacklist in the lldb namespace, to be used by lldb.TestBase. lldb.blacklist = blacklist -# Put dont/just_do_python_api_test in the lldb namespace, too. +# Put dont/just_do_python_api_test in the lldb namespace. lldb.dont_do_python_api_test = dont_do_python_api_test lldb.just_do_python_api_test = just_do_python_api_test lldb.just_do_benchmarks_test = just_do_benchmarks_test +# Put bmExecutable and bmBreakpointSpec into the lldb namespace, too. +lldb.bmExecutable = bmExecutable +lldb.bmBreakpointSpec = bmBreakpointSpec + # Turn on lldb loggings if necessary. lldbLoggings() From dawn at burble.org Mon Oct 10 17:37:15 2011 From: dawn at burble.org (dawn at burble.org) Date: Mon, 10 Oct 2011 15:37:15 -0700 Subject: [Lldb-commits] [PATCH] fix for Linux build In-Reply-To: <20111007025401.GA6009@bloodbath.burble.org> References: <20111007025401.GA6009@bloodbath.burble.org> Message-ID: <20111010223715.GA24553@bloodbath.burble.org> This patch fixes the Linux build and has been updated to work with the latest sources of llvm, clang and lldb. Please review. Note: while it fixes the build on Linux, lldb is still crashing in pthread_mutex_lock() as it did before. Thanks in advance, -Dawn On Thu, Oct 06, 2011 at 07:54:01PM -0700, dawn at burble.org wrote: > > The attached patch fixes the Linux build for llvm and clang revs 137311 > (the revs documented in lldb/scripts/build-llvm.pl), > and is based on lldb rev 141349 (current rev as of this email). > > Would it be OK to commit this? > > Thanks, > -Dawn > Index: source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp > =================================================================== > --- source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (revision 141349) > +++ source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (working copy) > @@ -112,7 +112,7 @@ > executable = m_process->GetTarget().GetExecutableModule(); > load_offset = ComputeLoadOffset(); > > - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) > + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) > { > ModuleList module_list; > module_list.Append(executable); > @@ -132,7 +132,7 @@ > executable = m_process->GetTarget().GetExecutableModule(); > load_offset = ComputeLoadOffset(); > > - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) > + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) > { > ModuleList module_list; > module_list.Append(executable); > @@ -264,7 +264,7 @@ > { > FileSpec file(I->path.c_str(), true); > ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); > - if (!module_sp.empty()) > + if (module_sp.get()) > new_modules.Append(module_sp); > } > m_process->GetTarget().ModulesDidLoad(new_modules); > @@ -280,7 +280,7 @@ > FileSpec file(I->path.c_str(), true); > ModuleSP module_sp = > loaded_modules.FindFirstModuleForFileSpec(file, NULL, NULL); > - if (!module_sp.empty()) > + if (module_sp.get()) > old_modules.Append(module_sp); > } > m_process->GetTarget().ModulesDidUnload(old_modules); > @@ -355,7 +355,7 @@ > { > FileSpec file(I->path.c_str(), false); > ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); > - if (!module_sp.empty()) > + if (module_sp.get()) > module_list.Append(module_sp); > } > > Index: source/Plugins/Process/Linux/ProcessLinux.cpp > =================================================================== > --- source/Plugins/Process/Linux/ProcessLinux.cpp (revision 141349) > +++ source/Plugins/Process/Linux/ProcessLinux.cpp (working copy) > @@ -437,6 +437,35 @@ > return m_thread_list.GetSize(false); > } > > +uint32_t > +ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) > +{ > +#if 0 // GetLogIfAllCategoriesSet is in lldb_private > + // locker will keep a mutex locked until it goes out of scope > + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (Linux_LOG_THREAD)); > + if (log && log->GetMask().Test(Linux_LOG_VERBOSE)) > + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); > + > + // We currently are making only one thread per core and we > + // actually don't know about actual threads. Eventually we > + // want to get the thread list from memory and note which > + // threads are on CPU as those are the only ones that we > + // will be able to resume. > + const uint32_t cpu_mask = m_comm.GetCPUMask(); > + for (uint32_t cpu_mask_bit = 1; cpu_mask_bit & cpu_mask; cpu_mask_bit <<= 1) > + { > + lldb::tid_t tid = cpu_mask_bit; > + ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false)); > + if (!thread_sp) > + thread_sp.reset(new ThreadLinux (*this, tid)); > + new_thread_list.AddThread(thread_sp); > + } > + return new_thread_list.GetSize(false); > +#else > + return 0; > +#endif > +} > + > ByteOrder > ProcessLinux::GetByteOrder() const > { > Index: source/Plugins/Process/Linux/ProcessLinux.h > =================================================================== > --- source/Plugins/Process/Linux/ProcessLinux.h (revision 141349) > +++ source/Plugins/Process/Linux/ProcessLinux.h (working copy) > @@ -129,6 +129,10 @@ > virtual uint32_t > UpdateThreadListIfNeeded(); > > + uint32_t > + UpdateThreadList(lldb_private::ThreadList &old_thread_list, > + lldb_private::ThreadList &new_thread_list); > + > virtual lldb::ByteOrder > GetByteOrder() const; > > Index: source/Plugins/Process/Linux/ProcessMonitor.cpp > =================================================================== > --- source/Plugins/Process/Linux/ProcessMonitor.cpp (revision 141349) > +++ source/Plugins/Process/Linux/ProcessMonitor.cpp (working copy) > @@ -241,7 +241,7 @@ > > // Set errno to zero so that we can detect a failed peek. > errno = 0; > - unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); > + uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); > > if (data == -1UL && errno) > m_result = false; > Index: source/lldb.cpp > =================================================================== > --- source/lldb.cpp (revision 141349) > +++ source/lldb.cpp (working copy) > @@ -94,7 +94,9 @@ > UnwindAssemblyInstEmulation::Initialize(); > UnwindAssembly_x86::Initialize(); > EmulateInstructionARM::Initialize (); > +#if !defined (__linux__) > ObjectFilePECOFF::Initialize (); > +#endif > #if defined (__APPLE__) > //---------------------------------------------------------------------- > // Apple/Darwin hosted plugins > @@ -166,7 +168,9 @@ > UnwindAssembly_x86::Terminate(); > UnwindAssemblyInstEmulation::Terminate(); > EmulateInstructionARM::Terminate (); > +#if !defined (__linux__) > ObjectFilePECOFF::Terminate (); > +#endif > > #if defined (__APPLE__) > DynamicLoaderMacOSXDYLD::Terminate(); > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits -------------- next part -------------- Index: source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (revision 141569) +++ source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (working copy) @@ -112,7 +112,7 @@ executable = m_process->GetTarget().GetExecutableModule(); load_offset = ComputeLoadOffset(); - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { ModuleList module_list; module_list.Append(executable); @@ -132,7 +132,7 @@ executable = m_process->GetTarget().GetExecutableModule(); load_offset = ComputeLoadOffset(); - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { ModuleList module_list; module_list.Append(executable); @@ -264,7 +264,7 @@ { FileSpec file(I->path.c_str(), true); ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); - if (!module_sp.empty()) + if (module_sp.get()) new_modules.Append(module_sp); } m_process->GetTarget().ModulesDidLoad(new_modules); @@ -280,7 +280,7 @@ FileSpec file(I->path.c_str(), true); ModuleSP module_sp = loaded_modules.FindFirstModuleForFileSpec(file, NULL, NULL); - if (!module_sp.empty()) + if (module_sp.get()) old_modules.Append(module_sp); } m_process->GetTarget().ModulesDidUnload(old_modules); @@ -355,7 +355,7 @@ { FileSpec file(I->path.c_str(), false); ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); - if (!module_sp.empty()) + if (module_sp.get()) module_list.Append(module_sp); } Index: source/Plugins/Process/Linux/ProcessLinux.cpp =================================================================== --- source/Plugins/Process/Linux/ProcessLinux.cpp (revision 141569) +++ source/Plugins/Process/Linux/ProcessLinux.cpp (working copy) @@ -437,6 +437,13 @@ return m_thread_list.GetSize(false); } +uint32_t +ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) +{ + // FIXME: Should this be implemented? + return 0; +} + ByteOrder ProcessLinux::GetByteOrder() const { Index: source/Plugins/Process/Linux/ProcessLinux.h =================================================================== --- source/Plugins/Process/Linux/ProcessLinux.h (revision 141569) +++ source/Plugins/Process/Linux/ProcessLinux.h (working copy) @@ -129,6 +129,10 @@ virtual uint32_t UpdateThreadListIfNeeded(); + uint32_t + UpdateThreadList(lldb_private::ThreadList &old_thread_list, + lldb_private::ThreadList &new_thread_list); + virtual lldb::ByteOrder GetByteOrder() const; Index: source/Plugins/Process/Linux/ProcessMonitor.cpp =================================================================== --- source/Plugins/Process/Linux/ProcessMonitor.cpp (revision 141569) +++ source/Plugins/Process/Linux/ProcessMonitor.cpp (working copy) @@ -241,7 +241,7 @@ // Set errno to zero so that we can detect a failed peek. errno = 0; - unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); + uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); if (data == -1UL && errno) m_result = false; Index: source/lldb.cpp =================================================================== --- source/lldb.cpp (revision 141569) +++ source/lldb.cpp (working copy) @@ -94,7 +94,9 @@ UnwindAssemblyInstEmulation::Initialize(); UnwindAssembly_x86::Initialize(); EmulateInstructionARM::Initialize (); +#if !defined (__linux__) ObjectFilePECOFF::Initialize (); +#endif #if defined (__APPLE__) //---------------------------------------------------------------------- // Apple/Darwin hosted plugins @@ -166,7 +168,9 @@ UnwindAssembly_x86::Terminate(); UnwindAssemblyInstEmulation::Terminate(); EmulateInstructionARM::Terminate (); +#if !defined (__linux__) ObjectFilePECOFF::Terminate (); +#endif #if defined (__APPLE__) DynamicLoaderMacOSXDYLD::Terminate(); From johnny.chen at apple.com Mon Oct 10 18:11:50 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 10 Oct 2011 23:11:50 -0000 Subject: [Lldb-commits] [lldb] r141593 - in /lldb/trunk/source: Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp Plugins/Process/Linux/ProcessLinux.cpp Plugins/Process/Linux/ProcessLinux.h Plugins/Process/Linux/ProcessMonitor.cpp lldb.cpp Message-ID: <20111010231150.8F52D312800A@llvm.org> Author: johnny Date: Mon Oct 10 18:11:50 2011 New Revision: 141593 URL: http://llvm.org/viewvc/llvm-project?rev=141593&view=rev Log: Patch from dawn at burble.org to build on linux! Modified: lldb/trunk/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp lldb/trunk/source/lldb.cpp Modified: lldb/trunk/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp?rev=141593&r1=141592&r2=141593&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp Mon Oct 10 18:11:50 2011 @@ -112,7 +112,7 @@ executable = m_process->GetTarget().GetExecutableModule(); load_offset = ComputeLoadOffset(); - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { ModuleList module_list; module_list.Append(executable); @@ -132,7 +132,7 @@ executable = m_process->GetTarget().GetExecutableModule(); load_offset = ComputeLoadOffset(); - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) { ModuleList module_list; module_list.Append(executable); @@ -264,7 +264,7 @@ { FileSpec file(I->path.c_str(), true); ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); - if (!module_sp.empty()) + if (module_sp.get()) new_modules.Append(module_sp); } m_process->GetTarget().ModulesDidLoad(new_modules); @@ -280,7 +280,7 @@ FileSpec file(I->path.c_str(), true); ModuleSP module_sp = loaded_modules.FindFirstModuleForFileSpec(file, NULL, NULL); - if (!module_sp.empty()) + if (module_sp.get()) old_modules.Append(module_sp); } m_process->GetTarget().ModulesDidUnload(old_modules); @@ -355,7 +355,7 @@ { FileSpec file(I->path.c_str(), false); ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); - if (!module_sp.empty()) + if (module_sp.get()) module_list.Append(module_sp); } Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=141593&r1=141592&r2=141593&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Mon Oct 10 18:11:50 2011 @@ -437,6 +437,13 @@ return m_thread_list.GetSize(false); } +uint32_t +ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) +{ + // FIXME: Should this be implemented? + return 0; +} + ByteOrder ProcessLinux::GetByteOrder() const { Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h?rev=141593&r1=141592&r2=141593&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.h Mon Oct 10 18:11:50 2011 @@ -129,6 +129,10 @@ virtual uint32_t UpdateThreadListIfNeeded(); + uint32_t + UpdateThreadList(lldb_private::ThreadList &old_thread_list, + lldb_private::ThreadList &new_thread_list); + virtual lldb::ByteOrder GetByteOrder() const; Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp?rev=141593&r1=141592&r2=141593&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessMonitor.cpp Mon Oct 10 18:11:50 2011 @@ -241,7 +241,7 @@ // Set errno to zero so that we can detect a failed peek. errno = 0; - unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); + uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); if (data == -1UL && errno) m_result = false; Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=141593&r1=141592&r2=141593&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Mon Oct 10 18:11:50 2011 @@ -94,7 +94,9 @@ UnwindAssemblyInstEmulation::Initialize(); UnwindAssembly_x86::Initialize(); EmulateInstructionARM::Initialize (); +#if !defined (__linux__) ObjectFilePECOFF::Initialize (); +#endif #if defined (__APPLE__) //---------------------------------------------------------------------- // Apple/Darwin hosted plugins @@ -166,7 +168,9 @@ UnwindAssembly_x86::Terminate(); UnwindAssemblyInstEmulation::Terminate(); EmulateInstructionARM::Terminate (); +#if !defined (__linux__) ObjectFilePECOFF::Terminate (); +#endif #if defined (__APPLE__) DynamicLoaderMacOSXDYLD::Terminate(); From johnny.chen at apple.com Mon Oct 10 18:15:18 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 10 Oct 2011 16:15:18 -0700 Subject: [Lldb-commits] [PATCH] fix for Linux build In-Reply-To: <20111010223715.GA24553@bloodbath.burble.org> References: <20111007025401.GA6009@bloodbath.burble.org> <20111010223715.GA24553@bloodbath.burble.org> Message-ID: Hi Dawn, Patch submitted. Thanks! URL: http://llvm.org/viewvc/llvm-project?rev=141593&view=rev Log: Patch from dawn at burble.org to build on linux! On Oct 10, 2011, at 3:37 PM, dawn at burble.org wrote: > This patch fixes the Linux build and has been updated to work > with the latest sources of llvm, clang and lldb. > Please review. > > Note: while it fixes the build on Linux, lldb is still crashing in > pthread_mutex_lock() as it did before. > > Thanks in advance, > -Dawn > > On Thu, Oct 06, 2011 at 07:54:01PM -0700, dawn at burble.org wrote: >> >> The attached patch fixes the Linux build for llvm and clang revs 137311 >> (the revs documented in lldb/scripts/build-llvm.pl), >> and is based on lldb rev 141349 (current rev as of this email). >> >> Would it be OK to commit this? >> >> Thanks, >> -Dawn > >> Index: source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp >> =================================================================== >> --- source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (revision 141349) >> +++ source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (working copy) >> @@ -112,7 +112,7 @@ >> executable = m_process->GetTarget().GetExecutableModule(); >> load_offset = ComputeLoadOffset(); >> >> - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) >> + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) >> { >> ModuleList module_list; >> module_list.Append(executable); >> @@ -132,7 +132,7 @@ >> executable = m_process->GetTarget().GetExecutableModule(); >> load_offset = ComputeLoadOffset(); >> >> - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) >> + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) >> { >> ModuleList module_list; >> module_list.Append(executable); >> @@ -264,7 +264,7 @@ >> { >> FileSpec file(I->path.c_str(), true); >> ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); >> - if (!module_sp.empty()) >> + if (module_sp.get()) >> new_modules.Append(module_sp); >> } >> m_process->GetTarget().ModulesDidLoad(new_modules); >> @@ -280,7 +280,7 @@ >> FileSpec file(I->path.c_str(), true); >> ModuleSP module_sp = >> loaded_modules.FindFirstModuleForFileSpec(file, NULL, NULL); >> - if (!module_sp.empty()) >> + if (module_sp.get()) >> old_modules.Append(module_sp); >> } >> m_process->GetTarget().ModulesDidUnload(old_modules); >> @@ -355,7 +355,7 @@ >> { >> FileSpec file(I->path.c_str(), false); >> ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); >> - if (!module_sp.empty()) >> + if (module_sp.get()) >> module_list.Append(module_sp); >> } >> >> Index: source/Plugins/Process/Linux/ProcessLinux.cpp >> =================================================================== >> --- source/Plugins/Process/Linux/ProcessLinux.cpp (revision 141349) >> +++ source/Plugins/Process/Linux/ProcessLinux.cpp (working copy) >> @@ -437,6 +437,35 @@ >> return m_thread_list.GetSize(false); >> } >> >> +uint32_t >> +ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) >> +{ >> +#if 0 // GetLogIfAllCategoriesSet is in lldb_private >> + // locker will keep a mutex locked until it goes out of scope >> + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (Linux_LOG_THREAD)); >> + if (log && log->GetMask().Test(Linux_LOG_VERBOSE)) >> + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); >> + >> + // We currently are making only one thread per core and we >> + // actually don't know about actual threads. Eventually we >> + // want to get the thread list from memory and note which >> + // threads are on CPU as those are the only ones that we >> + // will be able to resume. >> + const uint32_t cpu_mask = m_comm.GetCPUMask(); >> + for (uint32_t cpu_mask_bit = 1; cpu_mask_bit & cpu_mask; cpu_mask_bit <<= 1) >> + { >> + lldb::tid_t tid = cpu_mask_bit; >> + ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false)); >> + if (!thread_sp) >> + thread_sp.reset(new ThreadLinux (*this, tid)); >> + new_thread_list.AddThread(thread_sp); >> + } >> + return new_thread_list.GetSize(false); >> +#else >> + return 0; >> +#endif >> +} >> + >> ByteOrder >> ProcessLinux::GetByteOrder() const >> { >> Index: source/Plugins/Process/Linux/ProcessLinux.h >> =================================================================== >> --- source/Plugins/Process/Linux/ProcessLinux.h (revision 141349) >> +++ source/Plugins/Process/Linux/ProcessLinux.h (working copy) >> @@ -129,6 +129,10 @@ >> virtual uint32_t >> UpdateThreadListIfNeeded(); >> >> + uint32_t >> + UpdateThreadList(lldb_private::ThreadList &old_thread_list, >> + lldb_private::ThreadList &new_thread_list); >> + >> virtual lldb::ByteOrder >> GetByteOrder() const; >> >> Index: source/Plugins/Process/Linux/ProcessMonitor.cpp >> =================================================================== >> --- source/Plugins/Process/Linux/ProcessMonitor.cpp (revision 141349) >> +++ source/Plugins/Process/Linux/ProcessMonitor.cpp (working copy) >> @@ -241,7 +241,7 @@ >> >> // Set errno to zero so that we can detect a failed peek. >> errno = 0; >> - unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); >> + uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); >> >> if (data == -1UL && errno) >> m_result = false; >> Index: source/lldb.cpp >> =================================================================== >> --- source/lldb.cpp (revision 141349) >> +++ source/lldb.cpp (working copy) >> @@ -94,7 +94,9 @@ >> UnwindAssemblyInstEmulation::Initialize(); >> UnwindAssembly_x86::Initialize(); >> EmulateInstructionARM::Initialize (); >> +#if !defined (__linux__) >> ObjectFilePECOFF::Initialize (); >> +#endif >> #if defined (__APPLE__) >> //---------------------------------------------------------------------- >> // Apple/Darwin hosted plugins >> @@ -166,7 +168,9 @@ >> UnwindAssembly_x86::Terminate(); >> UnwindAssemblyInstEmulation::Terminate(); >> EmulateInstructionARM::Terminate (); >> +#if !defined (__linux__) >> ObjectFilePECOFF::Terminate (); >> +#endif >> >> #if defined (__APPLE__) >> DynamicLoaderMacOSXDYLD::Terminate(); > >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20111010/4c55d30f/attachment-0001.html From johnny.chen at apple.com Mon Oct 10 18:26:54 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Mon, 10 Oct 2011 23:26:54 -0000 Subject: [Lldb-commits] [lldb] r141595 - /lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py Message-ID: <20111010232654.39D042A6C12C@llvm.org> Author: johnny Date: Mon Oct 10 18:26:54 2011 New Revision: 141595 URL: http://llvm.org/viewvc/llvm-project?rev=141595&view=rev Log: Remove test logic to check for clang and skip the rest due to insufficient debug info. Recent changes in lldb inlining robustness seem to have fixed it. Modified: lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py Modified: lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py?rev=141595&r1=141594&r2=141595&view=diff ============================================================================== --- lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py (original) +++ lldb/trunk/test/python_api/frame/inlines/TestInlinedFrame.py Mon Oct 10 18:26:54 2011 @@ -70,8 +70,6 @@ # frame0 = process.GetThreadAtIndex(0).GetFrameAtIndex(0) if frame0.IsInlined(): - if self.getCompiler().endswith('clang'): - self.skipTest("clang: insufficient debug info for call site in main()") filename = frame0.GetLineEntry().GetFileSpec().GetFilename() self.assertTrue(filename == self.source) self.expect(stack_traces1, "First stop at %s:%d" % (self.source, self.first_stop), exe=False, From jingham at apple.com Mon Oct 10 20:18:11 2011 From: jingham at apple.com (Jim Ingham) Date: Tue, 11 Oct 2011 01:18:11 -0000 Subject: [Lldb-commits] [lldb] r141624 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20111011011811.829FA2A6C12C@llvm.org> Author: jingham Date: Mon Oct 10 20:18:11 2011 New Revision: 141624 URL: http://llvm.org/viewvc/llvm-project?rev=141624&view=rev Log: Fix a couple of places in FindFunctions where I was using the passed in name_type_mask rather than the computed effective_name_type_mask. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141624&r1=141623&r2=141624&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Oct 10 20:18:11 2011 @@ -2467,7 +2467,7 @@ die_offsets.clear(); } - if (name_type_mask & eFunctionNameTypeMethod) + if (effective_name_type_mask & eFunctionNameTypeMethod) { uint32_t num_base = m_function_method_index.Find(base_name_const, die_offsets); { @@ -2491,7 +2491,7 @@ die_offsets.clear(); } - if (name_type_mask & eFunctionNameTypeSelector) + if (effective_name_type_mask & eFunctionNameTypeSelector) { FindFunctions (name, m_function_selector_index, sc_list); } From jingham at apple.com Mon Oct 10 20:18:55 2011 From: jingham at apple.com (Jim Ingham) Date: Tue, 11 Oct 2011 01:18:55 -0000 Subject: [Lldb-commits] [lldb] r141625 - in /lldb/trunk: include/lldb/API/SBTarget.h scripts/Python/interface/SBTarget.i source/API/SBTarget.cpp Message-ID: <20111011011855.C3F95312800A@llvm.org> Author: jingham Date: Mon Oct 10 20:18:55 2011 New Revision: 141625 URL: http://llvm.org/viewvc/llvm-project?rev=141625&view=rev Log: Add a SBTarget::BreakpointCreateByName API that allows you to specify the name type mask. Modified: lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/scripts/Python/interface/SBTarget.i lldb/trunk/source/API/SBTarget.cpp Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=141625&r1=141624&r2=141625&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Mon Oct 10 20:18:55 2011 @@ -397,12 +397,19 @@ lldb::SBBreakpoint BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); + // This version uses name_type_mask = eFunctionNameTypeAuto lldb::SBBreakpoint BreakpointCreateByName (const char *symbol_name, const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list); lldb::SBBreakpoint + BreakpointCreateByName (const char *symbol_name, + uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits + const SBFileSpecList &module_list, + const SBFileSpecList &comp_unit_list); + + lldb::SBBreakpoint BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL); lldb::SBBreakpoint Modified: lldb/trunk/scripts/Python/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=141625&r1=141624&r2=141625&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBTarget.i (original) +++ lldb/trunk/scripts/Python/interface/SBTarget.i Mon Oct 10 20:18:55 2011 @@ -406,6 +406,12 @@ BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL); lldb::SBBreakpoint + BreakpointCreateByName (const char *symbol_name, + uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits + const SBFileSpecList &module_list, + const SBFileSpecList &comp_unit_list); + + lldb::SBBreakpoint BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL); lldb::SBBreakpoint Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=141625&r1=141624&r2=141625&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Mon Oct 10 20:18:55 2011 @@ -610,6 +610,16 @@ const SBFileSpecList &module_list, const SBFileSpecList &comp_unit_list) { + uint32_t name_type_mask = eFunctionNameTypeAuto; + return BreakpointCreateByName (symbol_name, name_type_mask, module_list, comp_unit_list); +} + +lldb::SBBreakpoint +SBTarget::BreakpointCreateByName (const char *symbol_name, + uint32_t name_type_mask, + const SBFileSpecList &module_list, + const SBFileSpecList &comp_unit_list) +{ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); SBBreakpoint sb_bp; @@ -619,14 +629,14 @@ *sb_bp = m_opaque_sp->CreateBreakpoint (module_list.get(), comp_unit_list.get(), symbol_name, - eFunctionNameTypeFull | eFunctionNameTypeBase, + name_type_mask, false); } if (log) { - log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\") => SBBreakpoint(%p)", - m_opaque_sp.get(), symbol_name, sb_bp.get()); + log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)", + m_opaque_sp.get(), symbol_name, name_type_mask, sb_bp.get()); } return sb_bp; From gclayton at apple.com Mon Oct 10 20:28:14 2011 From: gclayton at apple.com (Greg Clayton) Date: Mon, 10 Oct 2011 18:28:14 -0700 Subject: [Lldb-commits] [PATCH] fix for Linux build In-Reply-To: References: <20111007025401.GA6009@bloodbath.burble.org> <20111010223715.GA24553@bloodbath.burble.org> Message-ID: <8D6102C8-38C2-4D42-96CD-E3A81B893CAD@apple.com> Dawn, we shouldn't have to disable the PECOFF object file parser for linux. All of the symbol parsers need to work on all of the systems. I am guessing a Makefile might be missing in the PECOFF directory. The correct fix would be to add a Makefile similar to ones in the other object file parser directories. In LLDB, all plug-ins should be able to run on all systems, except for the native debugging plug-ins like ProcessLinux. The DynamicLoaderLinuxDYLD plug-in should be left enabled as well if possible on other systems as long as no system header files are being used, and if they are, these header dependencies should be fixed. If you or anyone else on linux can try and get the ObjectFilePECOFF plug-in building by adding a Makefile, that would be great! Greg On Oct 10, 2011, at 4:15 PM, Johnny Chen wrote: > Hi Dawn, > > Patch submitted. Thanks! > > URL: http://llvm.org/viewvc/llvm-project?rev=141593&view=rev > Log: > Patch from dawn at burble.org to build on linux! > > On Oct 10, 2011, at 3:37 PM, dawn at burble.org wrote: > >> This patch fixes the Linux build and has been updated to work >> with the latest sources of llvm, clang and lldb. >> Please review. >> >> Note: while it fixes the build on Linux, lldb is still crashing in >> pthread_mutex_lock() as it did before. >> >> Thanks in advance, >> -Dawn >> >> On Thu, Oct 06, 2011 at 07:54:01PM -0700, dawn at burble.org wrote: >>> >>> The attached patch fixes the Linux build for llvm and clang revs 137311 >>> (the revs documented in lldb/scripts/build-llvm.pl), >>> and is based on lldb rev 141349 (current rev as of this email). >>> >>> Would it be OK to commit this? >>> >>> Thanks, >>> -Dawn >> >>> Index: source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp >>> =================================================================== >>> --- source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (revision 141349) >>> +++ source/Plugins/DynamicLoader/Linux-DYLD/DynamicLoaderLinuxDYLD.cpp (working copy) >>> @@ -112,7 +112,7 @@ >>> executable = m_process->GetTarget().GetExecutableModule(); >>> load_offset = ComputeLoadOffset(); >>> >>> - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) >>> + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) >>> { >>> ModuleList module_list; >>> module_list.Append(executable); >>> @@ -132,7 +132,7 @@ >>> executable = m_process->GetTarget().GetExecutableModule(); >>> load_offset = ComputeLoadOffset(); >>> >>> - if (!executable.empty() && load_offset != LLDB_INVALID_ADDRESS) >>> + if (executable.get() && load_offset != LLDB_INVALID_ADDRESS) >>> { >>> ModuleList module_list; >>> module_list.Append(executable); >>> @@ -264,7 +264,7 @@ >>> { >>> FileSpec file(I->path.c_str(), true); >>> ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); >>> - if (!module_sp.empty()) >>> + if (module_sp.get()) >>> new_modules.Append(module_sp); >>> } >>> m_process->GetTarget().ModulesDidLoad(new_modules); >>> @@ -280,7 +280,7 @@ >>> FileSpec file(I->path.c_str(), true); >>> ModuleSP module_sp = >>> loaded_modules.FindFirstModuleForFileSpec(file, NULL, NULL); >>> - if (!module_sp.empty()) >>> + if (module_sp.get()) >>> old_modules.Append(module_sp); >>> } >>> m_process->GetTarget().ModulesDidUnload(old_modules); >>> @@ -355,7 +355,7 @@ >>> { >>> FileSpec file(I->path.c_str(), false); >>> ModuleSP module_sp = LoadModuleAtAddress(file, I->base_addr); >>> - if (!module_sp.empty()) >>> + if (module_sp.get()) >>> module_list.Append(module_sp); >>> } >>> >>> Index: source/Plugins/Process/Linux/ProcessLinux.cpp >>> =================================================================== >>> --- source/Plugins/Process/Linux/ProcessLinux.cpp (revision 141349) >>> +++ source/Plugins/Process/Linux/ProcessLinux.cpp (working copy) >>> @@ -437,6 +437,35 @@ >>> return m_thread_list.GetSize(false); >>> } >>> >>> +uint32_t >>> +ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) >>> +{ >>> +#if 0 // GetLogIfAllCategoriesSet is in lldb_private >>> + // locker will keep a mutex locked until it goes out of scope >>> + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (Linux_LOG_THREAD)); >>> + if (log && log->GetMask().Test(Linux_LOG_VERBOSE)) >>> + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); >>> + >>> + // We currently are making only one thread per core and we >>> + // actually don't know about actual threads. Eventually we >>> + // want to get the thread list from memory and note which >>> + // threads are on CPU as those are the only ones that we >>> + // will be able to resume. >>> + const uint32_t cpu_mask = m_comm.GetCPUMask(); >>> + for (uint32_t cpu_mask_bit = 1; cpu_mask_bit & cpu_mask; cpu_mask_bit <<= 1) >>> + { >>> + lldb::tid_t tid = cpu_mask_bit; >>> + ThreadSP thread_sp (old_thread_list.FindThreadByID (tid, false)); >>> + if (!thread_sp) >>> + thread_sp.reset(new ThreadLinux (*this, tid)); >>> + new_thread_list.AddThread(thread_sp); >>> + } >>> + return new_thread_list.GetSize(false); >>> +#else >>> + return 0; >>> +#endif >>> +} >>> + >>> ByteOrder >>> ProcessLinux::GetByteOrder() const >>> { >>> Index: source/Plugins/Process/Linux/ProcessLinux.h >>> =================================================================== >>> --- source/Plugins/Process/Linux/ProcessLinux.h (revision 141349) >>> +++ source/Plugins/Process/Linux/ProcessLinux.h (working copy) >>> @@ -129,6 +129,10 @@ >>> virtual uint32_t >>> UpdateThreadListIfNeeded(); >>> >>> + uint32_t >>> + UpdateThreadList(lldb_private::ThreadList &old_thread_list, >>> + lldb_private::ThreadList &new_thread_list); >>> + >>> virtual lldb::ByteOrder >>> GetByteOrder() const; >>> >>> Index: source/Plugins/Process/Linux/ProcessMonitor.cpp >>> =================================================================== >>> --- source/Plugins/Process/Linux/ProcessMonitor.cpp (revision 141349) >>> +++ source/Plugins/Process/Linux/ProcessMonitor.cpp (working copy) >>> @@ -241,7 +241,7 @@ >>> >>> // Set errno to zero so that we can detect a failed peek. >>> errno = 0; >>> - unsigned long data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); >>> + uint32_t data = ptrace(PTRACE_PEEKUSER, pid, m_offset, NULL); >>> >>> if (data == -1UL && errno) >>> m_result = false; >>> Index: source/lldb.cpp >>> =================================================================== >>> --- source/lldb.cpp (revision 141349) >>> +++ source/lldb.cpp (working copy) >>> @@ -94,7 +94,9 @@ >>> UnwindAssemblyInstEmulation::Initialize(); >>> UnwindAssembly_x86::Initialize(); >>> EmulateInstructionARM::Initialize (); >>> +#if !defined (__linux__) >>> ObjectFilePECOFF::Initialize (); >>> +#endif >>> #if defined (__APPLE__) >>> //---------------------------------------------------------------------- >>> // Apple/Darwin hosted plugins >>> @@ -166,7 +168,9 @@ >>> UnwindAssembly_x86::Terminate(); >>> UnwindAssemblyInstEmulation::Terminate(); >>> EmulateInstructionARM::Terminate (); >>> +#if !defined (__linux__) >>> ObjectFilePECOFF::Terminate (); >>> +#endif >>> >>> #if defined (__APPLE__) >>> DynamicLoaderMacOSXDYLD::Terminate(); >> >>> _______________________________________________ >>> lldb-commits mailing list >>> lldb-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From johnny.chen at apple.com Mon Oct 10 20:30:28 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 11 Oct 2011 01:30:28 -0000 Subject: [Lldb-commits] [lldb] r141626 - /lldb/trunk/test/dotest.py Message-ID: <20111011013028.23D422A6C12C@llvm.org> Author: johnny Date: Mon Oct 10 20:30:27 2011 New Revision: 141626 URL: http://llvm.org/viewvc/llvm-project?rev=141626&view=rev Log: Add '-k' option to the test driver to be able to specify a runhook, which is an lldb command for the debugger to execute for certain kind of tests (for example, a benchmark). A list of runhooks can be used to steer the debugger into the desired state before more actions can be performed. Modified: lldb/trunk/test/dotest.py Modified: lldb/trunk/test/dotest.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=141626&r1=141625&r2=141626&view=diff ============================================================================== --- lldb/trunk/test/dotest.py (original) +++ lldb/trunk/test/dotest.py Mon Oct 10 20:30:27 2011 @@ -114,6 +114,10 @@ # The filters (testclass.testmethod) used to admit tests into our test suite. filters = [] +# The runhooks is a list of lldb commands specifically for the debugger. +# Use '-k' to specify a runhook. +runHooks = [] + # If '-g' is specified, the filterspec is not exclusive. If a test module does # not contain testclass.testmethod which matches the filterspec, the whole test # module is still admitted into our test suite. fs4all flag defaults to True. @@ -190,6 +194,10 @@ still admitted to the test suite -i : ignore (don't bailout) if 'lldb.py' module cannot be located in the build tree relative to this script; use PYTHONPATH to locate the module +-k : specify a runhook, which is an lldb command to be executed by the debugger; + '-k' option can occur multiple times, the commands are executed one after the + other to bring the debugger to a desired state, so that, for example, further + benchmarking can be done -l : don't skip long running test -p : specify a regexp filename pattern for inclusion in the test suite -r : specify a dir to relocate the tests and their intermediate files to; @@ -317,6 +325,7 @@ global filters global fs4all global ignore + global runHooks global skipLongRunningTest global regexp global rdir @@ -419,6 +428,13 @@ elif sys.argv[index].startswith('-i'): ignore = True index += 1 + elif sys.argv[index].startswith('-k'): + # Increment by 1 to fetch the runhook lldb command. + index += 1 + if index >= len(sys.argv) or sys.argv[index].startswith('-'): + usage() + runHooks.append(sys.argv[index]) + index += 1 elif sys.argv[index].startswith('-l'): skipLongRunningTest = False index += 1 @@ -890,6 +906,9 @@ lldb.bmExecutable = bmExecutable lldb.bmBreakpointSpec = bmBreakpointSpec +# And don't forget the runHooks! +lldb.runHooks = runHooks + # Turn on lldb loggings if necessary. lldbLoggings() From jingham at apple.com Mon Oct 10 20:30:59 2011 From: jingham at apple.com (Jim Ingham) Date: Tue, 11 Oct 2011 01:30:59 -0000 Subject: [Lldb-commits] [lldb] r141627 - /lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20111011013059.34AF42A6C12C@llvm.org> Author: jingham Date: Mon Oct 10 20:30:59 2011 New Revision: 141627 URL: http://llvm.org/viewvc/llvm-project?rev=141627&view=rev Log: Remove a debugging printf... Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141627&r1=141626&r2=141627&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Oct 10 20:30:59 2011 @@ -2265,10 +2265,7 @@ { std::string name_no_parens(partial_name, base_name_end - partial_name); if (strstr (demangled, name_no_parens.c_str()) == NULL) - { - printf ("name: \"%s\" didn't match full name: \"%s\".\n", partial_name, demangled); return false; - } } } } From jingham at apple.com Mon Oct 10 20:43:51 2011 From: jingham at apple.com (Jim Ingham) Date: Tue, 11 Oct 2011 01:43:51 -0000 Subject: [Lldb-commits] [lldb] r141629 - in /lldb/trunk/test/lang/cpp/breakpoints: ./ Makefile TestCPPBreakpoints.py nested.cpp Message-ID: <20111011014351.1789A312800A@llvm.org> Author: jingham Date: Mon Oct 10 20:43:50 2011 New Revision: 141629 URL: http://llvm.org/viewvc/llvm-project?rev=141629&view=rev Log: Added some simple testcases for figuring out breakpoints by name in classes & namespaces. Added: lldb/trunk/test/lang/cpp/breakpoints/ lldb/trunk/test/lang/cpp/breakpoints/Makefile lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py lldb/trunk/test/lang/cpp/breakpoints/nested.cpp Added: lldb/trunk/test/lang/cpp/breakpoints/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoints/Makefile?rev=141629&view=auto ============================================================================== --- lldb/trunk/test/lang/cpp/breakpoints/Makefile (added) +++ lldb/trunk/test/lang/cpp/breakpoints/Makefile Mon Oct 10 20:43:50 2011 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := nested.cpp + +include $(LEVEL)/Makefile.rules Added: lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py?rev=141629&view=auto ============================================================================== --- lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py (added) +++ lldb/trunk/test/lang/cpp/breakpoints/TestCPPBreakpoints.py Mon Oct 10 20:43:50 2011 @@ -0,0 +1,102 @@ +""" +Test lldb breakpoint command for CPP methods & functions in a namespace. +""" + +import os, time +import unittest2 +import lldb +from lldbtest import * + +class CPPBreakpointTestCase(TestBase): + + mydir = os.path.join("lang", "cpp", "breakpoints") + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + def test_with_dsym(self): + """Test a sequence of breakpoint command add, list, and delete.""" + self.buildDsym() + self.cpp_breakpoints() + + def test_with_dwarf(self): + """Test a sequence of breakpoint command add, list, and delete.""" + self.buildDwarf() + self.cpp_breakpoints() + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + + def cpp_breakpoints (self): + """Test a sequence of breakpoint command add, list, and delete.""" + exe = os.path.join(os.getcwd(), "a.out") + + # Create a target from the debugger. + + target = self.dbg.CreateTarget (exe) + self.assertTrue(target, VALID_TARGET) + + a_out_module = lldb.SBFileSpecList() + a_out_module.Append(lldb.SBFileSpec(exe)) + + nested_comp_unit = lldb.SBFileSpecList() + nested_comp_unit.Append (lldb.SBFileSpec("nested.cpp")) + + # First provide ONLY the method name. This should get everybody... + auto_break = target.BreakpointCreateByName ("Function", + lldb.eFunctionNameTypeAuto, + a_out_module, + nested_comp_unit) + self.assertTrue (auto_break.GetNumLocations() == 5) + + # Now add the Baz class specifier. This should get the version contained in Bar, + # AND the one contained in :: + auto_break = target.BreakpointCreateByName ("Baz::Function", + lldb.eFunctionNameTypeAuto, + a_out_module, + nested_comp_unit) + self.assertTrue (auto_break.GetNumLocations() == 2) + + # Then add the Bar::Baz specifier. This should get the version contained in Bar only + auto_break = target.BreakpointCreateByName ("Bar::Baz::Function", + lldb.eFunctionNameTypeAuto, + a_out_module, + nested_comp_unit) + self.assertTrue (auto_break.GetNumLocations() == 1) + + plain_method_break = target.BreakpointCreateByName ("Function", + lldb.eFunctionNameTypeMethod, + a_out_module, + nested_comp_unit) + self.assertTrue (plain_method_break.GetNumLocations() == 3) + + plain_method_break = target.BreakpointCreateByName ("Baz::Function", + lldb.eFunctionNameTypeMethod, + a_out_module, + nested_comp_unit) + self.assertTrue (plain_method_break.GetNumLocations() == 2) + + plain_method_break = target.BreakpointCreateByName ("Bar::Baz::Function", + lldb.eFunctionNameTypeMethod, + a_out_module, + nested_comp_unit) + self.assertTrue (plain_method_break.GetNumLocations() == 1) + + plain_method_break = target.BreakpointCreateByName ("Function", + lldb.eFunctionNameTypeBase, + a_out_module, + nested_comp_unit) + self.assertTrue (plain_method_break.GetNumLocations() == 2) + + plain_method_break = target.BreakpointCreateByName ("Bar::Function", + lldb.eFunctionNameTypeBase, + a_out_module, + nested_comp_unit) + self.assertTrue (plain_method_break.GetNumLocations() == 1) + + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() Added: lldb/trunk/test/lang/cpp/breakpoints/nested.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/breakpoints/nested.cpp?rev=141629&view=auto ============================================================================== --- lldb/trunk/test/lang/cpp/breakpoints/nested.cpp (added) +++ lldb/trunk/test/lang/cpp/breakpoints/nested.cpp Mon Oct 10 20:43:50 2011 @@ -0,0 +1,76 @@ +#include + +namespace Foo +{ + namespace Bar + { + class Baz + { + public: + Baz (int value):m_value(value) {} + int Function () + { + printf ("%s returning: %d.\n", __FUNCTION__, m_value); + return m_value; + } + private: + int m_value; + }; + + class Baz2 + { + public: + Baz2 (int value):m_value(value) {} + int Function () + { + printf ("%s returning: %d.\n", __FUNCTION__, m_value); + return m_value; + } + private: + int m_value; + }; + + static int bar_value = 20; + int Function () + { + printf ("%s returning: %d.\n", __FUNCTION__, bar_value); + return bar_value; + } + } +} + +class Baz +{ +public: + Baz (int value):m_value(value) {} + int Function () + { + printf ("%s returning: %d.\n", __FUNCTION__, m_value); + return m_value; + } +private: + int m_value; +}; + +int +Function () +{ + printf ("I am a global function, I return 333.\n"); + return 333; +} + +int main () +{ + Foo::Bar::Baz mine(200); + Foo::Bar::Baz2 mine2(300); + ::Baz bare_baz (500); + + printf ("Yup, got %d from Baz.\n", mine.Function()); + printf ("Yup, got %d from Baz.\n", mine2.Function()); + printf ("Yup, got %d from Baz.\n", bare_baz.Function()); + printf ("And got %d from Bar.\n", Foo::Bar::Function()); + printf ("And got %d from ::.\n", ::Function()); + + return 0; + +} From dragos.tatulea at gmail.com Tue Oct 11 04:32:47 2011 From: dragos.tatulea at gmail.com (Dragos Tatulea) Date: Tue, 11 Oct 2011 12:32:47 +0300 Subject: [Lldb-commits] [PATCH] fix for Linux build In-Reply-To: <8D6102C8-38C2-4D42-96CD-E3A81B893CAD@apple.com> References: <20111007025401.GA6009@bloodbath.burble.org> <20111010223715.GA24553@bloodbath.burble.org> <8D6102C8-38C2-4D42-96CD-E3A81B893CAD@apple.com> Message-ID: On Tue, Oct 11, 2011 at 4:28 AM, Greg Clayton wrote: > Dawn, we shouldn't have to disable the PECOFF object file parser for linux. > All of the symbol parsers need to work on all of the systems. I am guessing > a Makefile might be missing in the PECOFF directory. The correct fix would > be to add a Makefile similar to ones in the other object file parser > directories. > > In LLDB, all plug-ins should be able to run on all systems, except for the > native debugging plug-ins like ProcessLinux. The DynamicLoaderLinuxDYLD > plug-in should be left enabled as well if possible on other systems as long > as no system header files are being used, and if they are, these header > dependencies should be fixed. > > If you or anyone else on linux can try and get the ObjectFilePECOFF plug-in > building by adding a Makefile, that would be great! > > Patch in attachment. Thanks, Dragos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20111011/44794d8f/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: lldb_pecoff_enable_linux.patch Type: text/x-patch Size: 2767 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20111011/44794d8f/attachment.bin From gclayton at apple.com Tue Oct 11 11:42:22 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 11 Oct 2011 16:42:22 -0000 Subject: [Lldb-commits] [lldb] r141677 - in /lldb/trunk: lib/Makefile source/Plugins/Makefile source/lldb.cpp Message-ID: <20111011164222.1FCF32A6C12C@llvm.org> Author: gclayton Date: Tue Oct 11 11:42:21 2011 New Revision: 141677 URL: http://llvm.org/viewvc/llvm-project?rev=141677&view=rev Log: Patch from Dragos Tatulea to re-enable the PECOFF object file parser for all builds on all systems. Modified: lldb/trunk/lib/Makefile lldb/trunk/source/Plugins/Makefile lldb/trunk/source/lldb.cpp Modified: lldb/trunk/lib/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lib/Makefile?rev=141677&r1=141676&r2=141677&view=diff ============================================================================== --- lldb/trunk/lib/Makefile (original) +++ lldb/trunk/lib/Makefile Tue Oct 11 11:42:21 2011 @@ -38,6 +38,7 @@ lldbPluginLanguageRuntimeObjCAppleObjCRuntime.a \ lldbPluginObjectContainerBSDArchive.a \ lldbPluginObjectFileELF.a \ + lldbPluginObjectFilePECOFF.a \ lldbPluginPlatformGDBServer.a \ lldbPluginProcessGDBRemote.a \ lldbPluginSymbolFileDWARF.a \ Modified: lldb/trunk/source/Plugins/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Makefile?rev=141677&r1=141676&r2=141677&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Makefile (original) +++ lldb/trunk/source/Plugins/Makefile Tue Oct 11 11:42:21 2011 @@ -13,9 +13,9 @@ DIRS := ABI/MacOSX-arm ABI/MacOSX-i386 ABI/SysV-x86_64 Disassembler/llvm \ - ObjectContainer/BSD-Archive ObjectFile/ELF SymbolFile/DWARF \ - SymbolFile/Symtab Process/Utility DynamicLoader/Static \ - Platform Process/gdb-remote Instruction/ARM \ + ObjectContainer/BSD-Archive ObjectFile/ELF ObjectFile/PECOFF \ + SymbolFile/DWARF SymbolFile/Symtab Process/Utility \ + DynamicLoader/Static Platform Process/gdb-remote Instruction/ARM \ UnwindAssembly/InstEmulation UnwindAssembly/x86 \ LanguageRuntime/CPlusPlus/ItaniumABI \ LanguageRuntime/ObjC/AppleObjCRuntime Modified: lldb/trunk/source/lldb.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=141677&r1=141676&r2=141677&view=diff ============================================================================== --- lldb/trunk/source/lldb.cpp (original) +++ lldb/trunk/source/lldb.cpp Tue Oct 11 11:42:21 2011 @@ -94,9 +94,7 @@ UnwindAssemblyInstEmulation::Initialize(); UnwindAssembly_x86::Initialize(); EmulateInstructionARM::Initialize (); -#if !defined (__linux__) ObjectFilePECOFF::Initialize (); -#endif #if defined (__APPLE__) //---------------------------------------------------------------------- // Apple/Darwin hosted plugins @@ -168,9 +166,7 @@ UnwindAssembly_x86::Terminate(); UnwindAssemblyInstEmulation::Terminate(); EmulateInstructionARM::Terminate (); -#if !defined (__linux__) ObjectFilePECOFF::Terminate (); -#endif #if defined (__APPLE__) DynamicLoaderMacOSXDYLD::Terminate(); From gclayton at apple.com Tue Oct 11 11:44:37 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 11 Oct 2011 09:44:37 -0700 Subject: [Lldb-commits] [PATCH] fix for Linux build In-Reply-To: References: <20111007025401.GA6009@bloodbath.burble.org> <20111010223715.GA24553@bloodbath.burble.org> <8D6102C8-38C2-4D42-96CD-E3A81B893CAD@apple.com> Message-ID: <66DF17C0-32C6-4118-9B1A-C88DEF454408@apple.com> Thanks Dragos! % svn commit Sending lib/Makefile Sending source/Plugins/Makefile Sending source/lldb.cpp Transmitting file data ... Committed revision 141677. On Oct 11, 2011, at 2:32 AM, Dragos Tatulea wrote: > > > On Tue, Oct 11, 2011 at 4:28 AM, Greg Clayton wrote: > Dawn, we shouldn't have to disable the PECOFF object file parser for linux. All of the symbol parsers need to work on all of the systems. I am guessing a Makefile might be missing in the PECOFF directory. The correct fix would be to add a Makefile similar to ones in the other object file parser directories. > > In LLDB, all plug-ins should be able to run on all systems, except for the native debugging plug-ins like ProcessLinux. The DynamicLoaderLinuxDYLD plug-in should be left enabled as well if possible on other systems as long as no system header files are being used, and if they are, these header dependencies should be fixed. > > If you or anyone else on linux can try and get the ObjectFilePECOFF plug-in building by adding a Makefile, that would be great! > > Patch in attachment. > > Thanks, > Dragos > From dawn at burble.org Tue Oct 11 12:44:46 2011 From: dawn at burble.org (dawn at burble.org) Date: Tue, 11 Oct 2011 10:44:46 -0700 Subject: [Lldb-commits] [PATCH] fix for Linux build In-Reply-To: <8D6102C8-38C2-4D42-96CD-E3A81B893CAD@apple.com> References: <20111007025401.GA6009@bloodbath.burble.org> <20111010223715.GA24553@bloodbath.burble.org> <8D6102C8-38C2-4D42-96CD-E3A81B893CAD@apple.com> Message-ID: <20111011174446.GA8627@bloodbath.burble.org> On Mon, Oct 10, 2011 at 06:28:14PM -0700, Greg Clayton wrote: > Dawn, we shouldn't have to disable the PECOFF object file parser for linux. All of the symbol parsers need to work on all of the systems. [...] > In LLDB, all plug-ins should be able to run on all systems, except for the native debugging plug-ins like ProcessLinux. The DynamicLoaderLinuxDYLD plug-in should be left enabled as well if possible on other systems as long as no system header files are being used, and if they are, these header dependencies should be fixed. Ah, OK. Thanks, I'll keep that in mind. -Dawn PS: > >> Note: while it fixes the build on Linux, lldb is still crashing in > >> pthread_mutex_lock() as it did before. This is due to an initialization order issue. While ProcessMonitor is being constructed, a nested call to GetRegOffset(reg) wants to use its already constructed instance. I hope to have a patch soon, once I get a grasp of the interdependencies... From johnny.chen at apple.com Tue Oct 11 14:39:48 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 11 Oct 2011 19:39:48 -0000 Subject: [Lldb-commits] [lldb] r141698 - /lldb/trunk/docs/lldb-for-gdb-users.txt Message-ID: <20111011193948.482932A6C12C@llvm.org> Author: johnny Date: Tue Oct 11 14:39:48 2011 New Revision: 141698 URL: http://llvm.org/viewvc/llvm-project?rev=141698&view=rev Log: Add documentation on providing the 'cd' and 'pwd' commands to lldb with the help of the embedded Python interpreter and the 'command regex' command. Modified: lldb/trunk/docs/lldb-for-gdb-users.txt Modified: lldb/trunk/docs/lldb-for-gdb-users.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-for-gdb-users.txt?rev=141698&r1=141697&r2=141698&view=diff ============================================================================== --- lldb/trunk/docs/lldb-for-gdb-users.txt (original) +++ lldb/trunk/docs/lldb-for-gdb-users.txt Tue Oct 11 14:39:48 2011 @@ -431,3 +431,20 @@ (lldb) expr self = $0 $4 = (SKTGraphicView *) 0x0000000100135430 + +f) Miscellaneous: + +You can use the embedded Python interprter to add the following 'pwd' and 'cd' commands +for your lldb session: + +(lldb) script import os +(lldb) command alias pwd script print os.getcwd() +(lldb) command regex cd "s/^(.*)$/script os.chdir(os.path.expanduser('%1'))/" + +... + +(lldb) cd /tmp +script os.chdir(os.path.expanduser('/tmp')) +(lldb) pwd +/private/tmp +(lldb) From gclayton at apple.com Tue Oct 11 15:23:29 2011 From: gclayton at apple.com (Greg Clayton) Date: Tue, 11 Oct 2011 20:23:29 -0000 Subject: [Lldb-commits] [lldb] r141707 - /lldb/trunk/source/Plugins/ObjectFile/PECOFF/Makefile Message-ID: <20111011202329.4AD9D2A6C12C@llvm.org> Author: gclayton Date: Tue Oct 11 15:23:29 2011 New Revision: 141707 URL: http://llvm.org/viewvc/llvm-project?rev=141707&view=rev Log: Added a missing file from a previous checkin. Added: lldb/trunk/source/Plugins/ObjectFile/PECOFF/Makefile Added: lldb/trunk/source/Plugins/ObjectFile/PECOFF/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/Makefile?rev=141707&view=auto ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/PECOFF/Makefile (added) +++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/Makefile Tue Oct 11 15:23:29 2011 @@ -0,0 +1,14 @@ +##===- source/Plugins/ObjectFile/PECOFF/Makefile --------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../../../.. +LIBRARYNAME := lldbPluginObjectFilePECOFF +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile From dawn at burble.org Tue Oct 11 15:46:57 2011 From: dawn at burble.org (dawn at burble.org) Date: Tue, 11 Oct 2011 13:46:57 -0700 Subject: [Lldb-commits] [PATCH] fix function name in log Message-ID: <20111011204657.GA11874@bloodbath.burble.org> This patch fixes a silly typo in ProcessKDP.cpp :) -Dawn -------------- next part -------------- Index: source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp =================================================================== --- source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (revision 141707) +++ source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (working copy) @@ -266,7 +266,7 @@ { LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS)); if (log) - log->Printf ("ProcessKDP::DidLaunch()"); + log->Printf ("ProcessKDP::DidAttach()"); if (GetID() != LLDB_INVALID_PROCESS_ID) { // TODO: figure out the register context that we will use From dawn at burble.org Tue Oct 11 16:08:31 2011 From: dawn at burble.org (dawn at burble.org) Date: Tue, 11 Oct 2011 14:08:31 -0700 Subject: [Lldb-commits] [PATCH] add logging to ProcessLinux Message-ID: <20111011210831.GA12087@bloodbath.burble.org> This patch adds the logging capabilities in ProcessKDP to ProcessLinux. All flags were kept the same for consistency. -Dawn -------------- next part -------------- Index: source/Plugins/Process/Linux/ProcessLinux.cpp =================================================================== --- source/Plugins/Process/Linux/ProcessLinux.cpp (revision 141707) +++ source/Plugins/Process/Linux/ProcessLinux.cpp (working copy) @@ -20,6 +20,7 @@ #include "lldb/Target/Target.h" #include "ProcessLinux.h" +#include "ProcessLinuxLog.h" #include "Plugins/Process/Utility/InferiorCallPOSIX.h" #include "ProcessMonitor.h" #include "LinuxThread.h" @@ -43,10 +44,18 @@ if (!g_initialized) { + g_initialized = true; PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); - g_initialized = true; + + Log::Callbacks log_callbacks = { + ProcessLinuxLog::DisableLog, + ProcessLinuxLog::EnableLog, + ProcessLinuxLog::ListLogCategories + }; + + Log::RegisterLogChannel (ProcessLinux::GetPluginNameStatic(), log_callbacks); } } @@ -108,6 +117,10 @@ Error error; assert(m_monitor == NULL); + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (LINUX_LOG_PROCESS)); + if (log && log->GetMask().Test(LINUX_LOG_VERBOSE)) + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); + m_monitor = new ProcessMonitor(this, pid, error); if (!error.Success()) @@ -441,6 +454,10 @@ ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) { // FIXME: Should this be implemented? + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (LINUX_LOG_THREAD)); + if (log && log->GetMask().Test(LINUX_LOG_VERBOSE)) + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); + return 0; } Index: source/Plugins/Process/Linux/ProcessLinuxLog.cpp =================================================================== --- source/Plugins/Process/Linux/ProcessLinuxLog.cpp (revision 0) +++ source/Plugins/Process/Linux/ProcessLinuxLog.cpp (revision 0) @@ -0,0 +1,183 @@ +//===-- ProcessLinuxLog.cpp ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "ProcessLinuxLog.h" + +#include "lldb/Interpreter/Args.h" +#include "lldb/Core/StreamFile.h" + +#include "ProcessLinux.h" + +using namespace lldb; +using namespace lldb_private; + + +// We want to avoid global constructors where code needs to be run so here we +// control access to our static g_log_sp by hiding it in a singleton function +// that will construct the static g_lob_sp the first time this function is +// called. +static LogSP & +GetLog () +{ + static LogSP g_log_sp; + return g_log_sp; +} + +LogSP +ProcessLinuxLog::GetLogIfAllCategoriesSet (uint32_t mask) +{ + LogSP log(GetLog ()); + if (log && mask) + { + uint32_t log_mask = log->GetMask().Get(); + if ((log_mask & mask) != mask) + return LogSP(); + } + return log; +} + +void +ProcessLinuxLog::DisableLog (Args &args, Stream *feedback_strm) +{ + LogSP log (GetLog ()); + if (log) + { + uint32_t flag_bits = 0; + + const size_t argc = args.GetArgumentCount (); + if (argc > 0) + { + flag_bits = log->GetMask().Get(); + for (size_t i = 0; i < argc; ++i) + { + const char *arg = args.GetArgumentAtIndex (i); + + + if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~LINUX_LOG_ALL; + else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~LINUX_LOG_ASYNC; + else if (::strncasecmp (arg, "break", 5) == 0 ) flag_bits &= ~LINUX_LOG_BREAKPOINTS; + else if (::strncasecmp (arg, "comm", 4) == 0 ) flag_bits &= ~LINUX_LOG_COMM; + else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~LINUX_LOG_DEFAULT; + else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~LINUX_LOG_PACKETS; + else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~LINUX_LOG_MEMORY; + else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~LINUX_LOG_MEMORY_DATA_SHORT; + else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~LINUX_LOG_MEMORY_DATA_LONG; + else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~LINUX_LOG_PROCESS; + else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~LINUX_LOG_STEP; + else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~LINUX_LOG_THREAD; + else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~LINUX_LOG_VERBOSE; + else if (::strncasecmp (arg, "watch", 5) == 0 ) flag_bits &= ~LINUX_LOG_WATCHPOINTS; + else + { + feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); + ListLogCategories (feedback_strm); + } + + } + } + + if (flag_bits == 0) + GetLog ().reset(); + else + log->GetMask().Reset (flag_bits); + } + + return; +} + +LogSP +ProcessLinuxLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) +{ + // Try see if there already is a log - that way we can reuse its settings. + // We could reuse the log in toto, but we don't know that the stream is the same. + uint32_t flag_bits = 0; + LogSP log(GetLog ()); + if (log) + flag_bits = log->GetMask().Get(); + + // Now make a new log with this stream if one was provided + if (log_stream_sp) + { + log = make_shared(log_stream_sp); + GetLog () = log; + } + + if (log) + { + bool got_unknown_category = false; + const size_t argc = args.GetArgumentCount(); + for (size_t i=0; iPrintf("error: unrecognized log category '%s'\n", arg); + if (got_unknown_category == false) + { + got_unknown_category = true; + ListLogCategories (feedback_strm); + } + } + } + if (flag_bits == 0) + flag_bits = LINUX_LOG_DEFAULT; + log->GetMask().Reset(flag_bits); + log->GetOptions().Reset(log_options); + } + return log; +} + +void +ProcessLinuxLog::ListLogCategories (Stream *strm) +{ + strm->Printf ("Logging categories for '%s':\n" + " all - turn on all available logging categories\n" + " async - log asynchronous activity\n" + " break - log breakpoints\n" + " communication - log communication activity\n" + " default - enable the default set of logging categories for liblldb\n" + " packets - log gdb remote packets\n" + " memory - log memory reads and writes\n" + " data-short - log memory bytes for memory reads and writes for short transactions only\n" + " data-long - log memory bytes for memory reads and writes for all transactions\n" + " process - log process events and activities\n" + " thread - log thread events and activities\n" + " step - log step related activities\n" + " verbose - enable verbose logging\n" + " watch - log watchpoint related activities\n", ProcessLinux::GetPluginNameStatic()); +} + + +void +ProcessLinuxLog::LogIf (uint32_t mask, const char *format, ...) +{ + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (mask)); + if (log) + { + va_list args; + va_start (args, format); + log->VAPrintf (format, args); + va_end (args); + } +} Index: source/Plugins/Process/Linux/ProcessLinuxLog.h =================================================================== --- source/Plugins/Process/Linux/ProcessLinuxLog.h (revision 0) +++ source/Plugins/Process/Linux/ProcessLinuxLog.h (revision 0) @@ -0,0 +1,54 @@ +//===-- ProcessLinuxLog.h -----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ProcessLinuxLog_h_ +#define liblldb_ProcessLinuxLog_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes + +// Project includes +#include "lldb/Core/Log.h" + +#define LINUX_LOG_VERBOSE (1u << 0) +#define LINUX_LOG_PROCESS (1u << 1) +#define LINUX_LOG_THREAD (1u << 2) +#define LINUX_LOG_PACKETS (1u << 3) +#define LINUX_LOG_MEMORY (1u << 4) // Log memory reads/writes calls +#define LINUX_LOG_MEMORY_DATA_SHORT (1u << 5) // Log short memory reads/writes bytes +#define LINUX_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes +#define LINUX_LOG_BREAKPOINTS (1u << 7) +#define LINUX_LOG_WATCHPOINTS (1u << 8) +#define LINUX_LOG_STEP (1u << 9) +#define LINUX_LOG_COMM (1u << 10) +#define LINUX_LOG_ASYNC (1u << 11) +#define LINUX_LOG_ALL (UINT32_MAX) +#define LINUX_LOG_DEFAULT LINUX_LOG_PACKETS + +class ProcessLinuxLog +{ +public: + static lldb::LogSP + GetLogIfAllCategoriesSet(uint32_t mask = 0); + + static void + DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm); + + static lldb::LogSP + EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm); + + static void + ListLogCategories (lldb_private::Stream *strm); + + static void + LogIf (uint32_t mask, const char *format, ...); +}; + +#endif // liblldb_ProcessLinuxLog_h_ From johnny.chen at apple.com Tue Oct 11 16:17:10 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 11 Oct 2011 21:17:10 -0000 Subject: [Lldb-commits] [lldb] r141711 - /lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Message-ID: <20111011211710.7BA842A6C12C@llvm.org> Author: johnny Date: Tue Oct 11 16:17:10 2011 New Revision: 141711 URL: http://llvm.org/viewvc/llvm-project?rev=141711&view=rev Log: Fix a typo in ProcessKDP::DidAttach(). Patch by Dawn. Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=141711&r1=141710&r2=141711&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Tue Oct 11 16:17:10 2011 @@ -266,7 +266,7 @@ { LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PROCESS)); if (log) - log->Printf ("ProcessKDP::DidLaunch()"); + log->Printf ("ProcessKDP::DidAttach()"); if (GetID() != LLDB_INVALID_PROCESS_ID) { // TODO: figure out the register context that we will use From johnny.chen at apple.com Tue Oct 11 16:21:57 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 11 Oct 2011 21:21:57 -0000 Subject: [Lldb-commits] [lldb] r141712 - in /lldb/trunk/source/Plugins/Process/Linux: ProcessLinux.cpp ProcessLinuxLog.cpp ProcessLinuxLog.h Message-ID: <20111011212157.AC4F1312800A@llvm.org> Author: johnny Date: Tue Oct 11 16:21:57 2011 New Revision: 141712 URL: http://llvm.org/viewvc/llvm-project?rev=141712&view=rev Log: Patch by Dawn to add the logging capabilities to ProcessLinux.cpp. Added: lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.cpp lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.h Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Modified: lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp?rev=141712&r1=141711&r2=141712&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp (original) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinux.cpp Tue Oct 11 16:21:57 2011 @@ -20,6 +20,7 @@ #include "lldb/Target/Target.h" #include "ProcessLinux.h" +#include "ProcessLinuxLog.h" #include "Plugins/Process/Utility/InferiorCallPOSIX.h" #include "ProcessMonitor.h" #include "LinuxThread.h" @@ -43,10 +44,18 @@ if (!g_initialized) { + g_initialized = true; PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); - g_initialized = true; + + Log::Callbacks log_callbacks = { + ProcessLinuxLog::DisableLog, + ProcessLinuxLog::EnableLog, + ProcessLinuxLog::ListLogCategories + }; + + Log::RegisterLogChannel (ProcessLinux::GetPluginNameStatic(), log_callbacks); } } @@ -108,6 +117,10 @@ Error error; assert(m_monitor == NULL); + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (LINUX_LOG_PROCESS)); + if (log && log->GetMask().Test(LINUX_LOG_VERBOSE)) + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); + m_monitor = new ProcessMonitor(this, pid, error); if (!error.Success()) @@ -441,6 +454,10 @@ ProcessLinux::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) { // FIXME: Should this be implemented? + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (LINUX_LOG_THREAD)); + if (log && log->GetMask().Test(LINUX_LOG_VERBOSE)) + log->Printf ("ProcessLinux::%s (pid = %i)", __FUNCTION__, GetID()); + return 0; } Added: lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.cpp?rev=141712&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.cpp (added) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.cpp Tue Oct 11 16:21:57 2011 @@ -0,0 +1,183 @@ +//===-- ProcessLinuxLog.cpp ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "ProcessLinuxLog.h" + +#include "lldb/Interpreter/Args.h" +#include "lldb/Core/StreamFile.h" + +#include "ProcessLinux.h" + +using namespace lldb; +using namespace lldb_private; + + +// We want to avoid global constructors where code needs to be run so here we +// control access to our static g_log_sp by hiding it in a singleton function +// that will construct the static g_lob_sp the first time this function is +// called. +static LogSP & +GetLog () +{ + static LogSP g_log_sp; + return g_log_sp; +} + +LogSP +ProcessLinuxLog::GetLogIfAllCategoriesSet (uint32_t mask) +{ + LogSP log(GetLog ()); + if (log && mask) + { + uint32_t log_mask = log->GetMask().Get(); + if ((log_mask & mask) != mask) + return LogSP(); + } + return log; +} + +void +ProcessLinuxLog::DisableLog (Args &args, Stream *feedback_strm) +{ + LogSP log (GetLog ()); + if (log) + { + uint32_t flag_bits = 0; + + const size_t argc = args.GetArgumentCount (); + if (argc > 0) + { + flag_bits = log->GetMask().Get(); + for (size_t i = 0; i < argc; ++i) + { + const char *arg = args.GetArgumentAtIndex (i); + + + if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~LINUX_LOG_ALL; + else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~LINUX_LOG_ASYNC; + else if (::strncasecmp (arg, "break", 5) == 0 ) flag_bits &= ~LINUX_LOG_BREAKPOINTS; + else if (::strncasecmp (arg, "comm", 4) == 0 ) flag_bits &= ~LINUX_LOG_COMM; + else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~LINUX_LOG_DEFAULT; + else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~LINUX_LOG_PACKETS; + else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~LINUX_LOG_MEMORY; + else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~LINUX_LOG_MEMORY_DATA_SHORT; + else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~LINUX_LOG_MEMORY_DATA_LONG; + else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~LINUX_LOG_PROCESS; + else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~LINUX_LOG_STEP; + else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~LINUX_LOG_THREAD; + else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~LINUX_LOG_VERBOSE; + else if (::strncasecmp (arg, "watch", 5) == 0 ) flag_bits &= ~LINUX_LOG_WATCHPOINTS; + else + { + feedback_strm->Printf("error: unrecognized log category '%s'\n", arg); + ListLogCategories (feedback_strm); + } + + } + } + + if (flag_bits == 0) + GetLog ().reset(); + else + log->GetMask().Reset (flag_bits); + } + + return; +} + +LogSP +ProcessLinuxLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm) +{ + // Try see if there already is a log - that way we can reuse its settings. + // We could reuse the log in toto, but we don't know that the stream is the same. + uint32_t flag_bits = 0; + LogSP log(GetLog ()); + if (log) + flag_bits = log->GetMask().Get(); + + // Now make a new log with this stream if one was provided + if (log_stream_sp) + { + log = make_shared(log_stream_sp); + GetLog () = log; + } + + if (log) + { + bool got_unknown_category = false; + const size_t argc = args.GetArgumentCount(); + for (size_t i=0; iPrintf("error: unrecognized log category '%s'\n", arg); + if (got_unknown_category == false) + { + got_unknown_category = true; + ListLogCategories (feedback_strm); + } + } + } + if (flag_bits == 0) + flag_bits = LINUX_LOG_DEFAULT; + log->GetMask().Reset(flag_bits); + log->GetOptions().Reset(log_options); + } + return log; +} + +void +ProcessLinuxLog::ListLogCategories (Stream *strm) +{ + strm->Printf ("Logging categories for '%s':\n" + " all - turn on all available logging categories\n" + " async - log asynchronous activity\n" + " break - log breakpoints\n" + " communication - log communication activity\n" + " default - enable the default set of logging categories for liblldb\n" + " packets - log gdb remote packets\n" + " memory - log memory reads and writes\n" + " data-short - log memory bytes for memory reads and writes for short transactions only\n" + " data-long - log memory bytes for memory reads and writes for all transactions\n" + " process - log process events and activities\n" + " thread - log thread events and activities\n" + " step - log step related activities\n" + " verbose - enable verbose logging\n" + " watch - log watchpoint related activities\n", ProcessLinux::GetPluginNameStatic()); +} + + +void +ProcessLinuxLog::LogIf (uint32_t mask, const char *format, ...) +{ + LogSP log (ProcessLinuxLog::GetLogIfAllCategoriesSet (mask)); + if (log) + { + va_list args; + va_start (args, format); + log->VAPrintf (format, args); + va_end (args); + } +} Added: lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.h?rev=141712&view=auto ============================================================================== --- lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.h (added) +++ lldb/trunk/source/Plugins/Process/Linux/ProcessLinuxLog.h Tue Oct 11 16:21:57 2011 @@ -0,0 +1,54 @@ +//===-- ProcessLinuxLog.h -----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ProcessLinuxLog_h_ +#define liblldb_ProcessLinuxLog_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes + +// Project includes +#include "lldb/Core/Log.h" + +#define LINUX_LOG_VERBOSE (1u << 0) +#define LINUX_LOG_PROCESS (1u << 1) +#define LINUX_LOG_THREAD (1u << 2) +#define LINUX_LOG_PACKETS (1u << 3) +#define LINUX_LOG_MEMORY (1u << 4) // Log memory reads/writes calls +#define LINUX_LOG_MEMORY_DATA_SHORT (1u << 5) // Log short memory reads/writes bytes +#define LINUX_LOG_MEMORY_DATA_LONG (1u << 6) // Log all memory reads/writes bytes +#define LINUX_LOG_BREAKPOINTS (1u << 7) +#define LINUX_LOG_WATCHPOINTS (1u << 8) +#define LINUX_LOG_STEP (1u << 9) +#define LINUX_LOG_COMM (1u << 10) +#define LINUX_LOG_ASYNC (1u << 11) +#define LINUX_LOG_ALL (UINT32_MAX) +#define LINUX_LOG_DEFAULT LINUX_LOG_PACKETS + +class ProcessLinuxLog +{ +public: + static lldb::LogSP + GetLogIfAllCategoriesSet(uint32_t mask = 0); + + static void + DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm); + + static lldb::LogSP + EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm); + + static void + ListLogCategories (lldb_private::Stream *strm); + + static void + LogIf (uint32_t mask, const char *format, ...); +}; + +#endif // liblldb_ProcessLinuxLog_h_ From johnny.chen at apple.com Tue Oct 11 16:25:12 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 11 Oct 2011 14:25:12 -0700 Subject: [Lldb-commits] [PATCH] add logging to ProcessLinux In-Reply-To: <20111011210831.GA12087@bloodbath.burble.org> References: <20111011210831.GA12087@bloodbath.burble.org> Message-ID: <25DB9467-1BF4-4BF8-8CD4-C4356FBF6E6F@apple.com> Both this patch and the ProcessKDP::DidAttach() patch have been submitted. Thanks! On Oct 11, 2011, at 2:08 PM, dawn at burble.org wrote: > > This patch adds the logging capabilities in ProcessKDP to ProcessLinux. > All flags were kept the same for consistency. > > -Dawn > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From johnny.chen at apple.com Tue Oct 11 18:22:02 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Tue, 11 Oct 2011 23:22:02 -0000 Subject: [Lldb-commits] [lldb] r141740 - /lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py Message-ID: <20111011232202.38A022A6C12C@llvm.org> Author: johnny Date: Tue Oct 11 18:22:02 2011 New Revision: 141740 URL: http://llvm.org/viewvc/llvm-project?rev=141740&view=rev Log: Add a more generic stepping benchmark, which uses the '-k' option of the test driver to be able to specify the runhook(s) to bring the debug session to a certain state before running the benchmarking logic. An example, ./dotest.py -v -t +b -k 'process attach -n Mail' -k 'thread backtrace all' -p TestRunHooksThenSteppings.py spawns lldb, attaches to the 'Mail' application, does a backtrace for all threads, and then runs the benchmark to step the inferior multiple times. Added: lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py Added: lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py?rev=141740&view=auto ============================================================================== --- lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py (added) +++ lldb/trunk/test/benchmarks/stepping/TestRunHooksThenSteppings.py Tue Oct 11 18:22:02 2011 @@ -0,0 +1,71 @@ +"""Test lldb's stepping speed.""" + +import os, sys +import unittest2 +import lldb +import pexpect +from lldbbench import * + +class RunHooksThenSteppingsBench(BenchBase): + + mydir = os.path.join("benchmarks", "stepping") + + def setUp(self): + BenchBase.setUp(self) + self.stepping_avg = None + + @benchmarks_test + def test_lldb_runhooks_then_steppings(self): + """Test lldb steppings on a large executable.""" + print + self.run_lldb_runhooks_then_steppings(50) + print "lldb stepping benchmark:", self.stopwatch + + def run_lldb_runhooks_then_steppings(self, count): + # Set self.child_prompt, which is "(lldb) ". + self.child_prompt = '(lldb) ' + prompt = self.child_prompt + + self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption)) + self.child.expect_exact(prompt) + # So that the child gets torn down after the test. + child = self.child + + # Turn on logging for what the child sends back. + if self.TraceOn(): + child.logfile_read = sys.stdout + + #lldb.runHooks = ['process attach -n Mail'] + + # Perform the run hooks to bring lldb debugger to the desired state. + if not lldb.runHooks: + self.skipTest("No runhooks specified for lldb, skip the test") + for hook in lldb.runHooks: + child.sendline(hook) + child.expect_exact(prompt) + + # Reset the stopwatch now. + self.stopwatch.reset() + for i in range(count): + with self.stopwatch: + # Disassemble the function. + child.sendline('next') # Aka 'thread step-over'. + child.expect_exact(prompt) + + child.sendline('quit') + try: + self.child.expect(pexpect.EOF) + except: + pass + + self.stepping_avg = self.stopwatch.avg() + if self.TraceOn(): + print "lldb stepping benchmark:", str(self.stopwatch) + self.child = None + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() From scallanan at apple.com Tue Oct 11 19:12:34 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 00:12:34 -0000 Subject: [Lldb-commits] [lldb] r141748 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h include/lldb/Symbol/ClangASTImporter.h source/Expression/ClangASTSource.cpp source/Expression/ClangExpressionDeclMap.cpp source/Expression/ClangExpressionParser.cpp source/Symbol/ClangASTImporter.cpp Message-ID: <20111012001234.808E82A6C12C@llvm.org> Author: spyffe Date: Tue Oct 11 19:12:34 2011 New Revision: 141748 URL: http://llvm.org/viewvc/llvm-project?rev=141748&view=rev Log: Implemented a namespace map that allows searching of namespaces (only in the modules where they've been found) for entities inside those namespaces. For each NamespaceDecl that has been imported into the parser, we maintain a map containing [ModuleSP, ClangNamespaceDecl] pairs in the ASTImporter. This map has one entry for each module in which the namespace has been found. When we later scan for an entity inside a namespace, we search only the modules in which that namespace was found. Also made a small whitespace fix in ClangExpressionParser.cpp. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/include/lldb/Symbol/ClangASTImporter.h lldb/trunk/source/Expression/ClangASTSource.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/ClangExpressionParser.cpp lldb/trunk/source/Symbol/ClangASTImporter.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141748&r1=141747&r2=141748&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Tue Oct 11 19:12:34 2011 @@ -117,7 +117,7 @@ clang::NamespaceDecl * AddNamespace (NameSearchContext &context, - const ClangNamespaceDecl &namespace_decl); + ClangASTImporter::NamespaceMapSP &namespace_decls); //------------------------------------------------------------------ /// [Used by IRForTarget] Get a constant variable given a name, @@ -601,8 +601,8 @@ /// True on success; false otherwise. //------------------------------------------------------------------ void - GetDecls (NameSearchContext &context, - const ConstString &name); + FindExternalVisibleDecls (NameSearchContext &context, + const ConstString &name); //------------------------------------------------------------------ /// [Used by ClangASTSource] Find all Decls in a context that match @@ -831,6 +831,34 @@ } //------------------------------------------------------------------ + /// [Used by ClangASTSource] Find all entities matching a given name, + /// using a NameSearchContext to make Decls for them. + /// + /// @param[in] context + /// The NameSearchContext that can construct Decls for this name. + /// + /// @param[in] module + /// If non-NULL, the module to query. + /// + /// @param[in] decl + /// If non-NULL and module is non-NULL, the parent namespace. + /// + /// @param[in] name + /// The name as a plain C string. The NameSearchContext contains + /// a DeclarationName for the name so at first the name may seem + /// redundant, but ClangExpressionDeclMap operates in RTTI land so + /// it can't access DeclarationName. + /// + /// @return + /// True on success; false otherwise. + //------------------------------------------------------------------ + void + FindExternalVisibleDecls (NameSearchContext &context, + lldb::ModuleSP module, + ClangNamespaceDecl &decl, + const ConstString &name); + + //------------------------------------------------------------------ /// Given a stack frame, find a variable that matches the given name and /// type. We need this for expression re-use; we may not always get the /// same lldb::Variable back, and we want the expression to work wherever Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=141748&r1=141747&r2=141748&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Tue Oct 11 19:12:34 2011 @@ -63,6 +63,13 @@ return origin.Valid(); } + typedef std::map NamespaceMap; + typedef lldb::SharedPtr::Type NamespaceMapSP; + + void RegisterNamespaceMap(const clang::NamespaceDecl *decl, + NamespaceMapSP &namespace_map); + + NamespaceMapSP GetNamespaceMap(const clang::NamespaceDecl *decl); private: struct DeclOrigin @@ -152,7 +159,10 @@ return DeclOrigin(); } - clang::FileManager m_file_manager; + typedef std::map NamespaceMetaMap; + + NamespaceMetaMap m_namespace_maps; + clang::FileManager m_file_manager; clang::ASTContext *m_target_ctx; MinionMap m_minions; MinionMap m_minimal_minions; Modified: lldb/trunk/source/Expression/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=141748&r1=141747&r2=141748&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangASTSource.cpp (original) +++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Oct 11 19:12:34 2011 @@ -105,7 +105,7 @@ // printf("[%5u] FindExternalVisibleDeclsByName() \"%s\"\n", g_depth, uniqued_const_decl_name); llvm::SmallVector name_decls; NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx); - m_decl_map.GetDecls(name_search_context, const_decl_name); + m_decl_map.FindExternalVisibleDecls(name_search_context, const_decl_name); DeclContext::lookup_result result (SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls)); // --g_depth; m_active_lookups.erase (uniqued_const_decl_name); Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141748&r1=141747&r2=141748&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Oct 11 19:12:34 2011 @@ -32,6 +32,7 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/Variable.h" @@ -2055,16 +2056,10 @@ // Interface for ClangASTSource -void -ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString &name) +void +ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, const ConstString &name) { - assert (m_struct_vars.get()); - assert (m_parser_vars.get()); - lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - - if (log) - log->Printf("Hunting for a definition for '%s'", name.GetCString()); if (m_parser_vars->m_ignore_lookups) { @@ -2073,6 +2068,65 @@ return; } + if (log) + { + if (!context.m_decl_context) + log->Printf("FindExternalVisibleDecls for '%s' in a NULL DeclContext", name.GetCString()); + else if (const NamedDecl *context_named_decl = dyn_cast(context.m_decl_context)) + log->Printf("FindExternalVisibleDecls for '%s' in '%s'", name.GetCString(), context_named_decl->getNameAsString().c_str()); + else + log->Printf("FindExternalVisibleDecls for '%s' in a '%s'", name.GetCString(), context.m_decl_context->getDeclKindName()); + } + + if (const NamespaceDecl *namespace_context = dyn_cast(context.m_decl_context)) + { + ClangASTImporter::NamespaceMapSP namespace_map = m_parser_vars->m_ast_importer->GetNamespaceMap(namespace_context); + + for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); + i != e; + ++i) + { + if (log) + log->Printf(" Searching namespace '%s' in file '%s'", + i->second.GetNamespaceDecl()->getNameAsString().c_str(), + i->first->GetFileSpec().GetFilename().GetCString()); + + //FindExternalVisibleDecls(context, + // i->first, + // i->second, + // name); + } + } + else if (!isa(context.m_decl_context)) + { + // we shouldn't be getting FindExternalVisibleDecls calls for these + return; + } + else + { + ClangNamespaceDecl namespace_decl; + + if (log) + log->Printf(" Searching without a namespace"); + + FindExternalVisibleDecls(context, + lldb::ModuleSP(), + namespace_decl, + name); + } +} + +void +ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, + lldb::ModuleSP module, + ClangNamespaceDecl &decl, + const ConstString &name) +{ + assert (m_struct_vars.get()); + assert (m_parser_vars.get()); + + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); + do { if (isa(context.m_decl_context)) @@ -2153,10 +2207,10 @@ if (frame) { valobj = frame->GetValueForVariableExpressionPath(name_unique_cstr, - eNoDynamicValues, - StackFrame::eExpressionPathOptionCheckPtrVsMember, - var, - err); + eNoDynamicValues, + StackFrame::eExpressionPathOptionCheckPtrVsMember, + var, + err); // If we found a variable in scope, no need to pull up function names if (err.Success() && var != NULL) @@ -2249,25 +2303,53 @@ } } - ClangNamespaceDecl namespace_decl (m_parser_vars->m_sym_ctx.FindNamespace(name)); + ModuleList &images = m_parser_vars->m_sym_ctx.target_sp->GetImages(); + + ClangASTImporter::NamespaceMapSP namespace_decls(new ClangASTImporter::NamespaceMap); - if (namespace_decl) + for (uint32_t i = 0, e = images.GetSize(); + i != e; + ++i) { - if (log) - { - std::string s; - llvm::raw_string_ostream os(s); - namespace_decl.GetNamespaceDecl()->print(os); - os.flush(); + ModuleSP image = images.GetModuleAtIndex(i); + + if (!image) + continue; + + ClangNamespaceDecl namespace_decl; + + SymbolVendor *symbol_vendor = image->GetSymbolVendor(); + + if (!symbol_vendor) + continue; + + SymbolContext null_sc; + + namespace_decl = symbol_vendor->FindNamespace(null_sc, name); + + if (namespace_decl) + { + (*namespace_decls)[image] = namespace_decl; - log->Printf("Added namespace decl:"); - log->Printf("%s", s.c_str()); + if (log) + { + std::string s; + llvm::raw_string_ostream os(s); + namespace_decl.GetNamespaceDecl()->print(os); + os.flush(); + + log->Printf("Found namespace %s in file %s", s.c_str(), image->GetFileSpec().GetFilename().GetCString()); + } } + } + + if (!namespace_decls->empty()) + { + NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decls); - NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decl); if (clang_namespace_decl) - clang_namespace_decl->setHasExternalLexicalStorage(); - } + clang_namespace_decl->setHasExternalVisibleStorage(); + } } else { @@ -2485,7 +2567,20 @@ ASTContext *ast_context = &context_decl->getASTContext(); if (log) - log->Printf("Finding lexical decls in a '%s' with %s predicate", context_decl->getDeclKindName(), (predicate ? "non-null" : "null")); + { + if (const NamedDecl *context_named_decl = dyn_cast(context_decl)) + log->Printf("FindExternalLexicalDecls in '%s' (a %s) with %s predicate", + context_named_decl->getNameAsString().c_str(), + context_decl->getDeclKindName(), + (predicate ? "non-null" : "null")); + else if(context_decl) + log->Printf("FindExternalLexicalDecls in a %s with %s predicate", + context_decl->getDeclKindName(), + (predicate ? "non-null" : "null")); + else + log->Printf("FindExternalLexicalDecls in a NULL context with %s predicate", + (predicate ? "non-null" : "null")); + } Decl *original_decl = NULL; ASTContext *original_ctx = NULL; @@ -2933,15 +3028,24 @@ } NamespaceDecl * -ClangExpressionDeclMap::AddNamespace (NameSearchContext &context, const ClangNamespaceDecl &namespace_decl) +ClangExpressionDeclMap::AddNamespace (NameSearchContext &context, ClangASTImporter::NamespaceMapSP &namespace_decls) { + if (namespace_decls.empty()) + return NULL; + lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); assert (m_parser_vars.get()); + const ClangNamespaceDecl &namespace_decl = namespace_decls->begin()->second; + Decl *copied_decl = m_parser_vars->GetASTImporter(context.GetASTContext())->CopyDecl(namespace_decl.GetASTContext(), - namespace_decl.GetNamespaceDecl()); - + namespace_decl.GetNamespaceDecl()); + + NamespaceDecl *copied_namespace_decl = dyn_cast(copied_decl); + + m_parser_vars->GetASTImporter(context.GetASTContext())->RegisterNamespaceMap(copied_namespace_decl, namespace_decls); + return dyn_cast(copied_decl); } Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=141748&r1=141747&r2=141748&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Tue Oct 11 19:12:34 2011 @@ -556,7 +556,7 @@ .setOptLevel(CodeGenOpt::Less) .setAllocateGVsWithCode(true) .setCodeModel(CodeModel::Small) - .setUseMCJIT(true); + .setUseMCJIT(true); m_execution_engine.reset(builder.create()); #endif Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=141748&r1=141747&r2=141748&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Tue Oct 11 19:12:34 2011 @@ -93,6 +93,24 @@ return; } +void +ClangASTImporter::RegisterNamespaceMap(const clang::NamespaceDecl *decl, + NamespaceMapSP &namespace_map) +{ + m_namespace_maps[decl] = namespace_map; +} + +ClangASTImporter::NamespaceMapSP +ClangASTImporter::GetNamespaceMap(const clang::NamespaceDecl *decl) +{ + NamespaceMetaMap::iterator iter = m_namespace_maps.find(decl); + + if (iter != m_namespace_maps.end()) + return iter->second; + else + return NamespaceMapSP(); +} + clang::Decl *ClangASTImporter::Minion::Imported (clang::Decl *from, clang::Decl *to) { From gclayton at apple.com Tue Oct 11 19:53:30 2011 From: gclayton at apple.com (Greg Clayton) Date: Wed, 12 Oct 2011 00:53:30 -0000 Subject: [Lldb-commits] [lldb] r141755 - in /lldb/trunk: include/lldb/Core/MappedHash.h source/API/SBData.cpp source/Core/DataExtractor.cpp source/Core/FormatClasses.cpp source/Core/FormatManager.cpp source/Expression/IRInterpreter.cpp source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h Message-ID: <20111012005330.39C54312800A@llvm.org> Author: gclayton Date: Tue Oct 11 19:53:29 2011 New Revision: 141755 URL: http://llvm.org/viewvc/llvm-project?rev=141755&view=rev Log: Fix preprocessor warnings for no newline at the end of the source files. Modified: lldb/trunk/include/lldb/Core/MappedHash.h lldb/trunk/source/API/SBData.cpp lldb/trunk/source/Core/DataExtractor.cpp lldb/trunk/source/Core/FormatClasses.cpp lldb/trunk/source/Core/FormatManager.cpp lldb/trunk/source/Expression/IRInterpreter.cpp lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h Modified: lldb/trunk/include/lldb/Core/MappedHash.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/MappedHash.h?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/MappedHash.h (original) +++ lldb/trunk/include/lldb/Core/MappedHash.h Tue Oct 11 19:53:29 2011 @@ -519,4 +519,4 @@ }; -#endif // #ifndef liblldb_MappedHash_h_ \ No newline at end of file +#endif // #ifndef liblldb_MappedHash_h_ Modified: lldb/trunk/source/API/SBData.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBData.cpp?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/source/API/SBData.cpp (original) +++ lldb/trunk/source/API/SBData.cpp Tue Oct 11 19:53:29 2011 @@ -486,4 +486,4 @@ log->Printf ("SBData::Append (rhs=%p) => " "(%s)", rhs.get(), value ? "true" : "false"); return value; -} \ No newline at end of file +} Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Tue Oct 11 19:53:29 2011 @@ -1899,4 +1899,4 @@ SetData(buffer_sp); return true; -} \ No newline at end of file +} Modified: lldb/trunk/source/Core/FormatClasses.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatClasses.cpp?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/source/Core/FormatClasses.cpp (original) +++ lldb/trunk/source/Core/FormatClasses.cpp Tue Oct 11 19:53:29 2011 @@ -306,4 +306,4 @@ if (index < 0) return UINT32_MAX; return index; -} \ No newline at end of file +} Modified: lldb/trunk/source/Core/FormatManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatManager.cpp?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/source/Core/FormatManager.cpp (original) +++ lldb/trunk/source/Core/FormatManager.cpp Tue Oct 11 19:53:29 2011 @@ -615,4 +615,4 @@ EnableCategory(m_gnu_cpp_category_name); EnableCategory(m_default_category_name); -} \ No newline at end of file +} Modified: lldb/trunk/source/Expression/IRInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/source/Expression/IRInterpreter.cpp (original) +++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Oct 11 19:53:29 2011 @@ -1393,4 +1393,4 @@ return false; return false; -} \ No newline at end of file +} Modified: lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h?rev=141755&r1=141754&r2=141755&view=diff ============================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h (original) +++ lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.h Tue Oct 11 19:53:29 2011 @@ -87,4 +87,4 @@ }; -#endif // #ifndef liblldb_OperatingSystemDarwinKernel_h_ \ No newline at end of file +#endif // #ifndef liblldb_OperatingSystemDarwinKernel_h_ From johnny.chen at apple.com Tue Oct 11 20:28:23 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 01:28:23 -0000 Subject: [Lldb-commits] [lldb] r141764 - /lldb/trunk/docs/lldb-for-gdb-users.txt Message-ID: <20111012012823.94E812A6C12C@llvm.org> Author: johnny Date: Tue Oct 11 20:28:23 2011 New Revision: 141764 URL: http://llvm.org/viewvc/llvm-project?rev=141764&view=rev Log: Add description of a more capable 'cd' command using 'command script add'. Modified: lldb/trunk/docs/lldb-for-gdb-users.txt Modified: lldb/trunk/docs/lldb-for-gdb-users.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-for-gdb-users.txt?rev=141764&r1=141763&r2=141764&view=diff ============================================================================== --- lldb/trunk/docs/lldb-for-gdb-users.txt (original) +++ lldb/trunk/docs/lldb-for-gdb-users.txt Tue Oct 11 20:28:23 2011 @@ -448,3 +448,38 @@ (lldb) pwd /private/tmp (lldb) + +Or for a more capable 'cd' command, create ~/utils.py like this: + +import os + +def chdir(debugger, args, result, dict): + """Change the working directory, or cd to ${HOME}.""" + dir = args.strip() + if dir: + os.chdir(args) + else: + os.chdir(os.path.expanduser('~')) + print "Current working directory: %s" % os.getcwd() + +and, have the following in your ~/.lldbinit file: + +script import os, sys +script sys.path.append(os.path.expanduser('~')) +script import utils +command alias pwd script print os.getcwd() +command script add -f utils.chdir cd + +and, then in your lldb session, you can have: + +(lldb) help cd + +Change the working directory, or cd to ${HOME}. +Syntax: cd +(lldb) cd +Current working directory: /Volumes/data/Users/johnny +(lldb) cd /tmp +Current working directory: /private/tmp +(lldb) pwd +/private/tmp +(lldb) From scallanan at apple.com Tue Oct 11 20:39:28 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 01:39:28 -0000 Subject: [Lldb-commits] [lldb] r141765 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111012013928.EC42C312800A@llvm.org> Author: spyffe Date: Tue Oct 11 20:39:28 2011 New Revision: 141765 URL: http://llvm.org/viewvc/llvm-project?rev=141765&view=rev Log: Cleanups in preparation for making FindExternalVisibleDecls look in individual modules rather than globally. Also some whitespace fixes. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141765&r1=141764&r2=141765&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Tue Oct 11 20:39:28 2011 @@ -855,7 +855,7 @@ void FindExternalVisibleDecls (NameSearchContext &context, lldb::ModuleSP module, - ClangNamespaceDecl &decl, + ClangNamespaceDecl &namespace_decl, const ConstString &name); //------------------------------------------------------------------ Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141765&r1=141764&r2=141765&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Oct 11 20:39:28 2011 @@ -2119,73 +2119,14 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, lldb::ModuleSP module, - ClangNamespaceDecl &decl, + ClangNamespaceDecl &namespace_decl, const ConstString &name) { assert (m_struct_vars.get()); assert (m_parser_vars.get()); lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); - - do - { - if (isa(context.m_decl_context)) - break; - - if (!isa(context.m_decl_context)) - return; - - const Decl *context_decl = dyn_cast(context.m_decl_context); - - if (log) - log->Printf("Searching for '%s' in a '%s'", name.GetCString(), context_decl->getDeclKindName()); - - Decl *original_decl = NULL; - ASTContext *original_ctx = NULL; - - if (!m_parser_vars->GetASTImporter(context.GetASTContext())->ResolveDeclOrigin(context_decl, &original_decl, &original_ctx)) - break; - - if (TagDecl *original_tag_decl = dyn_cast(original_decl)) - { - ExternalASTSource *external_source = original_ctx->getExternalSource(); - if (!external_source) - break; - - if (!original_tag_decl) - break; - - external_source->CompleteType (original_tag_decl); - } - - DeclContext *original_decl_context = dyn_cast(original_decl); - - if (!original_decl_context) - break; - - for (TagDecl::decl_iterator iter = original_decl_context->decls_begin(); - iter != original_decl_context->decls_end(); - ++iter) - { - NamedDecl *named_decl = dyn_cast(*iter); - - if (named_decl && named_decl->getName().equals(name.GetCString())) - { - Decl *copied_decl = m_parser_vars->GetASTImporter(context.GetASTContext())->CopyDecl(original_ctx, named_decl); - NamedDecl *copied_named_decl = dyn_cast(copied_decl); - - if (!copied_named_decl) - continue; - - context.AddNamedDecl (copied_named_decl); - } - } - - return; - } - while (0); - SymbolContextList sc_list; const char *name_unique_cstr = name.GetCString(); @@ -2197,161 +2138,7 @@ // doesn't start with our phony prefix of '$' Target *target = m_parser_vars->m_exe_ctx->GetTargetPtr(); StackFrame *frame = m_parser_vars->m_exe_ctx->GetFramePtr(); - if (name_unique_cstr[0] != '$') - { - ValueObjectSP valobj; - VariableSP var; - Error err; - bool found = false; - - if (frame) - { - valobj = frame->GetValueForVariableExpressionPath(name_unique_cstr, - eNoDynamicValues, - StackFrame::eExpressionPathOptionCheckPtrVsMember, - var, - err); - - // If we found a variable in scope, no need to pull up function names - if (err.Success() && var != NULL) - { - AddOneVariable(context, var); - found = true; - } - } - else if (target) - { - var = FindGlobalVariable (*target, - name_unique_cstr, - NULL); - - if (var) - { - AddOneVariable(context, var); - found = true; - } - } - - if (!found) - { - const bool include_symbols = true; - const bool append = false; - m_parser_vars->m_sym_ctx.FindFunctionsByName (name, - eFunctionNameTypeBase, - include_symbols, - append, - sc_list); - - if (sc_list.GetSize()) - { - bool found_specific = false; - Symbol *generic_symbol = NULL; - Symbol *non_extern_symbol = NULL; - - for (uint32_t index = 0, num_indices = sc_list.GetSize(); - index < num_indices; - ++index) - { - SymbolContext sym_ctx; - sc_list.GetContextAtIndex(index, sym_ctx); - - if (sym_ctx.function) - { - // TODO only do this if it's a C function; C++ functions may be - // overloaded - if (!found_specific) - AddOneFunction(context, sym_ctx.function, NULL); - found_specific = true; - found = true; - } - else if (sym_ctx.symbol) - { - if (sym_ctx.symbol->IsExternal()) - generic_symbol = sym_ctx.symbol; - else - non_extern_symbol = sym_ctx.symbol; - } - } - - if (!found_specific) - { - if (generic_symbol) - { - AddOneFunction (context, NULL, generic_symbol); - found = true; - } - else if (non_extern_symbol) - { - AddOneFunction (context, NULL, non_extern_symbol); - found = true; - } - } - } - - if (!found) - { - // We couldn't find a variable or function for this. Now we'll hunt for a generic - // data symbol, and -- if it is found -- treat it as a variable. - - Symbol *data_symbol = FindGlobalDataSymbol(*target, name); - - if (data_symbol) - { - AddOneGenericVariable(context, *data_symbol); - found = true; - } - } - } - - ModuleList &images = m_parser_vars->m_sym_ctx.target_sp->GetImages(); - - ClangASTImporter::NamespaceMapSP namespace_decls(new ClangASTImporter::NamespaceMap); - - for (uint32_t i = 0, e = images.GetSize(); - i != e; - ++i) - { - ModuleSP image = images.GetModuleAtIndex(i); - - if (!image) - continue; - - ClangNamespaceDecl namespace_decl; - - SymbolVendor *symbol_vendor = image->GetSymbolVendor(); - - if (!symbol_vendor) - continue; - - SymbolContext null_sc; - - namespace_decl = symbol_vendor->FindNamespace(null_sc, name); - - if (namespace_decl) - { - (*namespace_decls)[image] = namespace_decl; - - if (log) - { - std::string s; - llvm::raw_string_ostream os(s); - namespace_decl.GetNamespaceDecl()->print(os); - os.flush(); - - log->Printf("Found namespace %s in file %s", s.c_str(), image->GetFileSpec().GetFilename().GetCString()); - } - } - } - - if (!namespace_decls->empty()) - { - NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decls); - - if (clang_namespace_decl) - clang_namespace_decl->setHasExternalVisibleStorage(); - } - } - else + if (name_unique_cstr[0] == '$' && !namespace_decl) { static ConstString g_lldb_class_name ("$__lldb_class"); @@ -2386,7 +2173,7 @@ this_type->Dump(&strm, true); log->PutCString (strm.GetData()); } - + TypeFromUser this_user_type(this_type->GetClangFullType(), this_type->GetClangAST()); @@ -2405,7 +2192,7 @@ TypeFromUser class_user_type(pointer_target_qual_type.getAsOpaquePtr(), this_type->GetClangAST()); - + if (log) { StreamString type_stream; @@ -2428,34 +2215,34 @@ return; VariableList *vars = frame->GetVariableList(false); - + if (!vars) return; - + lldb::VariableSP self_var = vars->FindVariable(ConstString("self")); - + if (!self_var || !self_var->IsInScope(frame) || !self_var->LocationIsValidForFrame (frame)) return; - + Type *self_type = self_var->GetType(); if (!self_type) return; - + TypeFromUser self_user_type(self_type->GetClangFullType(), self_type->GetClangAST()); m_struct_vars->m_object_pointer_type = self_user_type; - + void *pointer_target_type = NULL; - + if (!ClangASTContext::IsPointerType(self_user_type.GetOpaqueQualType(), &pointer_target_type) || pointer_target_type == NULL) return; - + TypeFromUser class_user_type(pointer_target_type, self_type->GetClangAST()); @@ -2475,7 +2262,7 @@ // any other $__lldb names should be weeded out now if (!::strncmp(name_unique_cstr, "$__lldb", sizeof("$__lldb") - 1)) return; - + do { if (!target) @@ -2492,7 +2279,7 @@ break; TypeDecl *ptype_type_decl = m_parser_vars->m_persistent_vars->GetPersistentType(name); - + if (!ptype_type_decl) break; @@ -2513,7 +2300,7 @@ } while (0); ClangExpressionVariableSP pvar_sp(m_parser_vars->m_persistent_vars->GetVariable(name)); - + if (pvar_sp) { AddOneVariable(context, pvar_sp); @@ -2530,6 +2317,160 @@ AddOneRegister(context, reg_info); } } + else + { + ValueObjectSP valobj; + VariableSP var; + Error err; + bool found = false; + + if (frame && !namespace_decl) + { + valobj = frame->GetValueForVariableExpressionPath(name_unique_cstr, + eNoDynamicValues, + StackFrame::eExpressionPathOptionCheckPtrVsMember, + var, + err); + + // If we found a variable in scope, no need to pull up function names + if (err.Success() && var != NULL) + { + AddOneVariable(context, var); + found = true; + } + } + else if (target) + { + var = FindGlobalVariable (*target, + name_unique_cstr, + NULL); + + if (var) + { + AddOneVariable(context, var); + found = true; + } + } + + if (!found) + { + const bool include_symbols = true; + const bool append = false; + m_parser_vars->m_sym_ctx.FindFunctionsByName (name, + eFunctionNameTypeBase, + include_symbols, + append, + sc_list); + + if (sc_list.GetSize()) + { + bool found_specific = false; + Symbol *generic_symbol = NULL; + Symbol *non_extern_symbol = NULL; + + for (uint32_t index = 0, num_indices = sc_list.GetSize(); + index < num_indices; + ++index) + { + SymbolContext sym_ctx; + sc_list.GetContextAtIndex(index, sym_ctx); + + if (sym_ctx.function) + { + // TODO only do this if it's a C function; C++ functions may be + // overloaded + if (!found_specific) + AddOneFunction(context, sym_ctx.function, NULL); + found_specific = true; + found = true; + } + else if (sym_ctx.symbol) + { + if (sym_ctx.symbol->IsExternal()) + generic_symbol = sym_ctx.symbol; + else + non_extern_symbol = sym_ctx.symbol; + } + } + + if (!found_specific) + { + if (generic_symbol) + { + AddOneFunction (context, NULL, generic_symbol); + found = true; + } + else if (non_extern_symbol) + { + AddOneFunction (context, NULL, non_extern_symbol); + found = true; + } + } + } + + if (!found) + { + // We couldn't find a variable or function for this. Now we'll hunt for a generic + // data symbol, and -- if it is found -- treat it as a variable. + + Symbol *data_symbol = FindGlobalDataSymbol(*target, name); + + if (data_symbol) + { + AddOneGenericVariable(context, *data_symbol); + found = true; + } + } + } + + ModuleList &images = m_parser_vars->m_sym_ctx.target_sp->GetImages(); + + ClangASTImporter::NamespaceMapSP namespace_decls(new ClangASTImporter::NamespaceMap); + + for (uint32_t i = 0, e = images.GetSize(); + i != e; + ++i) + { + ModuleSP image = images.GetModuleAtIndex(i); + + if (!image) + continue; + + ClangNamespaceDecl namespace_decl; + + SymbolVendor *symbol_vendor = image->GetSymbolVendor(); + + if (!symbol_vendor) + continue; + + SymbolContext null_sc; + + namespace_decl = symbol_vendor->FindNamespace(null_sc, name); + + if (namespace_decl) + { + (*namespace_decls)[image] = namespace_decl; + + if (log) + { + std::string s; + llvm::raw_string_ostream os(s); + namespace_decl.GetNamespaceDecl()->print(os); + os.flush(); + + log->Printf("Found namespace %s in file %s", s.c_str(), image->GetFileSpec().GetFilename().GetCString()); + } + } + } + + if (!namespace_decls->empty()) + { + NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decls); + + if (clang_namespace_decl) + clang_namespace_decl->setHasExternalVisibleStorage(); + } + } lldb::TypeSP type_sp (m_parser_vars->m_sym_ctx.FindTypeByName (name)); From scallanan at apple.com Tue Oct 11 21:08:08 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 02:08:08 -0000 Subject: [Lldb-commits] [lldb] r141766 - in /lldb/trunk: include/lldb/Core/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Expression/ source/Plugins/ObjectFile/Mach-O/ source/Plugins/OperatingSystem/Darwin-Kernel/ source/Symbol/ Message-ID: <20111012020808.4B38B312800A@llvm.org> Author: spyffe Date: Tue Oct 11 21:08:07 2011 New Revision: 141766 URL: http://llvm.org/viewvc/llvm-project?rev=141766&view=rev Log: Added ClangNamespaceDecl * parameters to several core Module functions that the expression parser will soon be using. Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/AddressResolverName.cpp lldb/trunk/source/Core/Disassembler.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Core/SourceManager.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp lldb/trunk/source/Symbol/SymbolContext.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Tue Oct 11 21:08:07 2011 @@ -160,7 +160,8 @@ lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); size_t - FindSymbolsWithNameAndType (const ConstString &name, + FindSymbolsWithNameAndType (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, lldb::SymbolType symbol_type, SymbolContextList &sc_list); @@ -207,6 +208,9 @@ /// @param[in] name /// The name of the compile unit we are looking for. /// + /// @param[in] namespace_decl + /// If valid, a namespace to search in. + /// /// @param[in] name_type_mask /// A bit mask of bits that indicate what kind of names should /// be used when doing the lookup. Bits include fully qualified @@ -225,7 +229,8 @@ /// The number of matches added to \a sc_list. //------------------------------------------------------------------ uint32_t - FindFunctions (const ConstString &name, + FindFunctions (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool symbols_ok, bool append, @@ -266,6 +271,9 @@ /// The name of the global or static variable we are looking /// for. /// + /// @param[in] namespace_decl + /// If valid, a namespace to search in. + /// /// @param[in] append /// If \b true, any matches will be appended to \a /// variable_list, else matches replace the contents of @@ -283,7 +291,8 @@ /// The number of matches added to \a variable_list. //------------------------------------------------------------------ uint32_t - FindGlobalVariables (const ConstString &name, + FindGlobalVariables (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variable_list); @@ -326,6 +335,9 @@ /// @param[in] name /// The name of the type we are looking for. /// + /// @param[in] namespace_decl + /// If valid, a namespace to search in. + /// /// @param[in] append /// If \b true, any matches will be appended to \a /// variable_list, else matches replace the contents of @@ -350,8 +362,9 @@ /// The number of matches added to \a type_list. //------------------------------------------------------------------ uint32_t - FindTypes (const SymbolContext& sc, - const ConstString &name, + FindTypes (const SymbolContext& sc, + const ConstString &name, + const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types); Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Tue Oct 11 21:08:07 2011 @@ -344,7 +344,8 @@ if (m_opaque_sp) { const bool symbols_ok = true; - return m_opaque_sp->FindFunctions (ConstString(name), + return m_opaque_sp->FindFunctions (ConstString(name), + NULL, name_type_mask, symbols_ok, append, @@ -361,7 +362,8 @@ if (m_opaque_sp) { VariableList variable_list; - const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name), + const uint32_t match_count = m_opaque_sp->FindGlobalVariables (ConstString (name), + NULL, false, max_matches, variable_list); @@ -398,6 +400,7 @@ num_matches = m_opaque_sp->FindTypes(sc, name, + NULL, false, 1, type_list); @@ -423,6 +426,7 @@ num_matches = m_opaque_sp->FindTypes(sc, name, + NULL, false, UINT32_MAX, type_list); Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Tue Oct 11 21:08:07 2011 @@ -16,6 +16,7 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Target/Target.h" using namespace lldb; @@ -128,17 +129,18 @@ if (context.module_sp) { uint32_t num_functions = context.module_sp->FindFunctions (m_func_name, - m_func_name_type_mask, - include_symbols, - append, - func_list); + NULL, + m_func_name_type_mask, + include_symbols, + append, + func_list); // If the search filter specifies a Compilation Unit, then we don't need to bother to look in plain // symbols, since all the ones from a set compilation unit will have been found above already. if (num_functions == 0 && !filter_by_cu) { if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto)) - context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list); + context.module_sp->FindSymbolsWithNameAndType (m_func_name, NULL, eSymbolTypeCode, sym_list); } } break; Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Oct 11 21:08:07 2011 @@ -25,6 +25,7 @@ #include "lldb/Interpreter/OptionGroupFormat.h" #include "lldb/Interpreter/OptionGroupOutputFile.h" #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" @@ -447,8 +448,9 @@ sc = frame->GetSymbolContext (eSymbolContextModule); if (sc.module_sp) { - sc.module_sp->FindTypes (sc, - lookup_type_name, + sc.module_sp->FindTypes (sc, + lookup_type_name, + NULL, append, 1, type_list); Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Oct 11 21:08:07 2011 @@ -1498,7 +1498,8 @@ else { ConstString function_name (name); - num_matches = module->FindFunctions (function_name, + num_matches = module->FindFunctions (function_name, + NULL, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, include_symbols, append, @@ -1543,7 +1544,7 @@ // else // { ConstString name(name_cstr); - num_matches = module->FindTypes(sc, name, true, UINT32_MAX, type_list); + num_matches = module->FindTypes(sc, name, NULL, true, UINT32_MAX, type_list); // } if (num_matches) Modified: lldb/trunk/source/Core/AddressResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverName.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverName.cpp (original) +++ lldb/trunk/source/Core/AddressResolverName.cpp Tue Oct 11 21:08:07 2011 @@ -12,6 +12,7 @@ // Project includes #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/lldb-private-log.h" using namespace lldb; @@ -109,10 +110,12 @@ case AddressResolver::Exact: if (context.module_sp) { - context.module_sp->FindSymbolsWithNameAndType (m_func_name, + context.module_sp->FindSymbolsWithNameAndType (m_func_name, + NULL, eSymbolTypeCode, sym_list); - context.module_sp->FindFunctions (m_func_name, + context.module_sp->FindFunctions (m_func_name, + NULL, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, include_symbols, append, Modified: lldb/trunk/source/Core/Disassembler.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Core/Disassembler.cpp (original) +++ lldb/trunk/source/Core/Disassembler.cpp Tue Oct 11 21:08:07 2011 @@ -24,6 +24,7 @@ #include "lldb/Core/RegularExpression.h" #include "lldb/Core/Timer.h" #include "lldb/Interpreter/NamedOptionValue.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -166,7 +167,8 @@ const bool include_symbols = true; if (module) { - module->FindFunctions (name, + module->FindFunctions (name, + NULL, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Tue Oct 11 21:08:07 2011 @@ -350,7 +350,7 @@ uint32_t -Module::FindGlobalVariables(const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) +Module::FindGlobalVariables(const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) { SymbolVendor *symbols = GetSymbolVendor (); if (symbols) @@ -389,7 +389,8 @@ } uint32_t -Module::FindFunctions (const ConstString &name, +Module::FindFunctions (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool include_symbols, bool append, @@ -509,7 +510,7 @@ } uint32_t -Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) +Module::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) { uint32_t retval = FindTypes_Impl(sc, name, append, max_matches, types); @@ -686,7 +687,7 @@ } size_t -Module::FindSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, SymbolContextList &sc_list) +Module::FindSymbolsWithNameAndType (const ConstString &name, const ClangNamespaceDecl *namespace_decl, SymbolType symbol_type, SymbolContextList &sc_list) { // No need to protect this call using m_mutex all other method calls are // already thread safe. Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Tue Oct 11 21:08:07 2011 @@ -16,6 +16,7 @@ #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Host/Symbols.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/VariableList.h" @@ -186,7 +187,7 @@ collection::const_iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindFunctions (name, name_type_mask, include_symbols, true, sc_list); + (*pos)->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list); } return sc_list.GetSize(); @@ -221,7 +222,7 @@ collection::iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) { - (*pos)->FindGlobalVariables (name, append, max_matches, variable_list); + (*pos)->FindGlobalVariables (name, NULL, append, max_matches, variable_list); } return variable_list.GetSize() - initial_size; } @@ -253,7 +254,7 @@ sc_list.Clear(); collection::iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) - (*pos)->FindSymbolsWithNameAndType (name, symbol_type, sc_list); + (*pos)->FindSymbolsWithNameAndType (name, NULL, symbol_type, sc_list); return sc_list.GetSize(); } @@ -423,7 +424,7 @@ for (pos = m_modules.begin(); pos != end; ++pos) { if (sc.module_sp.get() == NULL || sc.module_sp.get() == (*pos).get()) - total_matches += (*pos)->FindTypes (sc, name, true, max_matches, types); + total_matches += (*pos)->FindTypes (sc, name, NULL, true, max_matches, types); if (total_matches >= max_matches) break; Modified: lldb/trunk/source/Core/SourceManager.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Core/SourceManager.cpp (original) +++ lldb/trunk/source/Core/SourceManager.cpp Tue Oct 11 21:08:07 2011 @@ -16,6 +16,7 @@ #include "lldb/Core/DataBuffer.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Stream.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" @@ -244,7 +245,7 @@ ConstString main_name("main"); bool symbols_okay = false; // Force it to be a debug symbol. bool append = false; - num_matches = executable_ptr->FindFunctions (main_name, lldb::eFunctionNameTypeBase, symbols_okay, append, sc_list); + num_matches = executable_ptr->FindFunctions (main_name, NULL, lldb::eFunctionNameTypeBase, symbols_okay, append, sc_list); for (uint32_t idx = 0; idx < num_matches; idx++) { SymbolContext sc; Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Tue Oct 11 21:08:07 2011 @@ -626,7 +626,7 @@ ) { if (sym_ctx.module_sp) - sym_ctx.module_sp->FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list); + sym_ctx.module_sp->FindSymbolsWithNameAndType(name, NULL, eSymbolTypeCode, sc_list); if (!sc_list.GetSize()) sym_ctx.target_sp->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list); 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=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Tue Oct 11 21:08:07 2011 @@ -22,6 +22,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/Core/Timer.h" #include "lldb/Core/UUID.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/ObjectFile.h" @@ -1695,7 +1696,7 @@ SymbolContextList contexts; SymbolContext context; - if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts)) + if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), NULL, eSymbolTypeCode, contexts)) return m_entry_point_address; contexts.GetContextAtIndex(0, context); Modified: lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/OperatingSystem/Darwin-Kernel/OperatingSystemDarwinKernel.cpp Tue Oct 11 21:08:07 2011 @@ -19,6 +19,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Core/ValueObjectVariable.h" +#include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/Process.h" @@ -131,7 +132,8 @@ Module *exe_module = m_process->GetTarget().GetExecutableModulePointer(); if (exe_module) { - if (exe_module->FindGlobalVariables (g_thread_list_name, + if (exe_module->FindGlobalVariables (g_thread_list_name, + NULL, append, max_matches, variable_list)) Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=141766&r1=141765&r2=141766&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Tue Oct 11 21:08:07 2011 @@ -479,7 +479,7 @@ } if (module_sp) - module_sp->FindFunctions (name, name_type_mask, include_symbols, true, sc_list); + module_sp->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list); if (target_sp) { @@ -495,7 +495,7 @@ { ModuleSP iter_module_sp = modules.GetModuleAtIndex(i); if (module_sp != iter_module_sp) - iter_module_sp->FindFunctions (name, name_type_mask, include_symbols, true, sc_list); + iter_module_sp->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list); } } } @@ -516,7 +516,7 @@ TypeList types; - if (module_sp && module_sp->FindTypes (*this, name, false, 1, types)) + if (module_sp && module_sp->FindTypes (*this, name, NULL, false, 1, types)) return types.GetTypeAtIndex(0); SymbolContext sc_for_global_search; From scallanan at apple.com Wed Oct 12 11:59:31 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 16:59:31 -0000 Subject: [Lldb-commits] [lldb] r141783 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h lldb.xcodeproj/project.pbxproj lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111012165931.64BD9312800A@llvm.org> Author: spyffe Date: Wed Oct 12 11:59:31 2011 New Revision: 141783 URL: http://llvm.org/viewvc/llvm-project?rev=141783&view=rev Log: Made FindGlobalVariable() optionally search a specific module and namespace. Also made it use FindGlobalVariables() instead of the more heavyweight GetVariablesForVariableExpressionPath(). Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141783&r1=141782&r2=141783&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Wed Oct 12 11:59:31 2011 @@ -840,8 +840,8 @@ /// @param[in] module /// If non-NULL, the module to query. /// - /// @param[in] decl - /// If non-NULL and module is non-NULL, the parent namespace. + /// @param[in] namespace_decl + /// If valid and module is non-NULL, the parent namespace. /// /// @param[in] name /// The name as a plain C string. The NameSearchContext contains @@ -906,9 +906,15 @@ /// @param[in] target /// The target to use as a basis for finding the variable. /// + /// @param[in] module + /// If non-NULL, the module to search. + /// /// @param[in] name /// The name as a plain C string. /// + /// @param[in] namespace_decl + /// If non-NULL and module is non-NULL, the parent namespace. + /// /// @param[in] type /// The required type for the variable. This function may be called /// during parsing, in which case we don't know its type; hence the @@ -919,7 +925,9 @@ //------------------------------------------------------------------ lldb::VariableSP FindGlobalVariable (Target &target, - const char *name, + lldb::ModuleSP &module, + const ConstString &name, + ClangNamespaceDecl *namespace_decl, TypeFromUser *type = NULL); //------------------------------------------------------------------ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=141783&r1=141782&r2=141783&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Oct 12 11:59:31 2011 @@ -550,7 +550,7 @@ 260C898110F57C5600BB2B04 /* ObjectContainerUniversalMachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectContainerUniversalMachO.h; sourceTree = ""; }; 260C898510F57C5600BB2B04 /* ObjectFileELF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileELF.cpp; sourceTree = ""; }; 260C898610F57C5600BB2B04 /* ObjectFileELF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileELF.h; sourceTree = ""; }; - 260C898810F57C5600BB2B04 /* ObjectFileMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileMachO.cpp; sourceTree = ""; }; + 260C898810F57C5600BB2B04 /* ObjectFileMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = ObjectFileMachO.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 260C898910F57C5600BB2B04 /* ObjectFileMachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileMachO.h; sourceTree = ""; }; 260C89B310F57C5600BB2B04 /* DWARFAbbreviationDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFAbbreviationDeclaration.cpp; sourceTree = ""; }; 260C89B410F57C5600BB2B04 /* DWARFAbbreviationDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFAbbreviationDeclaration.h; sourceTree = ""; }; @@ -666,7 +666,7 @@ 26217932133BCB850083B112 /* lldb-private-enumerations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "lldb-private-enumerations.h"; path = "include/lldb/lldb-private-enumerations.h"; sourceTree = ""; }; 2623096E13D0EFFB006381D9 /* StreamBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StreamBuffer.h; path = include/lldb/Core/StreamBuffer.h; sourceTree = ""; }; 2626B6AD143E1BEA00EF935C /* RangeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RangeMap.h; path = include/lldb/Core/RangeMap.h; sourceTree = ""; }; - 26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OperatingSystemDarwinKernel.cpp; sourceTree = ""; }; + 26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = OperatingSystemDarwinKernel.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 26274FA114030EEF006BA130 /* OperatingSystemDarwinKernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OperatingSystemDarwinKernel.h; sourceTree = ""; }; 26274FA514030F79006BA130 /* DynamicLoaderDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicLoaderDarwinKernel.cpp; sourceTree = ""; }; 26274FA614030F79006BA130 /* DynamicLoaderDarwinKernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLoaderDarwinKernel.h; sourceTree = ""; }; @@ -772,7 +772,7 @@ 2690B3701381D5C300ECFBAE /* Memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Memory.cpp; path = source/Target/Memory.cpp; sourceTree = ""; }; 2692BA13136610C100F9E14D /* UnwindAssemblyInstEmulation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnwindAssemblyInstEmulation.cpp; sourceTree = ""; }; 2692BA14136610C100F9E14D /* UnwindAssemblyInstEmulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnwindAssemblyInstEmulation.h; sourceTree = ""; }; - 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectTarget.cpp; path = source/Commands/CommandObjectTarget.cpp; sourceTree = ""; }; + 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = CommandObjectTarget.cpp; path = source/Commands/CommandObjectTarget.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 269416AE119A024800FF2715 /* CommandObjectTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectTarget.h; path = source/Commands/CommandObjectTarget.h; sourceTree = ""; }; 26954EBC1401EE8B00294D09 /* DynamicRegisterInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DynamicRegisterInfo.cpp; path = Utility/DynamicRegisterInfo.cpp; sourceTree = ""; }; 26954EBD1401EE8B00294D09 /* DynamicRegisterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DynamicRegisterInfo.h; path = Utility/DynamicRegisterInfo.h; sourceTree = ""; }; @@ -951,7 +951,7 @@ 26BC7E3010F1B84700F91463 /* CommandObjectDisassemble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectDisassemble.cpp; path = source/Commands/CommandObjectDisassemble.cpp; sourceTree = ""; }; 26BC7E3110F1B84700F91463 /* CommandObjectExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectExpression.cpp; path = source/Commands/CommandObjectExpression.cpp; sourceTree = ""; }; 26BC7E3310F1B84700F91463 /* CommandObjectHelp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectHelp.cpp; path = source/Commands/CommandObjectHelp.cpp; sourceTree = ""; }; - 26BC7E3610F1B84700F91463 /* CommandObjectMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectMemory.cpp; path = source/Commands/CommandObjectMemory.cpp; sourceTree = ""; }; + 26BC7E3610F1B84700F91463 /* CommandObjectMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = CommandObjectMemory.cpp; path = source/Commands/CommandObjectMemory.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 26BC7E3810F1B84700F91463 /* CommandObjectProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectProcess.cpp; path = source/Commands/CommandObjectProcess.cpp; sourceTree = ""; }; 26BC7E3910F1B84700F91463 /* CommandObjectQuit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectQuit.cpp; path = source/Commands/CommandObjectQuit.cpp; sourceTree = ""; }; 26BC7E3B10F1B84700F91463 /* CommandObjectRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRegister.cpp; path = source/Commands/CommandObjectRegister.cpp; sourceTree = ""; }; @@ -973,7 +973,7 @@ 26BC7E7310F1B85900F91463 /* DataBufferMemoryMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataBufferMemoryMap.cpp; path = source/Core/DataBufferMemoryMap.cpp; sourceTree = ""; }; 26BC7E7410F1B85900F91463 /* lldb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lldb.cpp; path = source/lldb.cpp; sourceTree = ""; }; 26BC7E7510F1B85900F91463 /* lldb-log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "lldb-log.cpp"; path = "source/lldb-log.cpp"; sourceTree = ""; }; - 26BC7E7610F1B85900F91463 /* Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disassembler.cpp; path = source/Core/Disassembler.cpp; sourceTree = ""; }; + 26BC7E7610F1B85900F91463 /* Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = Disassembler.cpp; path = source/Core/Disassembler.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 26BC7E7710F1B85900F91463 /* DynamicLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DynamicLoader.cpp; path = source/Core/DynamicLoader.cpp; sourceTree = ""; }; 26BC7E7810F1B85900F91463 /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Error.cpp; path = source/Core/Error.cpp; sourceTree = ""; }; 26BC7E7910F1B85900F91463 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Event.cpp; path = source/Core/Event.cpp; sourceTree = ""; }; @@ -984,13 +984,13 @@ 26BC7E8010F1B85900F91463 /* Mangled.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Mangled.cpp; path = source/Core/Mangled.cpp; sourceTree = ""; }; 26BC7E8110F1B85900F91463 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Module.cpp; path = source/Core/Module.cpp; sourceTree = ""; }; 26BC7E8210F1B85900F91463 /* ModuleChild.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleChild.cpp; path = source/Core/ModuleChild.cpp; sourceTree = ""; }; - 26BC7E8310F1B85900F91463 /* ModuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleList.cpp; path = source/Core/ModuleList.cpp; sourceTree = ""; }; + 26BC7E8310F1B85900F91463 /* ModuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = ModuleList.cpp; path = source/Core/ModuleList.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 26BC7E8610F1B85900F91463 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Options.cpp; path = source/Interpreter/Options.cpp; sourceTree = ""; }; 26BC7E8A10F1B85900F91463 /* PluginManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginManager.cpp; path = source/Core/PluginManager.cpp; sourceTree = ""; }; 26BC7E8C10F1B85900F91463 /* RegularExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegularExpression.cpp; path = source/Core/RegularExpression.cpp; sourceTree = ""; }; 26BC7E8D10F1B85900F91463 /* Scalar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Scalar.cpp; path = source/Core/Scalar.cpp; sourceTree = ""; }; 26BC7E8E10F1B85900F91463 /* Section.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Section.cpp; path = source/Core/Section.cpp; sourceTree = ""; }; - 26BC7E8F10F1B85900F91463 /* SourceManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourceManager.cpp; path = source/Core/SourceManager.cpp; sourceTree = ""; }; + 26BC7E8F10F1B85900F91463 /* SourceManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = SourceManager.cpp; path = source/Core/SourceManager.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 26BC7E9010F1B85900F91463 /* State.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = State.cpp; path = source/Core/State.cpp; sourceTree = ""; }; 26BC7E9110F1B85900F91463 /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stream.cpp; path = source/Core/Stream.cpp; sourceTree = ""; }; 26BC7E9210F1B85900F91463 /* StreamFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamFile.cpp; path = source/Core/StreamFile.cpp; sourceTree = ""; }; @@ -1072,7 +1072,7 @@ 26D0DD5210FE554D00271C65 /* BreakpointResolverName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverName.h; path = include/lldb/Breakpoint/BreakpointResolverName.h; sourceTree = ""; }; 26D0DD5310FE555900271C65 /* BreakpointResolverAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverAddress.cpp; path = source/Breakpoint/BreakpointResolverAddress.cpp; sourceTree = ""; }; 26D0DD5410FE555900271C65 /* BreakpointResolverFileLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverFileLine.cpp; path = source/Breakpoint/BreakpointResolverFileLine.cpp; sourceTree = ""; }; - 26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = ""; }; + 26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ELFHeader.cpp; sourceTree = ""; }; 26D27C9E11ED3A4E0024D721 /* ELFHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFHeader.h; sourceTree = ""; }; 26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupArchitecture.cpp; path = source/Interpreter/OptionGroupArchitecture.cpp; sourceTree = ""; }; @@ -1185,7 +1185,7 @@ 49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTType.cpp; path = source/Symbol/ClangASTType.cpp; sourceTree = ""; }; 49EC3E98118F90AC00B1265E /* ThreadPlanCallFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanCallFunction.cpp; path = source/Target/ThreadPlanCallFunction.cpp; sourceTree = ""; }; 49EC3E9C118F90D400B1265E /* ThreadPlanCallFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanCallFunction.h; path = include/lldb/Target/ThreadPlanCallFunction.h; sourceTree = ""; }; - 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangExpressionDeclMap.cpp; path = source/Expression/ClangExpressionDeclMap.cpp; sourceTree = ""; }; + 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = ClangExpressionDeclMap.cpp; path = source/Expression/ClangExpressionDeclMap.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangExpressionDeclMap.h; path = include/lldb/Expression/ClangExpressionDeclMap.h; sourceTree = ""; }; 4C00986F11500B4300F316B0 /* UnixSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnixSignals.h; path = include/lldb/Target/UnixSignals.h; sourceTree = ""; }; 4C00987011500B4300F316B0 /* UnixSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnixSignals.cpp; path = source/Target/UnixSignals.cpp; sourceTree = ""; }; @@ -1341,7 +1341,7 @@ 9AC7033F11752C590086C050 /* AddressResolverName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressResolverName.h; path = include/lldb/Core/AddressResolverName.h; sourceTree = ""; }; 9AC7034011752C6B0086C050 /* AddressResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressResolver.cpp; path = source/Core/AddressResolver.cpp; sourceTree = ""; }; 9AC7034211752C720086C050 /* AddressResolverFileLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressResolverFileLine.cpp; path = source/Core/AddressResolverFileLine.cpp; sourceTree = ""; }; - 9AC7034411752C790086C050 /* AddressResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressResolverName.cpp; path = source/Core/AddressResolverName.cpp; sourceTree = ""; }; + 9AC7034411752C790086C050 /* AddressResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = AddressResolverName.cpp; path = source/Core/AddressResolverName.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 9AC7038D117674EB0086C050 /* SBInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBInstruction.h; path = include/lldb/API/SBInstruction.h; sourceTree = ""; }; 9AC7038F117675270086C050 /* SBInstructionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBInstructionList.h; path = include/lldb/API/SBInstructionList.h; sourceTree = ""; }; 9AC703AE117675410086C050 /* SBInstruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBInstruction.cpp; path = source/API/SBInstruction.cpp; sourceTree = ""; }; @@ -3597,7 +3597,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_BUILD_DIR_ARCH = ""; - LLVM_CONFIGURATION = Release; + LLVM_CONFIGURATION = "Debug+Asserts"; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( @@ -3632,7 +3632,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_BUILD_DIR_ARCH = ""; - LLVM_CONFIGURATION = Release; + LLVM_CONFIGURATION = "Debug+Asserts"; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; OTHER_CFLAGS = ( "-flimit-debug-info", @@ -3923,7 +3923,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; LLVM_BUILD_DIR = "$(OBJROOT)/llvm"; LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/"; - LLVM_CONFIGURATION = Release; + LLVM_CONFIGURATION = "Debug+Asserts"; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; OTHER_CFLAGS = ( "-flimit-debug-info", Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=141783&r1=141782&r2=141783&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Wed Oct 12 11:59:31 2011 @@ -83,7 +83,7 @@ FindGlobalVariables (name, namespace_decl, true, -1, vars); + else + target.GetImages().FindGlobalVariables(name, true, -1, vars); if (vars.GetSize()) { @@ -2107,7 +2109,7 @@ ClangNamespaceDecl namespace_decl; if (log) - log->Printf(" Searching without a namespace"); + log->Printf(" Searching the root namespace"); FindExternalVisibleDecls(context, lldb::ModuleSP(), @@ -2341,8 +2343,10 @@ } else if (target) { - var = FindGlobalVariable (*target, - name_unique_cstr, + var = FindGlobalVariable (*target, + module, + name, + &namespace_decl, NULL); if (var) From scallanan at apple.com Wed Oct 12 12:08:23 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 17:08:23 -0000 Subject: [Lldb-commits] [lldb] r141784 - in /lldb/trunk/lldb.xcodeproj: project.pbxproj xcshareddata/xcschemes/lldb-tool.xcscheme Message-ID: <20111012170823.1A3862A6C12C@llvm.org> Author: spyffe Date: Wed Oct 12 12:08:22 2011 New Revision: 141784 URL: http://llvm.org/viewvc/llvm-project?rev=141784&view=rev Log: Oops, committed my local build settings. Fixed that. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=141784&r1=141783&r2=141784&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Oct 12 12:08:22 2011 @@ -550,7 +550,7 @@ 260C898110F57C5600BB2B04 /* ObjectContainerUniversalMachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectContainerUniversalMachO.h; sourceTree = ""; }; 260C898510F57C5600BB2B04 /* ObjectFileELF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileELF.cpp; sourceTree = ""; }; 260C898610F57C5600BB2B04 /* ObjectFileELF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileELF.h; sourceTree = ""; }; - 260C898810F57C5600BB2B04 /* ObjectFileMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = ObjectFileMachO.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 260C898810F57C5600BB2B04 /* ObjectFileMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObjectFileMachO.cpp; sourceTree = ""; }; 260C898910F57C5600BB2B04 /* ObjectFileMachO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectFileMachO.h; sourceTree = ""; }; 260C89B310F57C5600BB2B04 /* DWARFAbbreviationDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFAbbreviationDeclaration.cpp; sourceTree = ""; }; 260C89B410F57C5600BB2B04 /* DWARFAbbreviationDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFAbbreviationDeclaration.h; sourceTree = ""; }; @@ -666,7 +666,7 @@ 26217932133BCB850083B112 /* lldb-private-enumerations.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "lldb-private-enumerations.h"; path = "include/lldb/lldb-private-enumerations.h"; sourceTree = ""; }; 2623096E13D0EFFB006381D9 /* StreamBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = StreamBuffer.h; path = include/lldb/Core/StreamBuffer.h; sourceTree = ""; }; 2626B6AD143E1BEA00EF935C /* RangeMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RangeMap.h; path = include/lldb/Core/RangeMap.h; sourceTree = ""; }; - 26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = OperatingSystemDarwinKernel.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26274FA014030EEF006BA130 /* OperatingSystemDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OperatingSystemDarwinKernel.cpp; sourceTree = ""; }; 26274FA114030EEF006BA130 /* OperatingSystemDarwinKernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OperatingSystemDarwinKernel.h; sourceTree = ""; }; 26274FA514030F79006BA130 /* DynamicLoaderDarwinKernel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicLoaderDarwinKernel.cpp; sourceTree = ""; }; 26274FA614030F79006BA130 /* DynamicLoaderDarwinKernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicLoaderDarwinKernel.h; sourceTree = ""; }; @@ -772,7 +772,7 @@ 2690B3701381D5C300ECFBAE /* Memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Memory.cpp; path = source/Target/Memory.cpp; sourceTree = ""; }; 2692BA13136610C100F9E14D /* UnwindAssemblyInstEmulation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UnwindAssemblyInstEmulation.cpp; sourceTree = ""; }; 2692BA14136610C100F9E14D /* UnwindAssemblyInstEmulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnwindAssemblyInstEmulation.h; sourceTree = ""; }; - 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = CommandObjectTarget.cpp; path = source/Commands/CommandObjectTarget.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 269416AD119A024800FF2715 /* CommandObjectTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectTarget.cpp; path = source/Commands/CommandObjectTarget.cpp; sourceTree = ""; }; 269416AE119A024800FF2715 /* CommandObjectTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectTarget.h; path = source/Commands/CommandObjectTarget.h; sourceTree = ""; }; 26954EBC1401EE8B00294D09 /* DynamicRegisterInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DynamicRegisterInfo.cpp; path = Utility/DynamicRegisterInfo.cpp; sourceTree = ""; }; 26954EBD1401EE8B00294D09 /* DynamicRegisterInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DynamicRegisterInfo.h; path = Utility/DynamicRegisterInfo.h; sourceTree = ""; }; @@ -951,7 +951,7 @@ 26BC7E3010F1B84700F91463 /* CommandObjectDisassemble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectDisassemble.cpp; path = source/Commands/CommandObjectDisassemble.cpp; sourceTree = ""; }; 26BC7E3110F1B84700F91463 /* CommandObjectExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectExpression.cpp; path = source/Commands/CommandObjectExpression.cpp; sourceTree = ""; }; 26BC7E3310F1B84700F91463 /* CommandObjectHelp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectHelp.cpp; path = source/Commands/CommandObjectHelp.cpp; sourceTree = ""; }; - 26BC7E3610F1B84700F91463 /* CommandObjectMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = CommandObjectMemory.cpp; path = source/Commands/CommandObjectMemory.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26BC7E3610F1B84700F91463 /* CommandObjectMemory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectMemory.cpp; path = source/Commands/CommandObjectMemory.cpp; sourceTree = ""; }; 26BC7E3810F1B84700F91463 /* CommandObjectProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectProcess.cpp; path = source/Commands/CommandObjectProcess.cpp; sourceTree = ""; }; 26BC7E3910F1B84700F91463 /* CommandObjectQuit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectQuit.cpp; path = source/Commands/CommandObjectQuit.cpp; sourceTree = ""; }; 26BC7E3B10F1B84700F91463 /* CommandObjectRegister.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectRegister.cpp; path = source/Commands/CommandObjectRegister.cpp; sourceTree = ""; }; @@ -973,7 +973,7 @@ 26BC7E7310F1B85900F91463 /* DataBufferMemoryMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DataBufferMemoryMap.cpp; path = source/Core/DataBufferMemoryMap.cpp; sourceTree = ""; }; 26BC7E7410F1B85900F91463 /* lldb.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lldb.cpp; path = source/lldb.cpp; sourceTree = ""; }; 26BC7E7510F1B85900F91463 /* lldb-log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "lldb-log.cpp"; path = "source/lldb-log.cpp"; sourceTree = ""; }; - 26BC7E7610F1B85900F91463 /* Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = Disassembler.cpp; path = source/Core/Disassembler.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26BC7E7610F1B85900F91463 /* Disassembler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Disassembler.cpp; path = source/Core/Disassembler.cpp; sourceTree = ""; }; 26BC7E7710F1B85900F91463 /* DynamicLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DynamicLoader.cpp; path = source/Core/DynamicLoader.cpp; sourceTree = ""; }; 26BC7E7810F1B85900F91463 /* Error.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Error.cpp; path = source/Core/Error.cpp; sourceTree = ""; }; 26BC7E7910F1B85900F91463 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Event.cpp; path = source/Core/Event.cpp; sourceTree = ""; }; @@ -984,13 +984,13 @@ 26BC7E8010F1B85900F91463 /* Mangled.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Mangled.cpp; path = source/Core/Mangled.cpp; sourceTree = ""; }; 26BC7E8110F1B85900F91463 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Module.cpp; path = source/Core/Module.cpp; sourceTree = ""; }; 26BC7E8210F1B85900F91463 /* ModuleChild.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleChild.cpp; path = source/Core/ModuleChild.cpp; sourceTree = ""; }; - 26BC7E8310F1B85900F91463 /* ModuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = ModuleList.cpp; path = source/Core/ModuleList.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26BC7E8310F1B85900F91463 /* ModuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleList.cpp; path = source/Core/ModuleList.cpp; sourceTree = ""; }; 26BC7E8610F1B85900F91463 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Options.cpp; path = source/Interpreter/Options.cpp; sourceTree = ""; }; 26BC7E8A10F1B85900F91463 /* PluginManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginManager.cpp; path = source/Core/PluginManager.cpp; sourceTree = ""; }; 26BC7E8C10F1B85900F91463 /* RegularExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegularExpression.cpp; path = source/Core/RegularExpression.cpp; sourceTree = ""; }; 26BC7E8D10F1B85900F91463 /* Scalar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Scalar.cpp; path = source/Core/Scalar.cpp; sourceTree = ""; }; 26BC7E8E10F1B85900F91463 /* Section.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Section.cpp; path = source/Core/Section.cpp; sourceTree = ""; }; - 26BC7E8F10F1B85900F91463 /* SourceManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = SourceManager.cpp; path = source/Core/SourceManager.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26BC7E8F10F1B85900F91463 /* SourceManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourceManager.cpp; path = source/Core/SourceManager.cpp; sourceTree = ""; }; 26BC7E9010F1B85900F91463 /* State.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = State.cpp; path = source/Core/State.cpp; sourceTree = ""; }; 26BC7E9110F1B85900F91463 /* Stream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stream.cpp; path = source/Core/Stream.cpp; sourceTree = ""; }; 26BC7E9210F1B85900F91463 /* StreamFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StreamFile.cpp; path = source/Core/StreamFile.cpp; sourceTree = ""; }; @@ -1072,7 +1072,7 @@ 26D0DD5210FE554D00271C65 /* BreakpointResolverName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverName.h; path = include/lldb/Breakpoint/BreakpointResolverName.h; sourceTree = ""; }; 26D0DD5310FE555900271C65 /* BreakpointResolverAddress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverAddress.cpp; path = source/Breakpoint/BreakpointResolverAddress.cpp; sourceTree = ""; }; 26D0DD5410FE555900271C65 /* BreakpointResolverFileLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverFileLine.cpp; path = source/Breakpoint/BreakpointResolverFileLine.cpp; sourceTree = ""; }; - 26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 26D0DD5510FE555900271C65 /* BreakpointResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BreakpointResolverName.cpp; path = source/Breakpoint/BreakpointResolverName.cpp; sourceTree = ""; }; 26D27C9D11ED3A4E0024D721 /* ELFHeader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ELFHeader.cpp; sourceTree = ""; }; 26D27C9E11ED3A4E0024D721 /* ELFHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELFHeader.h; sourceTree = ""; }; 26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupArchitecture.cpp; path = source/Interpreter/OptionGroupArchitecture.cpp; sourceTree = ""; }; @@ -1185,7 +1185,7 @@ 49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTType.cpp; path = source/Symbol/ClangASTType.cpp; sourceTree = ""; }; 49EC3E98118F90AC00B1265E /* ThreadPlanCallFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanCallFunction.cpp; path = source/Target/ThreadPlanCallFunction.cpp; sourceTree = ""; }; 49EC3E9C118F90D400B1265E /* ThreadPlanCallFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanCallFunction.h; path = include/lldb/Target/ThreadPlanCallFunction.h; sourceTree = ""; }; - 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = ClangExpressionDeclMap.cpp; path = source/Expression/ClangExpressionDeclMap.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangExpressionDeclMap.cpp; path = source/Expression/ClangExpressionDeclMap.cpp; sourceTree = ""; }; 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangExpressionDeclMap.h; path = include/lldb/Expression/ClangExpressionDeclMap.h; sourceTree = ""; }; 4C00986F11500B4300F316B0 /* UnixSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnixSignals.h; path = include/lldb/Target/UnixSignals.h; sourceTree = ""; }; 4C00987011500B4300F316B0 /* UnixSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnixSignals.cpp; path = source/Target/UnixSignals.cpp; sourceTree = ""; }; @@ -1341,7 +1341,7 @@ 9AC7033F11752C590086C050 /* AddressResolverName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressResolverName.h; path = include/lldb/Core/AddressResolverName.h; sourceTree = ""; }; 9AC7034011752C6B0086C050 /* AddressResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressResolver.cpp; path = source/Core/AddressResolver.cpp; sourceTree = ""; }; 9AC7034211752C720086C050 /* AddressResolverFileLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressResolverFileLine.cpp; path = source/Core/AddressResolverFileLine.cpp; sourceTree = ""; }; - 9AC7034411752C790086C050 /* AddressResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = AddressResolverName.cpp; path = source/Core/AddressResolverName.cpp; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; + 9AC7034411752C790086C050 /* AddressResolverName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressResolverName.cpp; path = source/Core/AddressResolverName.cpp; sourceTree = ""; }; 9AC7038D117674EB0086C050 /* SBInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBInstruction.h; path = include/lldb/API/SBInstruction.h; sourceTree = ""; }; 9AC7038F117675270086C050 /* SBInstructionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBInstructionList.h; path = include/lldb/API/SBInstructionList.h; sourceTree = ""; }; 9AC703AE117675410086C050 /* SBInstruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBInstruction.cpp; path = source/API/SBInstruction.cpp; sourceTree = ""; }; @@ -3597,7 +3597,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_BUILD_DIR_ARCH = ""; - LLVM_CONFIGURATION = "Debug+Asserts"; + LLVM_CONFIGURATION = Release; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; ONLY_ACTIVE_ARCH = YES; OTHER_CFLAGS = ( @@ -3632,7 +3632,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; LLVM_BUILD_DIR = "$(SRCROOT)/llvm"; LLVM_BUILD_DIR_ARCH = ""; - LLVM_CONFIGURATION = "Debug+Asserts"; + LLVM_CONFIGURATION = Release; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; OTHER_CFLAGS = ( "-flimit-debug-info", @@ -3923,7 +3923,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; LLVM_BUILD_DIR = "$(OBJROOT)/llvm"; LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/"; - LLVM_CONFIGURATION = "Debug+Asserts"; + LLVM_CONFIGURATION = Release; LLVM_SOURCE_DIR = "$(SRCROOT)/llvm"; OTHER_CFLAGS = ( "-flimit-debug-info", Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=141784&r1=141783&r2=141784&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Wed Oct 12 12:08:22 2011 @@ -83,7 +83,7 @@ Author: spyffe Date: Wed Oct 12 12:38:09 2011 New Revision: 141789 URL: http://llvm.org/viewvc/llvm-project?rev=141789&view=rev Log: Changed FindExternalVisibleDecls() to use the module level FindFunctions() where appropriate and not use SymbolContext::FindFunctionsByName(). Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141789&r1=141788&r2=141789&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 12:38:09 2011 @@ -2360,12 +2360,25 @@ { const bool include_symbols = true; const bool append = false; - m_parser_vars->m_sym_ctx.FindFunctionsByName (name, - eFunctionNameTypeBase, - include_symbols, - append, - sc_list); - + + if (namespace_decl && module) + { + module->FindFunctions(name, + &namespace_decl, + eFunctionNameTypeBase, + include_symbols, + append, + sc_list); + } + else + { + target->GetImages().FindFunctions(name, + eFunctionNameTypeBase, + include_symbols, + append, + sc_list); + } + if (sc_list.GetSize()) { bool found_specific = false; From johnny.chen at apple.com Wed Oct 12 12:50:41 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 17:50:41 -0000 Subject: [Lldb-commits] [lldb] r141790 - /lldb/trunk/test/functionalities/command_python/TestCommandPython.py Message-ID: <20111012175041.5F9912A6C12C@llvm.org> Author: johnny Date: Wed Oct 12 12:50:41 2011 New Revision: 141790 URL: http://llvm.org/viewvc/llvm-project?rev=141790&view=rev Log: Add cleanups for 'command script add' to TestCommandPython.py. Modified: lldb/trunk/test/functionalities/command_python/TestCommandPython.py Modified: lldb/trunk/test/functionalities/command_python/TestCommandPython.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_python/TestCommandPython.py?rev=141790&r1=141789&r2=141790&view=diff ============================================================================== --- lldb/trunk/test/functionalities/command_python/TestCommandPython.py (original) +++ lldb/trunk/test/functionalities/command_python/TestCommandPython.py Wed Oct 12 12:50:41 2011 @@ -27,6 +27,16 @@ self.runCmd("command source py_import") + # This is the function to remove the custom commands in order to have a + # clean slate for the next test case. + def cleanup(): + self.runCmd('command script delete welcome', check=False) + self.runCmd('command script delete targetname', check=False) + self.runCmd('command script delete longwait', check=False) + + # Execute the cleanup function during test case tear down. + self.addTearDownHook(cleanup) + # We don't want to display the stdout if not in TraceOn() mode. if not self.TraceOn(): self.HideStdout() From johnny.chen at apple.com Wed Oct 12 12:59:35 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 10:59:35 -0700 Subject: [Lldb-commits] [lldb] r141790 - /lldb/trunk/test/functionalities/command_python/TestCommandPython.py In-Reply-To: <20111012175041.5F9912A6C12C@llvm.org> References: <20111012175041.5F9912A6C12C@llvm.org> Message-ID: <05C3A852-1A33-4E53-85F9-468C9063107B@apple.com> Patch by Enrico. On Oct 12, 2011, at 10:50 AM, Johnny Chen wrote: > Author: johnny > Date: Wed Oct 12 12:50:41 2011 > New Revision: 141790 > > URL: http://llvm.org/viewvc/llvm-project?rev=141790&view=rev > Log: > Add cleanups for 'command script add' to TestCommandPython.py. > > Modified: > lldb/trunk/test/functionalities/command_python/TestCommandPython.py > > Modified: lldb/trunk/test/functionalities/command_python/TestCommandPython.py > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_python/TestCommandPython.py?rev=141790&r1=141789&r2=141790&view=diff > ============================================================================== > --- lldb/trunk/test/functionalities/command_python/TestCommandPython.py (original) > +++ lldb/trunk/test/functionalities/command_python/TestCommandPython.py Wed Oct 12 12:50:41 2011 > @@ -27,6 +27,16 @@ > > self.runCmd("command source py_import") > > + # This is the function to remove the custom commands in order to have a > + # clean slate for the next test case. > + def cleanup(): > + self.runCmd('command script delete welcome', check=False) > + self.runCmd('command script delete targetname', check=False) > + self.runCmd('command script delete longwait', check=False) > + > + # Execute the cleanup function during test case tear down. > + self.addTearDownHook(cleanup) > + > # We don't want to display the stdout if not in TraceOn() mode. > if not self.TraceOn(): > self.HideStdout() > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From scallanan at apple.com Wed Oct 12 13:00:54 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 18:00:54 -0000 Subject: [Lldb-commits] [lldb] r141792 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111012180054.1A554312800A@llvm.org> Author: spyffe Date: Wed Oct 12 13:00:53 2011 New Revision: 141792 URL: http://llvm.org/viewvc/llvm-project?rev=141792&view=rev Log: Added support to ClagnExpressionDeclMap for finding data symbols in namespaces. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141792&r1=141791&r2=141792&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Wed Oct 12 13:00:53 2011 @@ -889,15 +889,23 @@ /// @param[in] target /// The target to use as the basis for the search. /// + /// @param[in] module + /// If non-NULL, the module to query. + /// /// @param[in] name /// The name as a plain C string. /// + /// @param[in] namespace_decl + /// If valid and module is non-NULL, the parent namespace. + /// /// @return /// The LLDB Symbol found, or NULL if none was found. //--------------------------------------------------------- Symbol * FindGlobalDataSymbol (Target &target, - const ConstString &name); + lldb::ModuleSP &module, + const ConstString &name, + ClangNamespaceDecl *namespace_decl); //------------------------------------------------------------------ /// Given a target, find a variable that matches the given name and Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141792&r1=141791&r2=141792&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 13:00:53 2011 @@ -1630,7 +1630,10 @@ TypeFromUser type(expr_var->GetTypeFromUser()); VariableSP var = FindVariableInScope (*frame, name, &type); - Symbol *sym = FindGlobalDataSymbol(*target, name); + + ModuleSP module; + + Symbol *sym = FindGlobalDataSymbol(*target, module, name, NULL); std::auto_ptr location_value; @@ -1977,14 +1980,22 @@ ClangExpressionDeclMap::FindGlobalDataSymbol ( Target &target, - const ConstString &name + ModuleSP &module, + const ConstString &name, + ClangNamespaceDecl *namespace_decl ) { SymbolContextList sc_list; - target.GetImages().FindSymbolsWithNameAndType(name, - eSymbolTypeData, - sc_list); + if (module && namespace_decl) + module->FindSymbolsWithNameAndType(name, + namespace_decl, + eSymbolTypeData, + sc_list); + else + target.GetImages().FindSymbolsWithNameAndType(name, + eSymbolTypeData, + sc_list); if (sc_list.GetSize()) { @@ -2430,7 +2441,17 @@ // We couldn't find a variable or function for this. Now we'll hunt for a generic // data symbol, and -- if it is found -- treat it as a variable. - Symbol *data_symbol = FindGlobalDataSymbol(*target, name); + Symbol *data_symbol; + + if (namespace_decl && module) + { + data_symbol = FindGlobalDataSymbol(*target, module, name, &namespace_decl); + } + else + { + ModuleSP module; + data_symbol = FindGlobalDataSymbol(*target, module, name, NULL); + } if (data_symbol) { From scallanan at apple.com Wed Oct 12 13:44:30 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 18:44:30 -0000 Subject: [Lldb-commits] [lldb] r141797 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111012184430.854F9312800A@llvm.org> Author: spyffe Date: Wed Oct 12 13:44:30 2011 New Revision: 141797 URL: http://llvm.org/viewvc/llvm-project?rev=141797&view=rev Log: Made the expression parser's type search call the proper namespace-aware APIs. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141797&r1=141796&r2=141797&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 13:44:30 2011 @@ -2131,7 +2131,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, - lldb::ModuleSP module, + lldb::ModuleSP module_sp, ClangNamespaceDecl &namespace_decl, const ConstString &name) { @@ -2355,7 +2355,7 @@ else if (target) { var = FindGlobalVariable (*target, - module, + module_sp, name, &namespace_decl, NULL); @@ -2372,14 +2372,14 @@ const bool include_symbols = true; const bool append = false; - if (namespace_decl && module) + if (namespace_decl && module_sp) { - module->FindFunctions(name, - &namespace_decl, - eFunctionNameTypeBase, - include_symbols, - append, - sc_list); + module_sp->FindFunctions(name, + &namespace_decl, + eFunctionNameTypeBase, + include_symbols, + append, + sc_list); } else { @@ -2441,17 +2441,7 @@ // We couldn't find a variable or function for this. Now we'll hunt for a generic // data symbol, and -- if it is found -- treat it as a variable. - Symbol *data_symbol; - - if (namespace_decl && module) - { - data_symbol = FindGlobalDataSymbol(*target, module, name, &namespace_decl); - } - else - { - ModuleSP module; - data_symbol = FindGlobalDataSymbol(*target, module, name, NULL); - } + Symbol *data_symbol = FindGlobalDataSymbol(*target, module_sp, name, &namespace_decl); if (data_symbol) { @@ -2510,20 +2500,28 @@ } } - lldb::TypeSP type_sp (m_parser_vars->m_sym_ctx.FindTypeByName (name)); - - if (type_sp) + TypeList types; + SymbolContext null_sc; + + if (module_sp && namespace_decl) + module_sp->FindTypes(null_sc, name, &namespace_decl, true, 1, types); + else + target->GetImages().FindTypes (null_sc, name, true, 1, types); + + if (types.GetSize()) { + TypeSP type_sp = types.GetTypeAtIndex(0); + if (log) { - log->Printf ("Matching type found for \"%s\": ", name.GetCString()); + log->Printf("Matching type found for \"%s\": ", name.GetCString()); StreamString strm; type_sp->Dump(&strm, true); log->PutCString (strm.GetData()); } - TypeFromUser user_type (type_sp->GetClangFullType(), - type_sp->GetClangAST()); + TypeFromUser user_type(type_sp->GetClangFullType(), + type_sp->GetClangAST()); AddOneType(context, user_type, false); } From johnny.chen at apple.com Wed Oct 12 14:16:06 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 19:16:06 -0000 Subject: [Lldb-commits] [lldb] r141799 - in /lldb/trunk/examples/customization: ./ pwd-cd-and-system/ pwd-cd-and-system/.lldbinit pwd-cd-and-system/README pwd-cd-and-system/utils.py Message-ID: <20111012191606.C7342312800A@llvm.org> Author: johnny Date: Wed Oct 12 14:16:06 2011 New Revision: 141799 URL: http://llvm.org/viewvc/llvm-project?rev=141799&view=rev Log: Add an examples/customization directory and add a subdirectory pwd-cd-and-system which contains the lldb init file and a utils.py Python module in order to add the 'pwd', 'cd', and 'system' lldb commands. Added: lldb/trunk/examples/customization/ lldb/trunk/examples/customization/pwd-cd-and-system/ lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit lldb/trunk/examples/customization/pwd-cd-and-system/README lldb/trunk/examples/customization/pwd-cd-and-system/utils.py Added: lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit?rev=141799&view=auto ============================================================================== --- lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit (added) +++ lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit Wed Oct 12 14:16:06 2011 @@ -0,0 +1,6 @@ +script import os, sys +script sys.path.append(os.path.expanduser('~')) +script import utils +command alias pwd script print os.getcwd() +command script add -f utils.chdir cd +command script add -f utils.system system Added: lldb/trunk/examples/customization/pwd-cd-and-system/README URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/pwd-cd-and-system/README?rev=141799&view=auto ============================================================================== --- lldb/trunk/examples/customization/pwd-cd-and-system/README (added) +++ lldb/trunk/examples/customization/pwd-cd-and-system/README Wed Oct 12 14:16:06 2011 @@ -0,0 +1,41 @@ +Files in this directory: + +o .lldbinit: + +An example lldb init file that imports the utils.py module and adds the +following commands: 'pwd', 'cd', and 'system'. + +o utils.py: + +Python module which provides implementation for the 'cd' and 'system' commands. + +o README: + +The file you are reading now. + +================================================================================ +The following terminal output shows an interaction with lldb using the .lldbinit +and the utils.py files which are located in my HOME directory. The lldb init +file imports the utils Python module and adds the 'pwd', 'cd', and 'system' +commands. + +Johnnys-MacBook-Pro:multiple_threads johnny$ pwd +/Volumes/data/lldb/svn/trunk/test/functionalities/watchpoint/multiple_threads +Johnnys-MacBook-Pro:multiple_threads johnny$ lldb +(lldb) pwd +/Volumes/data/lldb/svn/trunk/test/functionalities/watchpoint/multiple_threads +(lldb) cd .. +Current working directory: /Volumes/data/lldb/svn/trunk/test/functionalities/watchpoint +(lldb) help system + +Execute the command (a string) in a subshell. +Syntax: system +(lldb) system ls -l +total 0 +drwxr-xr-x 7 johnny admin 238 Oct 11 17:24 hello_watchlocation +drwxr-xr-x 7 johnny admin 238 Oct 11 17:24 hello_watchpoint +drwxr-xr-x 7 johnny admin 238 Oct 11 17:24 multiple_threads +drwxr-xr-x 7 johnny admin 238 Oct 11 17:24 watchpoint_commands + +retcode: 0 +(lldb) Added: lldb/trunk/examples/customization/pwd-cd-and-system/utils.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/pwd-cd-and-system/utils.py?rev=141799&view=auto ============================================================================== --- lldb/trunk/examples/customization/pwd-cd-and-system/utils.py (added) +++ lldb/trunk/examples/customization/pwd-cd-and-system/utils.py Wed Oct 12 14:16:06 2011 @@ -0,0 +1,27 @@ +"""Utility for changing directories and execution of commands in a subshell.""" + +import os, shlex, subprocess + +def chdir(debugger, args, result, dict): + """Change the working directory, or cd to ${HOME}.""" + dir = args.strip() + if dir: + os.chdir(args) + else: + os.chdir(os.path.expanduser('~')) + print "Current working directory: %s" % os.getcwd() + +def system(debugger, command_line, result, dict): + """Execute the command (a string) in a subshell.""" + args = shlex.split(command_line) + process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output, error = process.communicate() + retcode = process.poll() + if output and error: + print "stdout=>\n", output + print "stderr=>\n", error + elif output: + print output + elif error: + print error + print "retcode:", retcode From johnny.chen at apple.com Wed Oct 12 14:20:04 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 19:20:04 -0000 Subject: [Lldb-commits] [lldb] r141800 - /lldb/trunk/docs/lldb-for-gdb-users.txt Message-ID: <20111012192004.360232A6C12C@llvm.org> Author: johnny Date: Wed Oct 12 14:20:04 2011 New Revision: 141800 URL: http://llvm.org/viewvc/llvm-project?rev=141800&view=rev Log: Add reference to ToT/examples/customization for more customization examples. Modified: lldb/trunk/docs/lldb-for-gdb-users.txt Modified: lldb/trunk/docs/lldb-for-gdb-users.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-for-gdb-users.txt?rev=141800&r1=141799&r2=141800&view=diff ============================================================================== --- lldb/trunk/docs/lldb-for-gdb-users.txt (original) +++ lldb/trunk/docs/lldb-for-gdb-users.txt Wed Oct 12 14:20:04 2011 @@ -432,7 +432,7 @@ (lldb) expr self = $0 $4 = (SKTGraphicView *) 0x0000000100135430 -f) Miscellaneous: +f) Customization: You can use the embedded Python interprter to add the following 'pwd' and 'cd' commands for your lldb session: @@ -483,3 +483,6 @@ (lldb) pwd /private/tmp (lldb) + +For more examples of customization, look under the ToT/examples/customization +directory. From scallanan at apple.com Wed Oct 12 15:29:25 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 20:29:25 -0000 Subject: [Lldb-commits] [lldb] r141808 - in /lldb/trunk: include/lldb/Expression/ClangASTSource.h source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111012202925.EF13C2A6C12C@llvm.org> Author: spyffe Date: Wed Oct 12 15:29:25 2011 New Revision: 141808 URL: http://llvm.org/viewvc/llvm-project?rev=141808&view=rev Log: Refactoring in preparation for having multiple calls to the FindExternalVisibleDecls function. FindExternalVisibleDecls was recording whether it had found generic function symbols in variables that were local to the function. Now, however, multiple calls occur in response to one request from Clang, since we may be searching across namespaces. To support that, I moved the local variables into a bitfield in NameSearchContext. Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=141808&r1=141807&r2=141808&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original) +++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Wed Oct 12 15:29:25 2011 @@ -185,6 +185,12 @@ const clang::DeclarationName &m_decl_name; ///< The name being looked for const clang::DeclContext *m_decl_context; ///< The DeclContext to put declarations into + struct { + bool variable : 1; + bool function_with_type_info : 1; + bool function : 1; + } m_found; + //------------------------------------------------------------------ /// Constructor /// Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141808&r1=141807&r2=141808&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 15:29:25 2011 @@ -2335,7 +2335,6 @@ ValueObjectSP valobj; VariableSP var; Error err; - bool found = false; if (frame && !namespace_decl) { @@ -2349,7 +2348,7 @@ if (err.Success() && var != NULL) { AddOneVariable(context, var); - found = true; + context.m_found.variable = true; } } else if (target) @@ -2363,11 +2362,11 @@ if (var) { AddOneVariable(context, var); - found = true; + context.m_found.variable = true; } } - if (!found) + if (!context.m_found.variable) { const bool include_symbols = true; const bool append = false; @@ -2392,7 +2391,6 @@ if (sc_list.GetSize()) { - bool found_specific = false; Symbol *generic_symbol = NULL; Symbol *non_extern_symbol = NULL; @@ -2407,10 +2405,10 @@ { // TODO only do this if it's a C function; C++ functions may be // overloaded - if (!found_specific) + if (!context.m_found.function_with_type_info) AddOneFunction(context, sym_ctx.function, NULL); - found_specific = true; - found = true; + context.m_found.function_with_type_info = true; + context.m_found.function = true; } else if (sym_ctx.symbol) { @@ -2421,24 +2419,24 @@ } } - if (!found_specific) + if (!context.m_found.function_with_type_info) { if (generic_symbol) { AddOneFunction (context, NULL, generic_symbol); - found = true; + context.m_found.function = true; } else if (non_extern_symbol) { AddOneFunction (context, NULL, non_extern_symbol); - found = true; + context.m_found.function = true; } } } - if (!found) + if (!context.m_found.variable) { - // We couldn't find a variable or function for this. Now we'll hunt for a generic + // We couldn't find a non-symbol variable for this. Now we'll hunt for a generic // data symbol, and -- if it is found -- treat it as a variable. Symbol *data_symbol = FindGlobalDataSymbol(*target, module_sp, name, &namespace_decl); @@ -2446,7 +2444,7 @@ if (data_symbol) { AddOneGenericVariable(context, *data_symbol); - found = true; + context.m_found.variable = true; } } } From johnny.chen at apple.com Wed Oct 12 15:47:04 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 20:47:04 -0000 Subject: [Lldb-commits] [lldb] r141810 - in /lldb/trunk/examples/customization/import-python: ./ README importcmd.py Message-ID: <20111012204704.34A2B2A6C12C@llvm.org> Author: johnny Date: Wed Oct 12 15:47:04 2011 New Revision: 141810 URL: http://llvm.org/viewvc/llvm-project?rev=141810&view=rev Log: Patch by Enrico to provide an example of 'import' commnad for importing .py/.pyc files. Added: lldb/trunk/examples/customization/import-python/ lldb/trunk/examples/customization/import-python/README lldb/trunk/examples/customization/import-python/importcmd.py Added: lldb/trunk/examples/customization/import-python/README URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/import-python/README?rev=141810&view=auto ============================================================================== --- lldb/trunk/examples/customization/import-python/README (added) +++ lldb/trunk/examples/customization/import-python/README Wed Oct 12 15:47:04 2011 @@ -0,0 +1,31 @@ +Files in this directory: + +o importcmd.py: + +Python module which provides implementation for the 'import' command. + +o README: + +The file you are reading now. + +================================================================================ +The import command defined by importcmd.py can be used in LLDB to load a Python +module given its full pathname. +The command works by extending Python's sys.path lookup to include the path to +the module to be imported when required, and then going through the language +ordinary 'import' mechanism. In this respect, modules imported from LLDB command +line should not be distinguishable from those imported using the script interpreter. +The following terminal output shows an interaction with lldb using this new command. + +Enrico-Granatas-MacBook-Pro:Debug enricogranata$ ./lldb +(lldb) script import importcmd +(lldb) command script add import -f importcmd.pyimport_cmd +(lldb) import ../demo.py +(lldb) script demo.test_function('hello world') +I am a Python function that says hello world +(lldb) quit +Enrico-Granatas-MacBook-Pro:Debug enricogranata$ + +Of course, the commands to import the importcmd.py module and to define the import +command, can be included in the .lldbinit file to make this feature available at +debugger startup Added: lldb/trunk/examples/customization/import-python/importcmd.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/import-python/importcmd.py?rev=141810&view=auto ============================================================================== --- lldb/trunk/examples/customization/import-python/importcmd.py (added) +++ lldb/trunk/examples/customization/import-python/importcmd.py Wed Oct 12 15:47:04 2011 @@ -0,0 +1,30 @@ +import sys,os,lldb +def check_has_dir_in_path(dirname): + return sys.path.__contains__(dirname); + +def ensure_has_dir_in_path(dirname): + dirname = os.path.abspath(dirname) + if not (check_has_dir_in_path(dirname)): + sys.path.append(dirname); + +def do_import(debugger,modname): + if (len(modname) > 4 and modname[-4:] == '.pyc'): + modname = modname[:-4] + if (len(modname) > 3 and modname[-3:] == '.py'): + modname = modname[:-3] + debugger.HandleCommand("script import " + modname) + +def pyimport_cmd(debugger, args, result, dict): + """Import a Python module given its full path""" + if args == "": + return "no module path given"; + if not (os.sep in args): + modname = args + ensure_has_dir_in_path('.') + else: + endofdir = args.rfind(os.sep) + modname = args[endofdir+1:] + args = args[0:endofdir] + ensure_has_dir_in_path(args) + do_import(debugger,modname) + return None From johnny.chen at apple.com Wed Oct 12 16:51:58 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 21:51:58 -0000 Subject: [Lldb-commits] [lldb] r141817 - /lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit Message-ID: <20111012215158.D9F452A6C12C@llvm.org> Author: johnny Date: Wed Oct 12 16:51:58 2011 New Revision: 141817 URL: http://llvm.org/viewvc/llvm-project?rev=141817&view=rev Log: Prepend '~' to the sys.path so that ~/utils.py takes precedence. Modified: lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit Modified: lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit?rev=141817&r1=141816&r2=141817&view=diff ============================================================================== --- lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit (original) +++ lldb/trunk/examples/customization/pwd-cd-and-system/.lldbinit Wed Oct 12 16:51:58 2011 @@ -1,5 +1,6 @@ script import os, sys -script sys.path.append(os.path.expanduser('~')) +# So that ~/utils.py takes precedence. +script sys.path[:0] = [os.path.expanduser('~')] script import utils command alias pwd script print os.getcwd() command script add -f utils.chdir cd From scallanan at apple.com Wed Oct 12 17:20:02 2011 From: scallanan at apple.com (Sean Callanan) Date: Wed, 12 Oct 2011 22:20:02 -0000 Subject: [Lldb-commits] [lldb] r141821 - in /lldb/trunk/source/Expression: ClangExpressionDeclMap.cpp ClangUserExpression.cpp Message-ID: <20111012222002.E93B32A6C12D@llvm.org> Author: spyffe Date: Wed Oct 12 17:20:02 2011 New Revision: 141821 URL: http://llvm.org/viewvc/llvm-project?rev=141821&view=rev Log: Extended the lifetime of Clang parser objects to the lifetime of ClangExpressionDeclMap. This allows ClangExpressionVariables found during parsing to be queried for their containing namespaces during expression execution. Other clients (like ClangFunction) explicitly delete this state, so they should not result in any memory leaks. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/ClangUserExpression.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141821&r1=141820&r2=141821&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 17:20:02 2011 @@ -61,6 +61,11 @@ ClangExpressionDeclMap::~ClangExpressionDeclMap() { + // Note: The model is now that the parser's AST context and all associated + // data does not vanish until the expression has been executed. This means + // that valuable lookup data (like namespaces) doesn't vanish, but + + DidParse(); DidDematerialize(); DisableStructVars(); } @@ -933,6 +938,9 @@ if (expr_var_sp) { + if (!expr_var_sp->m_parser_vars.get()) + return Value(); + const ConstString &name(expr_var_sp->GetName()); TypeFromUser type(expr_var_sp->GetTypeFromUser()); @@ -1621,7 +1629,7 @@ Process *process = exe_ctx.GetProcessPtr(); StackFrame *frame = exe_ctx.GetFramePtr(); - if (!frame || !process || !target) + if (!frame || !process || !target || !m_parser_vars.get() || !expr_var->m_parser_vars.get()) return false; // Vital information about the value Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=141821&r1=141820&r2=141821&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangUserExpression.cpp (original) +++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Oct 12 17:20:02 2011 @@ -276,9 +276,7 @@ log->Printf("Data buffer contents:\n%s", dump_string.GetString().c_str()); } - - m_expr_decl_map->DidParse(); - + if (jit_error.Success()) { if (process && m_jit_alloc != LLDB_INVALID_ADDRESS) @@ -449,6 +447,7 @@ error_stream.Printf ("Couldn't dematerialize struct : %s\n", expr_error.AsCString("unknown error")); return false; } + return true; } From johnny.chen at apple.com Wed Oct 12 17:22:09 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 22:22:09 -0000 Subject: [Lldb-commits] [lldb] r141823 - in /lldb/trunk/www: customization.html sidebar.incl Message-ID: <20111012222209.E9648312800A@llvm.org> Author: johnny Date: Wed Oct 12 17:22:09 2011 New Revision: 141823 URL: http://llvm.org/viewvc/llvm-project?rev=141823&view=rev Log: Add pointer to the examples/customization directory for examples of lldb customizations. Added: lldb/trunk/www/customization.html (with props) Modified: lldb/trunk/www/sidebar.incl Added: lldb/trunk/www/customization.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/customization.html?rev=141823&view=auto ============================================================================== --- lldb/trunk/www/customization.html (added) +++ lldb/trunk/www/customization.html Wed Oct 12 17:22:09 2011 @@ -0,0 +1,33 @@ + + + + + +LLDB Customization + + + +
    + The LLDB Debugger +
    + +
    +
    + + +
    +
    +

    LLDB Customization

    +
    +

    There is an examples/customization directory under LLDB top of tree, + where you can find examples of customizations for interacting with the + lldb interpreter.

    +

    We welcome you to submit new and interesting examples of customizations. +

    +
    + +
    +
    +
    + + Propchange: lldb/trunk/www/customization.html ------------------------------------------------------------------------------ svn:executable = * Modified: lldb/trunk/www/sidebar.incl URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/sidebar.incl?rev=141823&r1=141822&r2=141823&view=diff ============================================================================== --- lldb/trunk/www/sidebar.incl (original) +++ lldb/trunk/www/sidebar.incl Wed Oct 12 17:22:09 2011 @@ -15,6 +15,7 @@

    Use and Extension

    • Architecture
    • +
    • Customization
    • Documentation
    • FAQ
    • Frame and Thread Formatting
    • From johnny.chen at apple.com Wed Oct 12 17:25:14 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 12 Oct 2011 22:25:14 -0000 Subject: [Lldb-commits] [lldb] r141826 - /lldb/trunk/www/customization.html Message-ID: <20111012222514.14AEC312800A@llvm.org> Author: johnny Date: Wed Oct 12 17:25:13 2011 New Revision: 141826 URL: http://llvm.org/viewvc/llvm-project?rev=141826&view=rev Log: Minor fix. Modified: lldb/trunk/www/customization.html Modified: lldb/trunk/www/customization.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/customization.html?rev=141826&r1=141825&r2=141826&view=diff ============================================================================== --- lldb/trunk/www/customization.html (original) +++ lldb/trunk/www/customization.html Wed Oct 12 17:25:13 2011 @@ -3,7 +3,7 @@ -LLDB Customization +Customization @@ -17,7 +17,7 @@
      -

      LLDB Customization

      +

      Customization

      There is an examples/customization directory under LLDB top of tree, where you can find examples of customizations for interacting with the From gclayton at apple.com Wed Oct 12 18:34:26 2011 From: gclayton at apple.com (Greg Clayton) Date: Wed, 12 Oct 2011 23:34:26 -0000 Subject: [Lldb-commits] [lldb] r141832 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h Message-ID: <20111012233426.681D62A6C12C@llvm.org> Author: gclayton Date: Wed Oct 12 18:34:26 2011 New Revision: 141832 URL: http://llvm.org/viewvc/llvm-project?rev=141832&view=rev Log: Added the ability to see if a DIE is contained in a namespace. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141832&r1=141831&r2=141832&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 12 18:34:26 2011 @@ -1944,7 +1944,43 @@ #endif } } +bool +SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl, + DWARFCompileUnit* cu, + const DWARFDebugInfoEntry* die) +{ + // No namespace specified, so the answesr i + if (namespace_decl == NULL) + return true; + + const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die); + if (decl_ctx_die) + { + clang::NamespaceDecl *clang_namespace_decl = namespace_decl->GetNamespaceDecl(); + if (clang_namespace_decl) + { + if (decl_ctx_die->Tag() != DW_TAG_namespace) + return false; + DeclContextToDIEMap::iterator pos = m_decl_ctx_to_die.find(clang_namespace_decl); + + if (pos == m_decl_ctx_to_die.end()) + return false; + + return decl_ctx_die == pos->second; + } + else + { + // We have a namespace_decl that was not NULL but it contained + // a NULL "clang::NamespaceDecl", so this means the global namespace + // So as long the the contained decl context DIE isn't a namespace + // we should be ok. + if (decl_ctx_die->Tag() != DW_TAG_namespace) + return true; + } + } + return false; +} uint32_t SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=141832&r1=141831&r2=141832&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Oct 12 18:34:26 2011 @@ -249,6 +249,10 @@ flagsGotDebugNamesData = (1 << 11), flagsGotDebugTypesData = (1 << 12) }; + + bool DIEIsInNamespace (const lldb_private::ClangNamespaceDecl *namespace_decl, + DWARFCompileUnit* cu, + const DWARFDebugInfoEntry* die); DISALLOW_COPY_AND_ASSIGN (SymbolFileDWARF); bool ParseCompileUnit (DWARFCompileUnit* cu, lldb::CompUnitSP& compile_unit_sp); From gclayton at apple.com Wed Oct 12 19:00:53 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 00:00:53 -0000 Subject: [Lldb-commits] [lldb] r141838 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h Message-ID: <20111013000053.EFA912A6C12C@llvm.org> Author: gclayton Date: Wed Oct 12 19:00:53 2011 New Revision: 141838 URL: http://llvm.org/viewvc/llvm-project?rev=141838&view=rev Log: Added a function to test if a ClangNamespaceDecl matches the current symbol file. This will help us to minimize lookups that can't possibly match anything in the current symbol file. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141838&r1=141837&r2=141838&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 12 19:00:53 2011 @@ -1944,6 +1944,31 @@ #endif } } + +bool +SymbolFileDWARF::NamespaceDeclMatchesThisSymbolFile (const ClangNamespaceDecl *namespace_decl) +{ + if (namespace_decl == NULL) + { + // Invalid namespace decl which means we aren't matching only things + // in this symbol file, so return true to indicate it matches this + // symbol file. + return true; + } + + clang::ASTContext *namespace_ast = namespace_decl->GetASTContext(); + + if (namespace_ast == NULL) + return true; // No AST in the "namespace_decl", return true since it + // could then match any symbol file, including this one + + if (namespace_ast == GetClangASTContext().getASTContext()) + return true; // The ASTs match, return true + + // The namespace AST was valid, and it does not match... + return false; +} + bool SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl, DWARFCompileUnit* cu, @@ -1952,10 +1977,11 @@ // No namespace specified, so the answesr i if (namespace_decl == NULL) return true; - + const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die); if (decl_ctx_die) { + clang::NamespaceDecl *clang_namespace_decl = namespace_decl->GetNamespaceDecl(); if (clang_namespace_decl) { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=141838&r1=141837&r2=141838&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Oct 12 19:00:53 2011 @@ -250,6 +250,8 @@ flagsGotDebugTypesData = (1 << 12) }; + bool NamespaceDeclMatchesThisSymbolFile (const lldb_private::ClangNamespaceDecl *namespace_decl); + bool DIEIsInNamespace (const lldb_private::ClangNamespaceDecl *namespace_decl, DWARFCompileUnit* cu, const DWARFDebugInfoEntry* die); From scallanan at apple.com Wed Oct 12 19:09:20 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 13 Oct 2011 00:09:20 -0000 Subject: [Lldb-commits] [lldb] r141839 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111013000920.DE02B312800A@llvm.org> Author: spyffe Date: Wed Oct 12 19:09:20 2011 New Revision: 141839 URL: http://llvm.org/viewvc/llvm-project?rev=141839&view=rev Log: Now that we know the values are going to stick around, we don't need to look them up again when materializing. Switched over the materialization mechanism (for JIT expressions) and the lookup mechanism (for interpreted expressions) to use the VariableSP/Symbol that were found during parsing. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141839&r1=141838&r2=141839&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Wed Oct 12 19:09:20 2011 @@ -969,7 +969,7 @@ //------------------------------------------------------------------ Value * GetVariableValue (ExecutionContext &exe_ctx, - lldb::VariableSP var, + lldb::VariableSP &var, clang::ASTContext *parser_ast_context, TypeFromUser *found_type = NULL, TypeFromParser *parser_type = NULL); Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141839&r1=141838&r2=141839&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 19:09:20 2011 @@ -938,45 +938,10 @@ if (expr_var_sp) { - if (!expr_var_sp->m_parser_vars.get()) + if (!expr_var_sp->m_parser_vars.get() || !expr_var_sp->m_parser_vars->m_lldb_var) return Value(); - const ConstString &name(expr_var_sp->GetName()); - TypeFromUser type(expr_var_sp->GetTypeFromUser()); - - StackFrame *frame = m_parser_vars->m_exe_ctx->GetFramePtr(); - if (frame) - { - VariableSP var(FindVariableInScope (*frame, name, &type)); - - if (var) - return *GetVariableValue(exe_ctx, var, NULL); - } - - Target *target = m_parser_vars->m_exe_ctx->GetTargetPtr(); - - if (target) - { - lldb::ModuleSP module; - - VariableSP global(FindGlobalVariable (*target, module, name, NULL, &type)); - - if (global) - return *GetVariableValue(exe_ctx, global, NULL); - - lldb::addr_t location_load_addr = GetSymbolAddress(*target, name); - - if (location_load_addr != LLDB_INVALID_ADDRESS) - { - lldb_private::Value ret; - ret.SetValueType(Value::eValueTypeLoadAddress); - ret.SetContext(Value::eContextTypeInvalid, NULL); - ret.GetScalar() = location_load_addr; - return ret; - } - } - - return Value(); + return *GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL); } else if (persistent_var_sp) { @@ -1637,14 +1602,11 @@ const ConstString &name(expr_var->GetName()); TypeFromUser type(expr_var->GetTypeFromUser()); - VariableSP var = FindVariableInScope (*frame, name, &type); - - ModuleSP module; - - Symbol *sym = FindGlobalDataSymbol(*target, module, name, NULL); + VariableSP &var(expr_var->m_parser_vars->m_lldb_var); + lldb_private::Symbol *sym(expr_var->m_parser_vars->m_lldb_sym); std::auto_ptr location_value; - + if (var) { location_value.reset(GetVariableValue(exe_ctx, @@ -1652,9 +1614,7 @@ NULL)); } else if (sym) - { - location_value.reset(new Value); - + { addr_t location_load_addr = GetSymbolAddress(*target, name); if (location_load_addr == LLDB_INVALID_ADDRESS) @@ -1664,6 +1624,8 @@ name.GetCString()); } + location_value.reset(new Value); + location_value->SetValueType(Value::eValueTypeLoadAddress); location_value->GetScalar() = location_load_addr; } @@ -2044,7 +2006,6 @@ ) { VariableList vars; - ValueObjectList valobjs; if (module && namespace_decl) module->FindGlobalVariables (name, namespace_decl, true, -1, vars); @@ -2644,7 +2605,7 @@ ClangExpressionDeclMap::GetVariableValue ( ExecutionContext &exe_ctx, - VariableSP var, + VariableSP &var, ASTContext *parser_ast_context, TypeFromUser *user_type, TypeFromParser *parser_type From gclayton at apple.com Wed Oct 12 19:59:38 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 00:59:38 -0000 Subject: [Lldb-commits] [lldb] r141843 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h Message-ID: <20111013005938.D13FA312800A@llvm.org> Author: gclayton Date: Wed Oct 12 19:59:38 2011 New Revision: 141843 URL: http://llvm.org/viewvc/llvm-project?rev=141843&view=rev Log: Add a version of ResolveFunction that takes a "const DWARFDebugInfoEntry *" and a "DWARFCompileUnit *" to avoid doing a DIE lookup twice and to prepare for using namespaces in the lookups. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141843&r1=141842&r2=141843&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 12 19:59:38 2011 @@ -2149,21 +2149,27 @@ return variables.GetSize() - original_size; } + bool SymbolFileDWARF::ResolveFunction (dw_offset_t die_offset, DWARFCompileUnit *&dwarf_cu, SymbolContextList& sc_list) { - SymbolContext sc; - - DWARFDebugInfo* info = DebugInfo(); - bool resolved_it = false; - - if (info == NULL) - return resolved_it; - - DWARFDebugInfoEntry *die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu); + const DWARFDebugInfoEntry *die = DebugInfo()->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu); + return ResolveFunction (dwarf_cu, die, sc_list); +} + +bool +SymbolFileDWARF::ResolveFunction (DWARFCompileUnit *cu, + const DWARFDebugInfoEntry *die, + SymbolContextList& sc_list) +{ + SymbolContext sc; + + if (die == NULL) + return false; + // If we were passed a die that is not a function, just return false... if (die->Tag() != DW_TAG_subprogram && die->Tag() != DW_TAG_inlined_subroutine) return false; @@ -2180,7 +2186,7 @@ } } assert (die->Tag() == DW_TAG_subprogram); - if (GetFunction (dwarf_cu, die, sc)) + if (GetFunction (cu, die, sc)) { Address addr; // Parse all blocks if needed @@ -2212,11 +2218,11 @@ line_table->FindLineEntryByAddress (addr, sc.line_entry); sc_list.Append(sc); - resolved_it = true; + return true; } } - return resolved_it; + return false; } void @@ -2418,6 +2424,7 @@ if (info == NULL) return 0; + DWARFCompileUnit *dwarf_cu = NULL; if (m_apple_names_ap.get()) { DIEArray die_offsets; @@ -2429,15 +2436,18 @@ // If they asked for the full name, match what they typed. At some point we may // want to canonicalize this (strip double spaces, etc. For now, we just add all the // dies that we find by exact match. - DWARFCompileUnit *dwarf_cu = NULL; num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets); for (uint32_t i = 0; i < num_matches; i++) - ResolveFunction (die_offsets[i], dwarf_cu, sc_list); + { + const DWARFDebugInfoEntry *die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); + if (die) + { + ResolveFunction (dwarf_cu, die, sc_list); + } + } } else { - DWARFCompileUnit* dwarf_cu = NULL; - if (effective_name_type_mask & eFunctionNameTypeSelector) { num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets); @@ -2447,11 +2457,12 @@ for (uint32_t i = 0; i < num_matches; i++) { const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); - assert (die); - - const char *die_name = die->GetName(this, dwarf_cu); - if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name)) - ResolveFunction (die_offsets[i], dwarf_cu, sc_list); + if (die) + { + const char *die_name = die->GetName(this, dwarf_cu); + if (ObjCLanguageRuntime::IsPossibleObjCMethodName(die_name)) + ResolveFunction (dwarf_cu, die, sc_list); + } } die_offsets.clear(); } @@ -2469,19 +2480,20 @@ for (uint32_t i = 0; i < num_matches; i++) { - dw_offset_t offset = die_offsets[i]; - const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (offset, &dwarf_cu); - assert (die); - if (!FunctionDieMatchesPartialName(die, - dwarf_cu, - effective_name_type_mask, - name_cstr, - base_name_start, - base_name_end)) - continue; - - // If we get to here, the die is good, and we should add it: - ResolveFunction (offset, dwarf_cu, sc_list); + const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); + if (die) + { + if (!FunctionDieMatchesPartialName(die, + dwarf_cu, + effective_name_type_mask, + name_cstr, + base_name_start, + base_name_end)) + continue; + + // If we get to here, the die is good, and we should add it: + ResolveFunction (dwarf_cu, die, sc_list); + } } die_offsets.clear(); } @@ -2505,23 +2517,22 @@ if (effective_name_type_mask & eFunctionNameTypeBase) { uint32_t num_base = m_function_basename_index.Find(base_name_const, die_offsets); + for (uint32_t i = 0; i < num_base; i++) { - for (uint32_t i = 0; i < num_base; i++) - { - dw_offset_t offset = die_offsets[i]; - const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (offset, &dwarf_cu); - assert (die); - if (!FunctionDieMatchesPartialName(die, - dwarf_cu, - effective_name_type_mask, - name_cstr, - base_name_start, - base_name_end)) - continue; + const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); + if (die) + { + if (!FunctionDieMatchesPartialName(die, + dwarf_cu, + effective_name_type_mask, + name_cstr, + base_name_start, + base_name_end)) + continue; - // If we get to here, the die is good, and we should add it: - ResolveFunction (offset, dwarf_cu, sc_list); - } + // If we get to here, the die is good, and we should add it: + ResolveFunction (dwarf_cu, die, sc_list); + } } die_offsets.clear(); } @@ -2530,22 +2541,23 @@ { uint32_t num_base = m_function_method_index.Find(base_name_const, die_offsets); { - for (uint32_t i = 0; i < num_base; i++) - { - dw_offset_t offset = die_offsets[i]; - const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (offset, &dwarf_cu); - assert (die); - if (!FunctionDieMatchesPartialName(die, - dwarf_cu, - effective_name_type_mask, - name_cstr, - base_name_start, - base_name_end)) - continue; - - // If we get to here, the die is good, and we should add it: - ResolveFunction (offset, dwarf_cu, sc_list); - } + for (uint32_t i = 0; i < num_base; i++) + { + const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); + if (die) + { + if (!FunctionDieMatchesPartialName(die, + dwarf_cu, + effective_name_type_mask, + name_cstr, + base_name_start, + base_name_end)) + continue; + + // If we get to here, the die is good, and we should add it: + ResolveFunction (dwarf_cu, die, sc_list); + } + } } die_offsets.clear(); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=141843&r1=141842&r2=141843&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Oct 12 19:59:38 2011 @@ -329,11 +329,14 @@ uint32_t& bit_stride); // Given a die_offset, figure out the symbol context representing that die. - bool ResolveFunction ( - dw_offset_t offset, - DWARFCompileUnit *&dwarf_cu, - lldb_private::SymbolContextList& sc_list); - + bool ResolveFunction (dw_offset_t offset, + DWARFCompileUnit *&dwarf_cu, + lldb_private::SymbolContextList& sc_list); + + bool ResolveFunction (DWARFCompileUnit *cu, + const DWARFDebugInfoEntry *die, + lldb_private::SymbolContextList& sc_list); + bool FunctionDieMatchesPartialName ( const DWARFDebugInfoEntry* die, const DWARFCompileUnit *dwarf_cu, From gclayton at apple.com Wed Oct 12 20:14:40 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 01:14:40 -0000 Subject: [Lldb-commits] [lldb] r141845 - /lldb/trunk/source/Commands/CommandObjectTarget.cpp Message-ID: <20111013011440.2CA122A6C12C@llvm.org> Author: gclayton Date: Wed Oct 12 20:14:39 2011 New Revision: 141845 URL: http://llvm.org/viewvc/llvm-project?rev=141845&view=rev Log: Always use the full variable name when dumping globals since they might be in namespaces. Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=141845&r1=141844&r2=141845&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Oct 12 20:14:39 2011 @@ -684,7 +684,7 @@ valobj_sp = ValueObjectVariable::Create (exe_ctx.GetBestExecutionContextScope(), var_sp); if (valobj_sp) - DumpValueObject (s, var_sp, valobj_sp, use_var_name ? var_sp->GetName().GetCString() : arg); + DumpValueObject (s, var_sp, valobj_sp, var_sp->GetName().GetCString()); } } } From johnny.chen at apple.com Wed Oct 12 20:20:34 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Thu, 13 Oct 2011 01:20:34 -0000 Subject: [Lldb-commits] [lldb] r141846 - /lldb/trunk/examples/customization/pwd-cd-and-system/utils.py Message-ID: <20111013012034.3054C2A6C12C@llvm.org> Author: johnny Date: Wed Oct 12 20:20:34 2011 New Revision: 141846 URL: http://llvm.org/viewvc/llvm-project?rev=141846&view=rev Log: Add 'cd -' feature to change to the previous working directory. Modified: lldb/trunk/examples/customization/pwd-cd-and-system/utils.py Modified: lldb/trunk/examples/customization/pwd-cd-and-system/utils.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/customization/pwd-cd-and-system/utils.py?rev=141846&r1=141845&r2=141846&view=diff ============================================================================== --- lldb/trunk/examples/customization/pwd-cd-and-system/utils.py (original) +++ lldb/trunk/examples/customization/pwd-cd-and-system/utils.py Wed Oct 12 20:20:34 2011 @@ -2,13 +2,37 @@ import os, shlex, subprocess +# Store the previous working directory for the 'cd -' command. +class Holder: + """Holds the _prev_dir_ class attribute for chdir() function.""" + _prev_dir_ = None + + @classmethod + def prev_dir(cls): + return cls._prev_dir_ + + @classmethod + def swap(cls, dir): + cls._prev_dir_ = dir + def chdir(debugger, args, result, dict): - """Change the working directory, or cd to ${HOME}.""" - dir = args.strip() - if dir: - os.chdir(args) - else: - os.chdir(os.path.expanduser('~')) + """ + Change the working directory, or cd to ${HOME}. + You can also issue 'cd -' to change to the previous working directory. + """ + new_dir = args.strip() + if not new_dir: + new_dir = os.path.expanduser('~') + elif new_dir == '-': + if not Holder.prev_dir(): + # Bad directory, not changing. + print "bad directory, not changing" + return + else: + new_dir = Holder.prev_dir() + + Holder.swap(os.getcwd()) + os.chdir(new_dir) print "Current working directory: %s" % os.getcwd() def system(debugger, command_line, result, dict): From scallanan at apple.com Wed Oct 12 20:49:11 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 13 Oct 2011 01:49:11 -0000 Subject: [Lldb-commits] [lldb] r141847 - in /lldb/trunk: include/lldb/Core/ include/lldb/Symbol/ source/Core/ source/Expression/ source/Plugins/SymbolFile/DWARF/ source/Plugins/SymbolFile/Symtab/ source/Symbol/ Message-ID: <20111013014911.49656312800A@llvm.org> Author: spyffe Date: Wed Oct 12 20:49:10 2011 New Revision: 141847 URL: http://llvm.org/viewvc/llvm-project?rev=141847&view=rev Log: Completed the glue that passes a ClangNamespaceDecl * down through Module and SymbolVendor into SymbolFile. Added checks to SymbolFileDWARF that restrict symbol searches when a namespace is passed in. Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Symbol/SymbolFile.h lldb/trunk/include/lldb/Symbol/SymbolVendor.h lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h lldb/trunk/source/Symbol/SymbolContext.cpp lldb/trunk/source/Symbol/SymbolVendor.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Wed Oct 12 20:49:10 2011 @@ -739,7 +739,8 @@ uint32_t FindTypes_Impl (const SymbolContext& sc, - const ConstString &name, + const ConstString &name, + const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types); Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Wed Oct 12 20:49:10 2011 @@ -117,18 +117,19 @@ virtual clang::DeclContext* GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid) { return NULL; } virtual uint32_t ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) = 0; virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list) = 0; - virtual uint32_t FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) = 0; + virtual uint32_t FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) = 0; virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) = 0; - virtual uint32_t FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) = 0; + virtual uint32_t FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) = 0; virtual uint32_t FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list) = 0; - virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) = 0; + virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) = 0; // virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0; virtual TypeList * GetTypeList (); virtual ClangASTContext & GetClangASTContext (); virtual ClangNamespaceDecl FindNamespace (const SymbolContext& sc, - const ConstString &name) = 0; + const ConstString &name, + const ClangNamespaceDecl *parent_namespace_decl) = 0; ObjectFile* GetObjectFile() { return m_obj_file; } const ObjectFile* GetObjectFile() const { return m_obj_file; } Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Wed Oct 12 20:49:10 2011 @@ -99,6 +99,7 @@ virtual uint32_t FindGlobalVariables (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables); @@ -111,6 +112,7 @@ virtual uint32_t FindFunctions (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list); @@ -122,14 +124,16 @@ virtual uint32_t FindTypes (const SymbolContext& sc, - const ConstString &name, + const ConstString &name, + const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types); virtual lldb_private::ClangNamespaceDecl FindNamespace (const SymbolContext& sc, - const ConstString &name); + const ConstString &name, + const ClangNamespaceDecl *parent_namespace_decl); virtual uint32_t GetNumCompileUnits(); Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Wed Oct 12 20:49:10 2011 @@ -354,7 +354,7 @@ { SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - return symbols->FindGlobalVariables(name, append, max_matches, variables); + return symbols->FindGlobalVariables(name, namespace_decl, append, max_matches, variables); return 0; } uint32_t @@ -404,7 +404,7 @@ // Find all the functions (not symbols, but debug information functions... SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - symbols->FindFunctions(name, name_type_mask, append, sc_list); + symbols->FindFunctions(name, namespace_decl, name_type_mask, append, sc_list); // Now check our symbol table for symbols that are code symbols if requested if (include_symbols) @@ -477,14 +477,14 @@ } uint32_t -Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) +Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) { Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); if (sc.module_sp.get() == NULL || sc.module_sp.get() == this) { SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - return symbols->FindTypes(sc, name, append, max_matches, types); + return symbols->FindTypes(sc, name, namespace_decl, append, max_matches, types); } return 0; } @@ -512,12 +512,12 @@ uint32_t Module::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) { - uint32_t retval = FindTypes_Impl(sc, name, append, max_matches, types); + uint32_t retval = FindTypes_Impl(sc, name, namespace_decl, append, max_matches, types); if (retval == 0) { const char *stripped = StripTypeName(name.GetCString()); - return FindTypes_Impl(sc, ConstString(stripped), append, max_matches, types); + return FindTypes_Impl(sc, ConstString(stripped), namespace_decl, append, max_matches, types); } else return retval; Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Oct 12 20:49:10 2011 @@ -2440,7 +2440,7 @@ SymbolContext null_sc; - namespace_decl = symbol_vendor->FindNamespace(null_sc, name); + namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &namespace_decl); if (namespace_decl) { Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Oct 12 20:49:10 2011 @@ -2008,7 +2008,7 @@ return false; } uint32_t -SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) +SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) { LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); @@ -2019,6 +2019,10 @@ m_obj_file->GetFileSpec().GetFilename().GetCString(), name.GetCString(), append, max_matches); } + + if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl)) + return 0; + DWARFDebugInfo* info = DebugInfo(); if (info == NULL) return 0; @@ -2070,6 +2074,9 @@ sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX); assert(sc.comp_unit != NULL); + + if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) + continue; ParseVariables(sc, dwarf_cu, LLDB_INVALID_ADDRESS, die, false, false, &variables); @@ -2343,6 +2350,7 @@ uint32_t SymbolFileDWARF::FindFunctions (const ConstString &name, + const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) @@ -2364,6 +2372,9 @@ // If we aren't appending the results to this list, then clear the list if (!append) sc_list.Clear(); + + if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl)) + return 0; // If name is empty then we won't find anything. if (name.IsEmpty()) @@ -2442,6 +2453,9 @@ const DWARFDebugInfoEntry *die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); if (die) { + if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) + continue; + ResolveFunction (dwarf_cu, die, sc_list); } } @@ -2450,6 +2464,9 @@ { if (effective_name_type_mask & eFunctionNameTypeSelector) { + if (namespace_decl && *namespace_decl) + return 0; // no selectors in namespaces + num_matches = m_apple_names_ap->FindByName (name_cstr, die_offsets); // Now make sure these are actually ObjC methods. In this case we can simply look up the name, // and if it is an ObjC method name, we're good. @@ -2470,6 +2487,10 @@ if (effective_name_type_mask & eFunctionNameTypeMethod || effective_name_type_mask & eFunctionNameTypeBase) { + if ((effective_name_type_mask & eFunctionNameTypeMethod) && + (namespace_decl && *namespace_decl)) + return 0; // no methods in namespaces + // The apple_names table stores just the "base name" of C++ methods in the table. So we have to // extract the base name, look that up, and if there is any other information in the name we were // passed in we have to post-filter based on that. @@ -2483,6 +2504,9 @@ const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); if (die) { + if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) + continue; + if (!FunctionDieMatchesPartialName(die, dwarf_cu, effective_name_type_mask, @@ -2522,6 +2546,9 @@ const DWARFDebugInfoEntry* die = info->GetDIEPtrWithCompileUnitHint (die_offsets[i], &dwarf_cu); if (die) { + if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) + continue; + if (!FunctionDieMatchesPartialName(die, dwarf_cu, effective_name_type_mask, @@ -2539,6 +2566,9 @@ if (effective_name_type_mask & eFunctionNameTypeMethod) { + if (namespace_decl && *namespace_decl) + return 0; // no methods in namespaces + uint32_t num_base = m_function_method_index.Find(base_name_const, die_offsets); { for (uint32_t i = 0; i < num_base; i++) @@ -2562,7 +2592,7 @@ die_offsets.clear(); } - if (effective_name_type_mask & eFunctionNameTypeSelector) + if ((effective_name_type_mask & eFunctionNameTypeSelector) && (!namespace_decl || !*namespace_decl)) { FindFunctions (name, m_function_selector_index, sc_list); } @@ -2653,7 +2683,7 @@ } uint32_t -SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) +SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) { DWARFDebugInfo* info = DebugInfo(); if (info == NULL) @@ -2672,6 +2702,9 @@ // If we aren't appending the results to this list, then clear the list if (!append) types.Clear(); + + if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl)) + return 0; DIEArray die_offsets; @@ -2702,6 +2735,9 @@ const dw_offset_t die_offset = die_offsets[i]; die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu); + if (namespace_decl && !DIEIsInNamespace (namespace_decl, dwarf_cu, die)) + continue; + Type *matching_type = ResolveType (dwarf_cu, die); if (matching_type) { @@ -2727,7 +2763,8 @@ ClangNamespaceDecl SymbolFileDWARF::FindNamespace (const SymbolContext& sc, - const ConstString &name) + const ConstString &name, + const lldb_private::ClangNamespaceDecl *parent_namespace_decl) { LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); @@ -2738,6 +2775,9 @@ m_obj_file->GetFileSpec().GetFilename().GetCString(), name.GetCString()); } + + if (!NamespaceDeclMatchesThisSymbolFile(parent_namespace_decl)) + return ClangNamespaceDecl(); ClangNamespaceDecl namespace_decl; DWARFDebugInfo* info = DebugInfo(); @@ -2770,6 +2810,9 @@ { const dw_offset_t die_offset = die_offsets[i]; die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu); + + if (parent_namespace_decl && !DIEIsInNamespace (parent_namespace_decl, dwarf_cu, die)) + continue; clang::NamespaceDecl *clang_namespace_decl = ResolveNamespaceDIE (dwarf_cu, die); if (clang_namespace_decl) @@ -4120,7 +4163,7 @@ { ConstString class_name (class_name_start, class_name_end - class_name_start); TypeList types; - const uint32_t match_count = FindTypes (empty_sc, class_name, true, UINT32_MAX, types); + const uint32_t match_count = FindTypes (empty_sc, class_name, NULL, true, UINT32_MAX, types); if (match_count > 0) { for (uint32_t i=0; i &indexes, // Indexes into the symbol table that match "name" uint32_t max_matches, VariableList& variables @@ -718,7 +719,7 @@ SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex (oso_idx); if (oso_dwarf) { - if (oso_dwarf->FindGlobalVariables(name, true, max_matches, variables)) + if (oso_dwarf->FindGlobalVariables(name, namespace_decl, true, max_matches, variables)) if (variables.GetSize() > max_matches) break; } @@ -728,7 +729,7 @@ } uint32_t -SymbolFileDWARFDebugMap::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) +SymbolFileDWARFDebugMap::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) { // If we aren't appending the results to this list, then clear the list @@ -743,7 +744,8 @@ SymbolFileDWARF *oso_dwarf; for (uint32_t oso_idx = 0; ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) { - const uint32_t oso_matches = oso_dwarf->FindGlobalVariables (name, + const uint32_t oso_matches = oso_dwarf->FindGlobalVariables (name, + namespace_decl, true, max_matches, variables); @@ -917,7 +919,7 @@ } uint32_t -SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +SymbolFileDWARFDebugMap::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileDWARFDebugMap::FindFunctions (name = %s)", @@ -934,7 +936,7 @@ while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL) { uint32_t sc_idx = sc_list.GetSize(); - if (oso_dwarf->FindFunctions(name, name_type_mask, true, sc_list)) + if (oso_dwarf->FindFunctions(name, namespace_decl, name_type_mask, true, sc_list)) { RemoveFunctionsWithModuleNotEqualTo (m_obj_file->GetModule(), sc_list, sc_idx); } @@ -994,7 +996,8 @@ SymbolFileDWARFDebugMap::FindTypes ( const SymbolContext& sc, - const ConstString &name, + const ConstString &name, + const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types @@ -1010,13 +1013,13 @@ { oso_dwarf = GetSymbolFile (sc); if (oso_dwarf) - return oso_dwarf->FindTypes (sc, name, append, max_matches, types); + return oso_dwarf->FindTypes (sc, name, namespace_decl, append, max_matches, types); } else { uint32_t oso_idx = 0; while ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx++)) != NULL) - oso_dwarf->FindTypes (sc, name, append, max_matches, types); + oso_dwarf->FindTypes (sc, name, namespace_decl, append, max_matches, types); } return types.GetSize() - initial_types_size; @@ -1035,7 +1038,8 @@ ClangNamespaceDecl SymbolFileDWARFDebugMap::FindNamespace (const lldb_private::SymbolContext& sc, - const lldb_private::ConstString &name) + const lldb_private::ConstString &name, + const ClangNamespaceDecl *parent_namespace_decl) { ClangNamespaceDecl matching_namespace; SymbolFileDWARF *oso_dwarf; @@ -1044,7 +1048,7 @@ { oso_dwarf = GetSymbolFile (sc); if (oso_dwarf) - matching_namespace = oso_dwarf->FindNamespace (sc, name); + matching_namespace = oso_dwarf->FindNamespace (sc, name, parent_namespace_decl); } else { @@ -1052,7 +1056,7 @@ ((oso_dwarf = GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx) { - matching_namespace = oso_dwarf->FindNamespace (sc, name); + matching_namespace = oso_dwarf->FindNamespace (sc, name, parent_namespace_decl); if (matching_namespace) break; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Wed Oct 12 20:49:10 2011 @@ -69,14 +69,15 @@ virtual lldb::clang_type_t ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_Type); virtual uint32_t ResolveSymbolContext (const lldb_private::Address& so_addr, uint32_t resolve_scope, lldb_private::SymbolContext& sc); virtual uint32_t ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list); - virtual uint32_t FindGlobalVariables (const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables); + virtual uint32_t FindGlobalVariables (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables); virtual uint32_t FindGlobalVariables (const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); - virtual uint32_t FindFunctions (const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); + virtual uint32_t FindFunctions (const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list); - virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types); + virtual uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types); virtual lldb_private::ClangNamespaceDecl FindNamespace (const lldb_private::SymbolContext& sc, - const lldb_private::ConstString &name); + const lldb_private::ConstString &name, + const lldb_private::ClangNamespaceDecl *parent_namespace_decl); //------------------------------------------------------------------ @@ -191,6 +192,7 @@ uint32_t PrivateFindGlobalVariables (const lldb_private::ConstString &name, + const lldb_private::ClangNamespaceDecl *namespace_decl, const std::vector &name_symbol_indexes, uint32_t max_matches, lldb_private::VariableList& variables); Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp Wed Oct 12 20:49:10 2011 @@ -280,7 +280,7 @@ } ClangNamespaceDecl -SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name) +SymbolFileSymtab::FindNamespace (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl) { return ClangNamespaceDecl(); } @@ -308,7 +308,7 @@ } uint32_t -SymbolFileSymtab::FindGlobalVariables(const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) +SymbolFileSymtab::FindGlobalVariables(const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) { return 0; } @@ -320,7 +320,7 @@ } uint32_t -SymbolFileSymtab::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +SymbolFileSymtab::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) { Timer scoped_timer (__PRETTY_FUNCTION__, "SymbolFileSymtab::FindFunctions (name = '%s')", @@ -348,7 +348,7 @@ } uint32_t -SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types) +SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types) { if (!append) types.Clear(); Modified: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h Wed Oct 12 20:49:10 2011 @@ -84,26 +84,27 @@ ResolveSymbolContext (const lldb_private::FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, lldb_private::SymbolContextList& sc_list); virtual uint32_t - FindGlobalVariables(const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::VariableList& variables); + FindGlobalVariables(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::VariableList& variables); virtual uint32_t FindGlobalVariables(const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables); virtual uint32_t - FindFunctions(const lldb_private::ConstString &name, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); + FindFunctions(const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t FindFunctions(const lldb_private::RegularExpression& regex, bool append, lldb_private::SymbolContextList& sc_list); virtual uint32_t - FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, bool append, uint32_t max_matches, lldb_private::TypeList& types); + FindTypes (const lldb_private::SymbolContext& sc,const lldb_private::ConstString &name, const lldb_private::ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, lldb_private::TypeList& types); // virtual uint32_t // FindTypes(const lldb_private::SymbolContext& sc, const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::TypeList& types); virtual lldb_private::ClangNamespaceDecl FindNamespace (const lldb_private::SymbolContext& sc, - const lldb_private::ConstString &name); + const lldb_private::ConstString &name, + const lldb_private::ClangNamespaceDecl *parent_namespace_decl); //------------------------------------------------------------------ // PluginInterface protocol Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Wed Oct 12 20:49:10 2011 @@ -457,7 +457,7 @@ { ClangNamespaceDecl namespace_decl; if (module_sp) - namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name); + namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name, NULL); return namespace_decl; } Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=141847&r1=141846&r2=141847&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolVendor.cpp (original) +++ lldb/trunk/source/Symbol/SymbolVendor.cpp Wed Oct 12 20:49:10 2011 @@ -216,11 +216,11 @@ } uint32_t -SymbolVendor::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables) +SymbolVendor::FindGlobalVariables (const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) { Mutex::Locker locker(m_mutex); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindGlobalVariables(name, append, max_matches, variables); + return m_sym_file_ap->FindGlobalVariables(name, namespace_decl, append, max_matches, variables); return 0; } @@ -234,11 +234,11 @@ } uint32_t -SymbolVendor::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) +SymbolVendor::FindFunctions(const ConstString &name, const ClangNamespaceDecl *namespace_decl, uint32_t name_type_mask, bool append, SymbolContextList& sc_list) { Mutex::Locker locker(m_mutex); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindFunctions(name, name_type_mask, append, sc_list); + return m_sym_file_ap->FindFunctions(name, namespace_decl, name_type_mask, append, sc_list); return 0; } @@ -253,23 +253,23 @@ uint32_t -SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types) +SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, TypeList& types) { Mutex::Locker locker(m_mutex); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindTypes(sc, name, append, max_matches, types); + return m_sym_file_ap->FindTypes(sc, name, namespace_decl, append, max_matches, types); if (!append) types.Clear(); return 0; } ClangNamespaceDecl -SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name) +SymbolVendor::FindNamespace(const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *parent_namespace_decl) { Mutex::Locker locker(m_mutex); ClangNamespaceDecl namespace_decl; if (m_sym_file_ap.get()) - namespace_decl = m_sym_file_ap->FindNamespace (sc, name); + namespace_decl = m_sym_file_ap->FindNamespace (sc, name, parent_namespace_decl); return namespace_decl; } From scallanan at apple.com Thu Oct 13 11:49:48 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 13 Oct 2011 16:49:48 -0000 Subject: [Lldb-commits] [lldb] r141866 - in /lldb/trunk: include/lldb/Core/Module.h include/lldb/Expression/ClangExpressionDeclMap.h source/Breakpoint/BreakpointResolverName.cpp source/Core/AddressResolverName.cpp source/Core/Module.cpp source/Core/ModuleList.cpp source/Expression/ClangExpressionDeclMap.cpp source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Message-ID: <20111013164948.35E952A6C12C@llvm.org> Author: spyffe Date: Thu Oct 13 11:49:47 2011 New Revision: 141866 URL: http://llvm.org/viewvc/llvm-project?rev=141866&view=rev Log: Removed namespace qualification from symbol queries. Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp lldb/trunk/source/Core/AddressResolverName.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Thu Oct 13 11:49:47 2011 @@ -161,7 +161,6 @@ size_t FindSymbolsWithNameAndType (const ConstString &name, - const ClangNamespaceDecl *namespace_decl, lldb::SymbolType symbol_type, SymbolContextList &sc_list); Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Thu Oct 13 11:49:47 2011 @@ -889,23 +889,15 @@ /// @param[in] target /// The target to use as the basis for the search. /// - /// @param[in] module - /// If non-NULL, the module to query. - /// /// @param[in] name /// The name as a plain C string. /// - /// @param[in] namespace_decl - /// If valid and module is non-NULL, the parent namespace. - /// /// @return /// The LLDB Symbol found, or NULL if none was found. //--------------------------------------------------------- Symbol * FindGlobalDataSymbol (Target &target, - lldb::ModuleSP &module, - const ConstString &name, - ClangNamespaceDecl *namespace_decl); + const ConstString &name); //------------------------------------------------------------------ /// Given a target, find a variable that matches the given name and Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Thu Oct 13 11:49:47 2011 @@ -140,7 +140,7 @@ if (num_functions == 0 && !filter_by_cu) { if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeAuto)) - context.module_sp->FindSymbolsWithNameAndType (m_func_name, NULL, eSymbolTypeCode, sym_list); + context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list); } } break; Modified: lldb/trunk/source/Core/AddressResolverName.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/AddressResolverName.cpp?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/source/Core/AddressResolverName.cpp (original) +++ lldb/trunk/source/Core/AddressResolverName.cpp Thu Oct 13 11:49:47 2011 @@ -111,7 +111,6 @@ if (context.module_sp) { context.module_sp->FindSymbolsWithNameAndType (m_func_name, - NULL, eSymbolTypeCode, sym_list); context.module_sp->FindFunctions (m_func_name, Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Thu Oct 13 11:49:47 2011 @@ -687,7 +687,7 @@ } size_t -Module::FindSymbolsWithNameAndType (const ConstString &name, const ClangNamespaceDecl *namespace_decl, SymbolType symbol_type, SymbolContextList &sc_list) +Module::FindSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, SymbolContextList &sc_list) { // No need to protect this call using m_mutex all other method calls are // already thread safe. Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Thu Oct 13 11:49:47 2011 @@ -254,7 +254,7 @@ sc_list.Clear(); collection::iterator pos, end = m_modules.end(); for (pos = m_modules.begin(); pos != end; ++pos) - (*pos)->FindSymbolsWithNameAndType (name, NULL, symbol_type, sc_list); + (*pos)->FindSymbolsWithNameAndType (name, symbol_type, sc_list); return sc_list.GetSize(); } Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Oct 13 11:49:47 2011 @@ -631,7 +631,7 @@ ) { if (sym_ctx.module_sp) - sym_ctx.module_sp->FindSymbolsWithNameAndType(name, NULL, eSymbolTypeCode, sc_list); + sym_ctx.module_sp->FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list); if (!sc_list.GetSize()) sym_ctx.target_sp->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list); @@ -1950,22 +1950,14 @@ ClangExpressionDeclMap::FindGlobalDataSymbol ( Target &target, - ModuleSP &module, - const ConstString &name, - ClangNamespaceDecl *namespace_decl + const ConstString &name ) { SymbolContextList sc_list; - if (module && namespace_decl) - module->FindSymbolsWithNameAndType(name, - namespace_decl, - eSymbolTypeData, - sc_list); - else - target.GetImages().FindSymbolsWithNameAndType(name, - eSymbolTypeData, - sc_list); + target.GetImages().FindSymbolsWithNameAndType(name, + eSymbolTypeData, + sc_list); if (sc_list.GetSize()) { @@ -2408,7 +2400,7 @@ // We couldn't find a non-symbol variable for this. Now we'll hunt for a generic // data symbol, and -- if it is found -- treat it as a variable. - Symbol *data_symbol = FindGlobalDataSymbol(*target, module_sp, name, &namespace_decl); + Symbol *data_symbol = FindGlobalDataSymbol(*target, name); if (data_symbol) { 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=141866&r1=141865&r2=141866&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original) +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Oct 13 11:49:47 2011 @@ -1696,7 +1696,7 @@ SymbolContextList contexts; SymbolContext context; - if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), NULL, eSymbolTypeCode, contexts)) + if (!m_module->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts)) return m_entry_point_address; contexts.GetContextAtIndex(0, context); From gclayton at apple.com Thu Oct 13 13:08:26 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 18:08:26 -0000 Subject: [Lldb-commits] [lldb] r141876 - in /lldb/trunk: include/lldb/API/ lldb.xcodeproj/ lldb.xcodeproj/xcshareddata/xcschemes/ scripts/ scripts/Python/ scripts/Python/interface/ source/API/ Message-ID: <20111013180827.1A266312800A@llvm.org> Author: gclayton Date: Thu Oct 13 13:08:26 2011 New Revision: 141876 URL: http://llvm.org/viewvc/llvm-project?rev=141876&view=rev Log: Cleaned up the SBWatchpoint public API. Added: lldb/trunk/include/lldb/API/SBWatchpoint.h - copied, changed from r141866, lldb/trunk/include/lldb/API/SBWatchpointLocation.h lldb/trunk/scripts/Python/interface/SBWatchpoint.i - copied, changed from r141866, lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i lldb/trunk/source/API/SBWatchpoint.cpp - copied, changed from r141866, lldb/trunk/source/API/SBWatchpointLocation.cpp Removed: lldb/trunk/include/lldb/API/SBWatchpointLocation.h lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i lldb/trunk/source/API/SBWatchpointLocation.cpp Modified: lldb/trunk/include/lldb/API/SBDefines.h lldb/trunk/include/lldb/API/SBError.h lldb/trunk/include/lldb/API/SBStream.h lldb/trunk/include/lldb/API/SBTarget.h lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb/trunk/scripts/Python/build-swig-Python.sh lldb/trunk/scripts/Python/interface/SBTarget.i lldb/trunk/scripts/Python/interface/SBValue.i lldb/trunk/scripts/Python/modify-python-lldb.py lldb/trunk/scripts/Python/python-extensions.swig lldb/trunk/scripts/lldb.swig lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBValue.cpp Modified: lldb/trunk/include/lldb/API/SBDefines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBDefines.h (original) +++ lldb/trunk/include/lldb/API/SBDefines.h Thu Oct 13 13:08:26 2011 @@ -63,7 +63,7 @@ class SBTypeList; class SBValue; class SBValueList; -class SBWatchpointLocation; +class SBWatchpoint; } Modified: lldb/trunk/include/lldb/API/SBError.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBError.h (original) +++ lldb/trunk/include/lldb/API/SBError.h Thu Oct 13 13:08:26 2011 @@ -81,6 +81,7 @@ friend class SBThread; friend class SBTarget; friend class SBValue; + friend class SBWatchpoint; lldb_private::Error * get(); Modified: lldb/trunk/include/lldb/API/SBStream.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBStream.h?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBStream.h (original) +++ lldb/trunk/include/lldb/API/SBStream.h Thu Oct 13 13:08:26 2011 @@ -77,7 +77,7 @@ friend class SBTarget; friend class SBThread; friend class SBValue; - friend class SBWatchpointLocation; + friend class SBWatchpoint; #ifndef SWIG Modified: lldb/trunk/include/lldb/API/SBTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBTarget.h (original) +++ lldb/trunk/include/lldb/API/SBTarget.h Thu Oct 13 13:08:26 2011 @@ -16,7 +16,7 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpecList.h" #include "lldb/API/SBType.h" -#include "lldb/API/SBWatchpointLocation.h" +#include "lldb/API/SBWatchpoint.h" namespace lldb { @@ -452,28 +452,28 @@ DeleteAllBreakpoints (); uint32_t - GetNumWatchpointLocations () const; + GetNumWatchpoints () const; - lldb::SBWatchpointLocation - GetLastCreatedWatchpointLocation (); - - lldb::SBWatchpointLocation - GetWatchpointLocationAtIndex (uint32_t idx) const; + lldb::SBWatchpoint + GetWatchpointAtIndex (uint32_t idx) const; bool - WatchpointLocationDelete (watch_id_t watch_id); + DeleteWatchpoint (lldb::watch_id_t watch_id); + + lldb::SBWatchpoint + FindWatchpointByID (lldb::watch_id_t watch_id); - lldb::SBWatchpointLocation - FindWatchpointLocationByID (watch_id_t watch_id); + lldb::SBWatchpoint + WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write); bool - EnableAllWatchpointLocations (); + EnableAllWatchpoints (); bool - DisableAllWatchpointLocations (); + DisableAllWatchpoints (); bool - DeleteAllWatchpointLocations (); + DeleteAllWatchpoints (); lldb::SBBroadcaster GetBroadcaster () const; Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Thu Oct 13 13:08:26 2011 @@ -275,6 +275,58 @@ SBValue (const lldb::ValueObjectSP &value_sp); + //------------------------------------------------------------------ + /// Watch this value if it resides in memory. + /// + /// Sets a watchpoint on the value. + /// + /// @param[in] resolve_location + /// Resolve the location of this value once and watch its address. + /// This value must currently be set to \b true as watching all + /// locations of a variable or a variable path is not yet supported, + /// though we plan to support it in the future. + /// + /// @param[in] read + /// Stop when this value is accessed. + /// + /// @param[in] write + /// Stop when this value is modified + /// + /// @return + /// An SBWatchpoint object. This object might not be valid upon + /// return due to a value not being contained in memory, too + /// large, or watchpoint resources are not available or all in + /// use. + //------------------------------------------------------------------ + lldb::SBWatchpoint + Watch (bool resolve_location, bool read, bool write); + + //------------------------------------------------------------------ + /// Watch this value that this value points to in memory + /// + /// Sets a watchpoint on the value. + /// + /// @param[in] resolve_location + /// Resolve the location of this value once and watch its address. + /// This value must currently be set to \b true as watching all + /// locations of a variable or a variable path is not yet supported, + /// though we plan to support it in the future. + /// + /// @param[in] read + /// Stop when this value is accessed. + /// + /// @param[in] write + /// Stop when this value is modified + /// + /// @return + /// An SBWatchpoint object. This object might not be valid upon + /// return due to a value not being contained in memory, too + /// large, or watchpoint resources are not available or all in + /// use. + //------------------------------------------------------------------ + lldb::SBWatchpoint + WatchPointee (bool resolve_location, bool read, bool write); + #ifndef SWIG // this must be defined in the .h file because synthetic children as implemented in the core // currently rely on being able to extract the SharedPointer out of an SBValue. if the implementation Copied: lldb/trunk/include/lldb/API/SBWatchpoint.h (from r141866, lldb/trunk/include/lldb/API/SBWatchpointLocation.h) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?p2=lldb/trunk/include/lldb/API/SBWatchpoint.h&p1=lldb/trunk/include/lldb/API/SBWatchpointLocation.h&r1=141866&r2=141876&rev=141876&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBWatchpointLocation.h (original) +++ lldb/trunk/include/lldb/API/SBWatchpoint.h Thu Oct 13 13:08:26 2011 @@ -1,4 +1,4 @@ -//===-- SBWatchpointLocation.h ----------------------------------*- C++ -*-===// +//===-- SBWatchpoint.h ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,43 +7,46 @@ // //===----------------------------------------------------------------------===// -#ifndef LLDB_SBWatchpointLocation_h_ -#define LLDB_SBWatchpointLocation_h_ +#ifndef LLDB_SBWatchpoint_h_ +#define LLDB_SBWatchpoint_h_ #include "lldb/API/SBDefines.h" namespace lldb { -class SBWatchpointLocation +class SBWatchpoint { public: - SBWatchpointLocation (); + SBWatchpoint (); - SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs); + SBWatchpoint (const lldb::SBWatchpoint &rhs); - ~SBWatchpointLocation (); + ~SBWatchpoint (); #ifndef SWIG - const lldb::SBWatchpointLocation & - operator = (const lldb::SBWatchpointLocation &rhs); + const lldb::SBWatchpoint & + operator = (const lldb::SBWatchpoint &rhs); #endif + lldb::SBError + GetError (); + watch_id_t - GetID () const; + GetID (); bool IsValid() const; /// With -1 representing an invalid hardware index. int32_t - GetHardwareIndex () const; + GetHardwareIndex (); lldb::addr_t - GetWatchAddress () const; + GetWatchAddress (); size_t - GetWatchSize() const; + GetWatchSize(); void SetEnabled(bool enabled); @@ -52,7 +55,7 @@ IsEnabled (); uint32_t - GetHitCount () const; + GetHitCount (); uint32_t GetIgnoreCount (); @@ -64,7 +67,7 @@ GetDescription (lldb::SBStream &description, DescriptionLevel level); #ifndef SWIG - SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp); + SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp); #endif private: @@ -73,17 +76,14 @@ #ifndef SWIG lldb_private::WatchpointLocation * - operator->() const; + operator->(); lldb_private::WatchpointLocation * - get() const; + get(); lldb::WatchpointLocationSP & operator *(); - const lldb::WatchpointLocationSP & - operator *() const; - #endif lldb::WatchpointLocationSP m_opaque_sp; @@ -92,4 +92,4 @@ } // namespace lldb -#endif // LLDB_SBWatchpointLocation_h_ +#endif // LLDB_SBWatchpoint_h_ Removed: lldb/trunk/include/lldb/API/SBWatchpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpointLocation.h?rev=141875&view=auto ============================================================================== --- lldb/trunk/include/lldb/API/SBWatchpointLocation.h (original) +++ lldb/trunk/include/lldb/API/SBWatchpointLocation.h (removed) @@ -1,95 +0,0 @@ -//===-- SBWatchpointLocation.h ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLDB_SBWatchpointLocation_h_ -#define LLDB_SBWatchpointLocation_h_ - -#include "lldb/API/SBDefines.h" - -namespace lldb { - -class SBWatchpointLocation -{ -public: - - SBWatchpointLocation (); - - SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs); - - ~SBWatchpointLocation (); - -#ifndef SWIG - const lldb::SBWatchpointLocation & - operator = (const lldb::SBWatchpointLocation &rhs); -#endif - - watch_id_t - GetID () const; - - bool - IsValid() const; - - /// With -1 representing an invalid hardware index. - int32_t - GetHardwareIndex () const; - - lldb::addr_t - GetWatchAddress () const; - - size_t - GetWatchSize() const; - - void - SetEnabled(bool enabled); - - bool - IsEnabled (); - - uint32_t - GetHitCount () const; - - uint32_t - GetIgnoreCount (); - - void - SetIgnoreCount (uint32_t n); - - bool - GetDescription (lldb::SBStream &description, DescriptionLevel level); - -#ifndef SWIG - SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp); -#endif - -private: - friend class SBTarget; - -#ifndef SWIG - - lldb_private::WatchpointLocation * - operator->() const; - - lldb_private::WatchpointLocation * - get() const; - - lldb::WatchpointLocationSP & - operator *(); - - const lldb::WatchpointLocationSP & - operator *() const; - -#endif - - lldb::WatchpointLocationSP m_opaque_sp; - -}; - -} // namespace lldb - -#endif // LLDB_SBWatchpointLocation_h_ Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Oct 13 13:08:26 2011 @@ -452,8 +452,8 @@ B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; }; B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointLocationList.cpp */; }; B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; }; - B2A58722143119810092BFBA /* SBWatchpointLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpointLocation.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B2A58724143119D50092BFBA /* SBWatchpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */; }; + B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -1368,9 +1368,9 @@ B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = ""; }; B296983412C2FB2B002D92C3 /* CommandObjectVersion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectVersion.cpp; path = source/Commands/CommandObjectVersion.cpp; sourceTree = ""; }; B296983512C2FB2B002D92C3 /* CommandObjectVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectVersion.h; path = source/Commands/CommandObjectVersion.h; sourceTree = ""; }; - B2A58721143119810092BFBA /* SBWatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBWatchpointLocation.h; path = include/lldb/API/SBWatchpointLocation.h; sourceTree = ""; }; - B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBWatchpointLocation.cpp; path = source/API/SBWatchpointLocation.cpp; sourceTree = ""; }; - B2A5872514313B480092BFBA /* SBWatchpointLocation.i */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = SBWatchpointLocation.i; sourceTree = ""; }; + B2A58721143119810092BFBA /* SBWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBWatchpoint.h; path = include/lldb/API/SBWatchpoint.h; sourceTree = ""; }; + B2A58723143119D50092BFBA /* SBWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBWatchpoint.cpp; path = source/API/SBWatchpoint.cpp; sourceTree = ""; }; + B2A5872514313B480092BFBA /* SBWatchpoint.i */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = SBWatchpoint.i; sourceTree = ""; }; B2D3033612EFA5C500F84EB3 /* InstructionUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstructionUtils.h; path = Utility/InstructionUtils.h; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1732,7 +1732,7 @@ 2611FF11142D83060017FEA3 /* SBType.i */, 2611FF12142D83060017FEA3 /* SBValue.i */, 2611FF13142D83060017FEA3 /* SBValueList.i */, - B2A5872514313B480092BFBA /* SBWatchpointLocation.i */, + B2A5872514313B480092BFBA /* SBWatchpoint.i */, ); name = interface; path = scripts/Python/interface; @@ -1842,8 +1842,8 @@ 9A19A6AD1163BB9800E0D453 /* SBValue.cpp */, 9A357582116CFDEE00E8ED2F /* SBValueList.h */, 9A35758D116CFE0F00E8ED2F /* SBValueList.cpp */, - B2A58723143119D50092BFBA /* SBWatchpointLocation.cpp */, - B2A58721143119810092BFBA /* SBWatchpointLocation.h */, + B2A58723143119D50092BFBA /* SBWatchpoint.cpp */, + B2A58721143119810092BFBA /* SBWatchpoint.h */, ); name = API; sourceTree = ""; @@ -2882,7 +2882,7 @@ 4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */, 4CAA56131422D96A001FFA01 /* BreakpointResolverFileRegex.h in Headers */, 26B8283D142D01E9002DBC64 /* SBSection.h in Headers */, - B2A58722143119810092BFBA /* SBWatchpointLocation.h in Headers */, + B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3171,7 +3171,7 @@ 4CAA56151422D986001FFA01 /* BreakpointResolverFileRegex.cpp in Sources */, 4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */, 26B82840142D020F002DBC64 /* SBSection.cpp in Sources */, - B2A58724143119D50092BFBA /* SBWatchpointLocation.cpp in Sources */, + B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3577,6 +3577,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -3613,6 +3614,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = ( __STDC_CONSTANT_MACROS, @@ -3646,7 +3648,6 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -3661,7 +3662,6 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks; INSTALL_PATH = /Developer/usr/bin; ONLY_ACTIVE_ARCH = NO; @@ -3673,7 +3673,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = /System/Library/PrivateFrameworks; INSTALL_PATH = /Developer/usr/bin; ONLY_ACTIVE_ARCH = NO; @@ -3687,7 +3686,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 80; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; @@ -3739,7 +3737,6 @@ COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 80; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; @@ -3826,7 +3823,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_CURRENT_VERSION = 80; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( @@ -3865,7 +3861,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_CURRENT_VERSION = 80; EXECUTABLE_EXTENSION = a; FRAMEWORK_SEARCH_PATHS = ( @@ -3904,6 +3899,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_PREPROCESSOR_DEFINITIONS = ( __STDC_CONSTANT_MACROS, @@ -3938,7 +3934,6 @@ buildSettings = { COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -3969,7 +3964,6 @@ COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 80; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 80; EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports"; @@ -4047,7 +4041,6 @@ CODE_SIGN_IDENTITY = lldb_codesign; COPY_PHASE_STRIP = YES; DEAD_CODE_STRIPPING = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4096,7 +4089,6 @@ buildSettings = { COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = dwarf; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", @@ -4127,7 +4119,6 @@ buildSettings = { COPY_PHASE_STRIP = YES; CURRENT_PROJECT_VERSION = 80; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"", Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Thu Oct 13 13:08:26 2011 @@ -86,7 +86,7 @@ launchStyle = "0" useCustomWorkingDirectory = "NO" customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach" - buildConfiguration = "Debug" + buildConfiguration = "Release" ignoresPersistentStateOnLaunch = "YES" debugDocumentVersioning = "YES" allowLocationSimulation = "YES"> Modified: lldb/trunk/scripts/Python/build-swig-Python.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/scripts/Python/build-swig-Python.sh (original) +++ lldb/trunk/scripts/Python/build-swig-Python.sh Thu Oct 13 13:08:26 2011 @@ -72,7 +72,7 @@ " ${SRC_ROOT}/include/lldb/API/SBType.h"\ " ${SRC_ROOT}/include/lldb/API/SBValue.h"\ " ${SRC_ROOT}/include/lldb/API/SBValueList.h"\ -" ${SRC_ROOT}/include/lldb/API/SBWatchpointLocation.h"\ +" ${SRC_ROOT}/include/lldb/API/SBWatchpoint.h"\ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBBlock.i"\ @@ -108,7 +108,7 @@ " ${SRC_ROOT}/scripts/Python/interface/SBType.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBValue.i"\ " ${SRC_ROOT}/scripts/Python/interface/SBValueList.i"\ -" ${SRC_ROOT}/scripts/Python/interface/SBWatchpointLocation.i" +" ${SRC_ROOT}/scripts/Python/interface/SBWatchpoint.i" if [ $Debug == 1 ] then Modified: lldb/trunk/scripts/Python/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBTarget.i (original) +++ lldb/trunk/scripts/Python/interface/SBTarget.i Thu Oct 13 13:08:26 2011 @@ -442,28 +442,32 @@ DeleteAllBreakpoints (); uint32_t - GetNumWatchpointLocations () const; - - lldb::SBWatchpointLocation - GetLastCreatedWatchpointLocation (); - - lldb::SBWatchpointLocation - GetWatchpointLocationAtIndex (uint32_t idx) const; - + GetNumWatchpoints () const; + + lldb::SBWatchpoint + GetWatchpointAtIndex (uint32_t idx) const; + bool - WatchpointLocationDelete (watch_id_t watch_id); - - lldb::SBWatchpointLocation - FindWatchpointLocationByID (watch_id_t watch_id); - + DeleteWatchpoint (lldb::watch_id_t watch_id); + + lldb::SBWatchpoint + FindWatchpointByID (lldb::watch_id_t watch_id); + bool - EnableAllWatchpointLocations (); - + EnableAllWatchpoints (); + bool - DisableAllWatchpointLocations (); - + DisableAllWatchpoints (); + bool - DeleteAllWatchpointLocations (); + DeleteAllWatchpoints (); + + lldb::SBWatchpoint + WatchAddress (lldb::addr_t addr, + size_t size, + bool read, + bool write); + lldb::SBBroadcaster GetBroadcaster () const; Modified: lldb/trunk/scripts/Python/interface/SBValue.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBValue.i (original) +++ lldb/trunk/scripts/Python/interface/SBValue.i Thu Oct 13 13:08:26 2011 @@ -278,6 +278,12 @@ lldb::SBFrame GetFrame(); + lldb::SBWatchpoint + Watch (bool resolve_location, bool read, bool write); + + lldb::SBWatchpoint + WatchPointee (bool resolve_location, bool read, bool write); + bool GetDescription (lldb::SBStream &description); Copied: lldb/trunk/scripts/Python/interface/SBWatchpoint.i (from r141866, lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBWatchpoint.i?p2=lldb/trunk/scripts/Python/interface/SBWatchpoint.i&p1=lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i&r1=141866&r2=141876&rev=141876&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i (original) +++ lldb/trunk/scripts/Python/interface/SBWatchpoint.i Thu Oct 13 13:08:26 2011 @@ -1,4 +1,4 @@ -//===-- SWIG Interface for SBWatchpointLocation -----------------*- C++ -*-===// +//===-- SWIG Interface for SBWatchpoint -----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -18,22 +18,22 @@ See also SBTarget.watchpoint_location_iter() for for example usage of iterating through the watchpoint locations of the target." -) SBWatchpointLocation; -class SBWatchpointLocation +) SBWatchpoint; +class SBWatchpoint { public: - SBWatchpointLocation (); + SBWatchpoint (); - SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs); + SBWatchpoint (const lldb::SBWatchpoint &rhs); - ~SBWatchpointLocation (); + ~SBWatchpoint (); watch_id_t - GetID () const; + GetID (); bool - IsValid() const; + IsValid(); %feature("docstring", " //------------------------------------------------------------------ @@ -41,13 +41,13 @@ //------------------------------------------------------------------ ") GetHardwareIndex; int32_t - GetHardwareIndex () const; + GetHardwareIndex (); lldb::addr_t - GetWatchAddress () const; + GetWatchAddress (); size_t - GetWatchSize() const; + GetWatchSize(); void SetEnabled(bool enabled); @@ -56,7 +56,7 @@ IsEnabled (); uint32_t - GetHitCount () const; + GetHitCount (); uint32_t GetIgnoreCount (); Removed: lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i?rev=141875&view=auto ============================================================================== --- lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i (original) +++ lldb/trunk/scripts/Python/interface/SBWatchpointLocation.i (removed) @@ -1,71 +0,0 @@ -//===-- SWIG Interface for SBWatchpointLocation -----------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -namespace lldb { - -%feature("docstring", -"Represents an instance of watchpoint location for a specific target program. - -A watchpoint location is determined by the address and the byte size that -resulted in this particular instantiation. Each watchpoint location has its -settable options. - -See also SBTarget.watchpoint_location_iter() for for example usage of iterating -through the watchpoint locations of the target." -) SBWatchpointLocation; -class SBWatchpointLocation -{ -public: - - SBWatchpointLocation (); - - SBWatchpointLocation (const lldb::SBWatchpointLocation &rhs); - - ~SBWatchpointLocation (); - - watch_id_t - GetID () const; - - bool - IsValid() const; - - %feature("docstring", " - //------------------------------------------------------------------ - /// With -1 representing an invalid hardware index. - //------------------------------------------------------------------ - ") GetHardwareIndex; - int32_t - GetHardwareIndex () const; - - lldb::addr_t - GetWatchAddress () const; - - size_t - GetWatchSize() const; - - void - SetEnabled(bool enabled); - - bool - IsEnabled (); - - uint32_t - GetHitCount () const; - - uint32_t - GetIgnoreCount (); - - void - SetIgnoreCount (uint32_t n); - - bool - GetDescription (lldb::SBStream &description, DescriptionLevel level); -}; - -} // namespace lldb Modified: lldb/trunk/scripts/Python/modify-python-lldb.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/scripts/Python/modify-python-lldb.py (original) +++ lldb/trunk/scripts/Python/modify-python-lldb.py Thu Oct 13 13:08:26 2011 @@ -236,7 +236,7 @@ # e = { 'SBAddress': ['GetFileAddress', 'GetModule'], 'SBBreakpoint': ['GetID'], - 'SBWatchpointLocation': ['GetID'], + 'SBWatchpoint': ['GetID'], 'SBFileSpec': ['GetFilename', 'GetDirectory'], 'SBModule': ['GetFileSpec', 'GetUUIDString'], 'SBType': ['GetByteSize', 'GetName'] Modified: lldb/trunk/scripts/Python/python-extensions.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/scripts/Python/python-extensions.swig (original) +++ lldb/trunk/scripts/Python/python-extensions.swig Thu Oct 13 13:08:26 2011 @@ -160,8 +160,8 @@ return PyString_FromString (description.GetData()); } } -%extend lldb::SBWatchpointLocation { - PyObject *lldb::SBWatchpointLocation::__repr__ (){ +%extend lldb::SBWatchpoint { + PyObject *lldb::SBWatchpoint::__repr__ (){ lldb::SBStream description; $self->GetDescription (description, lldb::eDescriptionLevelVerbose); return PyString_FromString (description.GetData()); Modified: lldb/trunk/scripts/lldb.swig URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/scripts/lldb.swig (original) +++ lldb/trunk/scripts/lldb.swig Thu Oct 13 13:08:26 2011 @@ -79,7 +79,7 @@ #include "lldb/API/SBType.h" #include "lldb/API/SBValue.h" #include "lldb/API/SBValueList.h" -#include "lldb/API/SBWatchpointLocation.h" +#include "lldb/API/SBWatchpoint.h" %} /* Various liblldb typedefs that SWIG needs to know about. */ @@ -132,7 +132,7 @@ %include "./Python/interface/SBType.i" %include "./Python/interface/SBValue.i" %include "./Python/interface/SBValueList.i" -%include "./Python/interface/SBWatchpointLocation.i" +%include "./Python/interface/SBWatchpoint.i" %include "./Python/python-extensions.swig" Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Thu Oct 13 13:08:26 2011 @@ -883,7 +883,7 @@ } uint32_t -SBTarget::GetNumWatchpointLocations () const +SBTarget::GetNumWatchpoints () const { if (m_opaque_sp) { @@ -893,31 +893,10 @@ return 0; } -SBWatchpointLocation -SBTarget::GetLastCreatedWatchpointLocation () +SBWatchpoint +SBTarget::GetWatchpointAtIndex (uint32_t idx) const { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - - SBWatchpointLocation sb_watchpoint_location; - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - sb_watchpoint_location = m_opaque_sp->GetLastCreatedWatchpointLocation(); - } - - if (log) - { - log->Printf ("SBTarget(%p)::GetLastCreateWatchpointLocation () => SBWatchpointLocation(%p)", - m_opaque_sp.get(), sb_watchpoint_location.get()); - } - - return sb_watchpoint_location; -} - -SBWatchpointLocation -SBTarget::GetWatchpointLocationAtIndex (uint32_t idx) const -{ - SBWatchpointLocation sb_watchpoint_location; + SBWatchpoint sb_watchpoint_location; if (m_opaque_sp) { // The watchpoint location list is thread safe, no need to lock @@ -927,7 +906,7 @@ } bool -SBTarget::WatchpointLocationDelete (watch_id_t wp_id) +SBTarget::DeleteWatchpoint (watch_id_t wp_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -946,29 +925,51 @@ return result; } -SBWatchpointLocation -SBTarget::FindWatchpointLocationByID (watch_id_t wp_id) +SBWatchpoint +SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - SBWatchpointLocation sb_watchpoint_location; + SBWatchpoint sb_watchpoint; if (m_opaque_sp && wp_id != LLDB_INVALID_WATCH_ID) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + *sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); } if (log) { - log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpointLocation(%p)", - m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint_location.get()); + log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpoint(%p)", + m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint.get()); } - return sb_watchpoint_location; + return sb_watchpoint; +} + +lldb::SBWatchpoint +SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write) +{ + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBWatchpoint sb_watchpoint; + if (m_opaque_sp) + { + Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); + // TODO: Johnny fill this in + //*sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + } + + if (log) + { + log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%llx, 0x%u) => SBWatchpoint(%p)", + m_opaque_sp.get(), addr, (uint32_t) size, sb_watchpoint.get()); + } + + return sb_watchpoint; } bool -SBTarget::EnableAllWatchpointLocations () +SBTarget::EnableAllWatchpoints () { if (m_opaque_sp) { @@ -980,7 +981,7 @@ } bool -SBTarget::DisableAllWatchpointLocations () +SBTarget::DisableAllWatchpoints () { if (m_opaque_sp) { @@ -992,7 +993,7 @@ } bool -SBTarget::DeleteAllWatchpointLocations () +SBTarget::DeleteAllWatchpoints () { if (m_opaque_sp) { Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=141876&r1=141875&r2=141876&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Thu Oct 13 13:08:26 2011 @@ -1097,3 +1097,31 @@ return sb_data; } + +lldb::SBWatchpoint +SBValue::Watch (bool resolve_location, bool read, bool write) +{ + lldb::SBWatchpoint sb_watchpoint; + Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); + if (target) + { + Mutex::Locker api_locker (target->GetAPIMutex()); + // TODO: Johnny fill this in + } + return sb_watchpoint; +} + +lldb::SBWatchpoint +SBValue::WatchPointee (bool resolve_location, bool read, bool write) +{ + lldb::SBWatchpoint sb_watchpoint; + Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); + if (target) + { + Mutex::Locker api_locker (target->GetAPIMutex()); + // TODO: Johnny fill this in + } + return sb_watchpoint; +} + + Copied: lldb/trunk/source/API/SBWatchpoint.cpp (from r141866, lldb/trunk/source/API/SBWatchpointLocation.cpp) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?p2=lldb/trunk/source/API/SBWatchpoint.cpp&p1=lldb/trunk/source/API/SBWatchpointLocation.cpp&r1=141866&r2=141876&rev=141876&view=diff ============================================================================== --- lldb/trunk/source/API/SBWatchpointLocation.cpp (original) +++ lldb/trunk/source/API/SBWatchpoint.cpp Thu Oct 13 13:08:26 2011 @@ -1,4 +1,4 @@ -//===-- SBWatchpointLocation.cpp --------------------------------*- C++ -*-===// +//===-- SBWatchpoint.cpp --------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/API/SBWatchpointLocation.h" +#include "lldb/API/SBWatchpoint.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBAddress.h" #include "lldb/API/SBDebugger.h" @@ -26,12 +26,12 @@ using namespace lldb_private; -SBWatchpointLocation::SBWatchpointLocation () : +SBWatchpoint::SBWatchpoint () : m_opaque_sp () { } -SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp) : +SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp) : m_opaque_sp (watch_loc_sp) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -40,18 +40,18 @@ { SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationsSP &watch_loc_sp" + log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationsSP &watch_loc_sp" "=%p) => this.sp = %p (%s)", watch_loc_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } -SBWatchpointLocation::SBWatchpointLocation(const SBWatchpointLocation &rhs) : +SBWatchpoint::SBWatchpoint(const SBWatchpoint &rhs) : m_opaque_sp (rhs.m_opaque_sp) { } -const SBWatchpointLocation & -SBWatchpointLocation::operator = (const SBWatchpointLocation &rhs) +const SBWatchpoint & +SBWatchpoint::operator = (const SBWatchpoint &rhs) { if (this != &rhs) m_opaque_sp = rhs.m_opaque_sp; @@ -59,12 +59,12 @@ } -SBWatchpointLocation::~SBWatchpointLocation () +SBWatchpoint::~SBWatchpoint () { } watch_id_t -SBWatchpointLocation::GetID () const +SBWatchpoint::GetID () { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -75,22 +75,41 @@ if (log) { if (watch_id == LLDB_INVALID_WATCH_ID) - log->Printf ("SBWatchpointLocation(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get()); + log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get()); else - log->Printf ("SBWatchpointLocation(%p)::GetID () => %u", m_opaque_sp.get(), watch_id); + log->Printf ("SBWatchpoint(%p)::GetID () => %u", m_opaque_sp.get(), watch_id); } return watch_id; } bool -SBWatchpointLocation::IsValid() const +SBWatchpoint::IsValid() const { return m_opaque_sp.get() != NULL; +#if 0 + if (m_opaque_sp) + return m_opaque_sp->GetError().Success(); + return false; +#endif +} + +SBError +SBWatchpoint::GetError () +{ + SBError sb_error; +#if 0 + if (m_opaque_sp) + { + // TODO: Johnny fill this in + sb_error.ref() = m_opaque_sp->GetError(); + } +#endif + return sb_error; } int32_t -SBWatchpointLocation::GetHardwareIndex () const +SBWatchpoint::GetHardwareIndex () { int32_t hw_index = -1; @@ -104,7 +123,7 @@ } addr_t -SBWatchpointLocation::GetWatchAddress () const +SBWatchpoint::GetWatchAddress () { addr_t ret_addr = LLDB_INVALID_ADDRESS; @@ -118,7 +137,7 @@ } size_t -SBWatchpointLocation::GetWatchSize () const +SBWatchpoint::GetWatchSize () { size_t watch_size = 0; @@ -132,7 +151,7 @@ } void -SBWatchpointLocation::SetEnabled (bool enabled) +SBWatchpoint::SetEnabled (bool enabled) { if (m_opaque_sp) { @@ -142,7 +161,7 @@ } bool -SBWatchpointLocation::IsEnabled () +SBWatchpoint::IsEnabled () { if (m_opaque_sp) { @@ -154,7 +173,7 @@ } uint32_t -SBWatchpointLocation::GetHitCount () const +SBWatchpoint::GetHitCount () { uint32_t count = 0; if (m_opaque_sp) @@ -165,13 +184,13 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBWatchpointLocation(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); + log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); return count; } uint32_t -SBWatchpointLocation::GetIgnoreCount () +SBWatchpoint::GetIgnoreCount () { if (m_opaque_sp) { @@ -183,7 +202,7 @@ } void -SBWatchpointLocation::SetIgnoreCount (uint32_t n) +SBWatchpoint::SetIgnoreCount (uint32_t n) { if (m_opaque_sp) { @@ -193,7 +212,7 @@ } bool -SBWatchpointLocation::GetDescription (SBStream &description, DescriptionLevel level) +SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level) { if (m_opaque_sp) { @@ -209,26 +228,19 @@ } lldb_private::WatchpointLocation * -SBWatchpointLocation::operator->() const +SBWatchpoint::operator->() { return m_opaque_sp.get(); } lldb_private::WatchpointLocation * -SBWatchpointLocation::get() const +SBWatchpoint::get() { return m_opaque_sp.get(); } lldb::WatchpointLocationSP & -SBWatchpointLocation::operator *() -{ - return m_opaque_sp; -} - -const lldb::WatchpointLocationSP & -SBWatchpointLocation::operator *() const +SBWatchpoint::operator *() { return m_opaque_sp; } - Removed: lldb/trunk/source/API/SBWatchpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpointLocation.cpp?rev=141875&view=auto ============================================================================== --- lldb/trunk/source/API/SBWatchpointLocation.cpp (original) +++ lldb/trunk/source/API/SBWatchpointLocation.cpp (removed) @@ -1,234 +0,0 @@ -//===-- SBWatchpointLocation.cpp --------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/API/SBWatchpointLocation.h" -#include "lldb/API/SBDefines.h" -#include "lldb/API/SBAddress.h" -#include "lldb/API/SBDebugger.h" -#include "lldb/API/SBStream.h" - -#include "lldb/lldb-types.h" -#include "lldb/lldb-defines.h" -#include "lldb/Breakpoint/WatchpointLocation.h" -#include "lldb/Breakpoint/WatchpointLocationList.h" -#include "lldb/Core/Log.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamFile.h" -#include "lldb/Target/Target.h" - -using namespace lldb; -using namespace lldb_private; - - -SBWatchpointLocation::SBWatchpointLocation () : - m_opaque_sp () -{ -} - -SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationSP &watch_loc_sp) : - m_opaque_sp (watch_loc_sp) -{ - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - - if (log) - { - SBStream sstr; - GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBWatchpointLocation::SBWatchpointLocation (const lldb::WatchpointLocationsSP &watch_loc_sp" - "=%p) => this.sp = %p (%s)", watch_loc_sp.get(), m_opaque_sp.get(), sstr.GetData()); - } -} - -SBWatchpointLocation::SBWatchpointLocation(const SBWatchpointLocation &rhs) : - m_opaque_sp (rhs.m_opaque_sp) -{ -} - -const SBWatchpointLocation & -SBWatchpointLocation::operator = (const SBWatchpointLocation &rhs) -{ - if (this != &rhs) - m_opaque_sp = rhs.m_opaque_sp; - return *this; -} - - -SBWatchpointLocation::~SBWatchpointLocation () -{ -} - -watch_id_t -SBWatchpointLocation::GetID () const -{ - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - - watch_id_t watch_id = LLDB_INVALID_WATCH_ID; - if (m_opaque_sp) - watch_id = m_opaque_sp->GetID(); - - if (log) - { - if (watch_id == LLDB_INVALID_WATCH_ID) - log->Printf ("SBWatchpointLocation(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get()); - else - log->Printf ("SBWatchpointLocation(%p)::GetID () => %u", m_opaque_sp.get(), watch_id); - } - - return watch_id; -} - -bool -SBWatchpointLocation::IsValid() const -{ - return m_opaque_sp.get() != NULL; -} - -int32_t -SBWatchpointLocation::GetHardwareIndex () const -{ - int32_t hw_index = -1; - - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - hw_index = m_opaque_sp->GetHardwareIndex(); - } - - return hw_index; -} - -addr_t -SBWatchpointLocation::GetWatchAddress () const -{ - addr_t ret_addr = LLDB_INVALID_ADDRESS; - - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - ret_addr = m_opaque_sp->GetLoadAddress(); - } - - return ret_addr; -} - -size_t -SBWatchpointLocation::GetWatchSize () const -{ - size_t watch_size = 0; - - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - watch_size = m_opaque_sp->GetByteSize(); - } - - return watch_size; -} - -void -SBWatchpointLocation::SetEnabled (bool enabled) -{ - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - m_opaque_sp->GetTarget().DisableWatchpointLocationByID(m_opaque_sp->GetID()); - } -} - -bool -SBWatchpointLocation::IsEnabled () -{ - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - return m_opaque_sp->IsEnabled(); - } - else - return false; -} - -uint32_t -SBWatchpointLocation::GetHitCount () const -{ - uint32_t count = 0; - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - count = m_opaque_sp->GetHitCount(); - } - - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - if (log) - log->Printf ("SBWatchpointLocation(%p)::GetHitCount () => %u", m_opaque_sp.get(), count); - - return count; -} - -uint32_t -SBWatchpointLocation::GetIgnoreCount () -{ - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - return m_opaque_sp->GetIgnoreCount(); - } - else - return 0; -} - -void -SBWatchpointLocation::SetIgnoreCount (uint32_t n) -{ - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - m_opaque_sp->SetIgnoreCount (n); - } -} - -bool -SBWatchpointLocation::GetDescription (SBStream &description, DescriptionLevel level) -{ - if (m_opaque_sp) - { - Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - description.ref(); - m_opaque_sp->GetDescription (description.get(), level); - description.get()->EOL(); - } - else - description.Printf ("No value"); - - return true; -} - -lldb_private::WatchpointLocation * -SBWatchpointLocation::operator->() const -{ - return m_opaque_sp.get(); -} - -lldb_private::WatchpointLocation * -SBWatchpointLocation::get() const -{ - return m_opaque_sp.get(); -} - -lldb::WatchpointLocationSP & -SBWatchpointLocation::operator *() -{ - return m_opaque_sp; -} - -const lldb::WatchpointLocationSP & -SBWatchpointLocation::operator *() const -{ - return m_opaque_sp; -} - From gclayton at apple.com Thu Oct 13 13:31:02 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 18:31:02 -0000 Subject: [Lldb-commits] [lldb] r141879 - /lldb/trunk/source/Commands/CommandObjectTarget.cpp Message-ID: <20111013183102.AFF5C312800A@llvm.org> Author: gclayton Date: Thu Oct 13 13:31:02 2011 New Revision: 141879 URL: http://llvm.org/viewvc/llvm-project?rev=141879&view=rev Log: Revert the change to "target variable" that was causing test suite failures. Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=141879&r1=141878&r2=141879&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Oct 13 13:31:02 2011 @@ -684,7 +684,7 @@ valobj_sp = ValueObjectVariable::Create (exe_ctx.GetBestExecutionContextScope(), var_sp); if (valobj_sp) - DumpValueObject (s, var_sp, valobj_sp, var_sp->GetName().GetCString()); + DumpValueObject (s, var_sp, valobj_sp, use_var_name ? var_sp->GetName().GetCString() : arg); } } } From scallanan at apple.com Thu Oct 13 16:08:11 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 13 Oct 2011 21:08:11 -0000 Subject: [Lldb-commits] [lldb] r141888 - in /lldb/trunk: include/lldb/Expression/ClangASTSource.h include/lldb/Symbol/ClangASTImporter.h source/Expression/ClangExpressionDeclMap.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20111013210811.791152A6C12C@llvm.org> Author: spyffe Date: Thu Oct 13 16:08:11 2011 New Revision: 141888 URL: http://llvm.org/viewvc/llvm-project?rev=141888&view=rev Log: Moved the list of found namespaces into the search context object. Having it populated and registered within a single FindExternalVisibleDecls call worked fine when there was only one call (i.e., when we were just looking in the global namespace). However, now FindExternalVisibleDecls is called for nested namespaces as well, which means that it is called not once but many times (once per module in which the parent namespace appears). This means that the namespace mapping is built up across many calls to the inferior FindExternalVisibleDecls, so I moved it into a data structure (the search context) that is shared by all calls. I also added some logging to make it easier to see what is happening during a namespace search, and cleaned up some existing logging. Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h lldb/trunk/include/lldb/Symbol/ClangASTImporter.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=141888&r1=141887&r2=141888&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original) +++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Thu Oct 13 16:08:11 2011 @@ -14,6 +14,7 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/AST/ExternalASTSource.h" +#include "lldb/Symbol/ClangASTImporter.h" namespace lldb_private { @@ -182,6 +183,7 @@ struct NameSearchContext { ClangASTSource &m_ast_source; ///< The AST source making the request llvm::SmallVectorImpl &m_decls; ///< The list of declarations already constructed + ClangASTImporter::NamespaceMapSP m_namespace_map; ///< The mapping of all namespaces found for this request back to their modules const clang::DeclarationName &m_decl_name; ///< The name being looked for const clang::DeclContext *m_decl_context; ///< The DeclContext to put declarations into Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=141888&r1=141887&r2=141888&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Thu Oct 13 16:08:11 2011 @@ -63,7 +63,7 @@ return origin.Valid(); } - typedef std::map NamespaceMap; + typedef std::vector < std::pair > NamespaceMap; typedef lldb::SharedPtr::Type NamespaceMapSP; void RegisterNamespaceMap(const clang::NamespaceDecl *decl, Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141888&r1=141887&r2=141888&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Oct 13 16:08:11 2011 @@ -2051,17 +2051,22 @@ else log->Printf("FindExternalVisibleDecls for '%s' in a '%s'", name.GetCString(), context.m_decl_context->getDeclKindName()); } + + context.m_namespace_map.reset(new ClangASTImporter::NamespaceMap); if (const NamespaceDecl *namespace_context = dyn_cast(context.m_decl_context)) { ClangASTImporter::NamespaceMapSP namespace_map = m_parser_vars->m_ast_importer->GetNamespaceMap(namespace_context); - + + if (log) + log->Printf("Inspecting namespace map %p (%d entries)", namespace_map.get(), (int)namespace_map->size()); + for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e; ++i) { if (log) - log->Printf(" Searching namespace '%s' in file '%s'", + log->Printf(" Searching namespace %s in module %s", i->second.GetNamespaceDecl()->getNameAsString().c_str(), i->first->GetFileSpec().GetFilename().GetCString()); @@ -2088,6 +2093,17 @@ namespace_decl, name); } + + if (!context.m_namespace_map->empty()) + { + if (log) + log->Printf("Registering namespace map %p (%d entries)", context.m_namespace_map.get(), (int)context.m_namespace_map->size()); + + NamespaceDecl *clang_namespace_decl = AddNamespace(context, context.m_namespace_map); + + if (clang_namespace_decl) + clang_namespace_decl->setHasExternalVisibleStorage(); + } } void @@ -2410,52 +2426,63 @@ } } - ModuleList &images = m_parser_vars->m_sym_ctx.target_sp->GetImages(); - - ClangASTImporter::NamespaceMapSP namespace_decls(new ClangASTImporter::NamespaceMap); - - for (uint32_t i = 0, e = images.GetSize(); - i != e; - ++i) + if (module_sp && namespace_decl) { - ModuleSP image = images.GetModuleAtIndex(i); - - if (!image) - continue; - - ClangNamespaceDecl namespace_decl; - - SymbolVendor *symbol_vendor = image->GetSymbolVendor(); - - if (!symbol_vendor) - continue; + ClangNamespaceDecl found_namespace_decl; - SymbolContext null_sc; + SymbolVendor *symbol_vendor = module_sp->GetSymbolVendor(); - namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &namespace_decl); - - if (namespace_decl) + if (symbol_vendor) { - (*namespace_decls)[image] = namespace_decl; + SymbolContext null_sc; - if (log) - { - std::string s; - llvm::raw_string_ostream os(s); - namespace_decl.GetNamespaceDecl()->print(os); - os.flush(); + found_namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &namespace_decl); + + if (found_namespace_decl) + { + context.m_namespace_map->push_back(std::pair(module_sp, found_namespace_decl)); - log->Printf("Found namespace %s in file %s", s.c_str(), image->GetFileSpec().GetFilename().GetCString()); + if (log) + log->Printf("Found namespace %s in module %s", + name.GetCString(), + module_sp->GetFileSpec().GetFilename().GetCString()); } } } - - if (!namespace_decls->empty()) + else { - NamespaceDecl *clang_namespace_decl = AddNamespace(context, namespace_decls); - - if (clang_namespace_decl) - clang_namespace_decl->setHasExternalVisibleStorage(); + ModuleList &images = m_parser_vars->m_sym_ctx.target_sp->GetImages(); + + for (uint32_t i = 0, e = images.GetSize(); + i != e; + ++i) + { + ModuleSP image = images.GetModuleAtIndex(i); + + if (!image) + continue; + + ClangNamespaceDecl found_namespace_decl; + + SymbolVendor *symbol_vendor = image->GetSymbolVendor(); + + if (!symbol_vendor) + continue; + + SymbolContext null_sc; + + found_namespace_decl = symbol_vendor->FindNamespace(null_sc, name, &namespace_decl); + + if (found_namespace_decl) + { + context.m_namespace_map->push_back(std::pair(image, found_namespace_decl)); + + if (log) + log->Printf("Found namespace %s in module %s", + name.GetCString(), + image->GetFileSpec().GetFilename().GetCString()); + } + } } } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141888&r1=141887&r2=141888&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Oct 13 16:08:11 2011 @@ -1966,6 +1966,11 @@ return true; // The ASTs match, return true // The namespace AST was valid, and it does not match... + LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); + + if (log) + log->Printf("Valid namespace does not match symbol file"); + return false; } @@ -2693,7 +2698,7 @@ if (log) { - log->Printf ("SymbolFileDWARF::FindFunctions (file=\"%s/%s\", sc, name=\"%s\", append=%u, max_matches=%u, type_list)", + log->Printf ("SymbolFileDWARF::FindTypes (file=\"%s/%s\", sc, name=\"%s\", append=%u, max_matches=%u, type_list)", m_obj_file->GetFileSpec().GetDirectory().GetCString(), m_obj_file->GetFileSpec().GetFilename().GetCString(), name.GetCString(), append, max_matches); From scallanan at apple.com Thu Oct 13 16:50:33 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 13 Oct 2011 21:50:33 -0000 Subject: [Lldb-commits] [lldb] r141894 - in /lldb/trunk/source: Expression/ClangExpressionDeclMap.cpp Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Message-ID: <20111013215033.5CDFD312800A@llvm.org> Author: spyffe Date: Thu Oct 13 16:50:33 2011 New Revision: 141894 URL: http://llvm.org/viewvc/llvm-project?rev=141894&view=rev Log: Enabled the namespace-specific search functionality, which had previously been commented out while I tested it. It's not fully working yet, but it doesn't break our testsuite and it's an important piece of functionality. Also added some logging to SymbolFileDWARF to help diagnose entities that are found in a symbol file, but do not reside in the expected namespace. Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141894&r1=141893&r2=141894&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Oct 13 16:50:33 2011 @@ -2070,10 +2070,10 @@ i->second.GetNamespaceDecl()->getNameAsString().c_str(), i->first->GetFileSpec().GetFilename().GetCString()); - //FindExternalVisibleDecls(context, - // i->first, - // i->second, - // name); + FindExternalVisibleDecls(context, + i->first, + i->second, + name); } } else if (!isa(context.m_decl_context)) Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141894&r1=141893&r2=141894&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Oct 13 16:50:33 2011 @@ -1982,6 +1982,8 @@ // No namespace specified, so the answesr i if (namespace_decl == NULL) return true; + + LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die); if (decl_ctx_die) @@ -1991,12 +1993,21 @@ if (clang_namespace_decl) { if (decl_ctx_die->Tag() != DW_TAG_namespace) + { + if (log) + log->Printf("Found a match, but its parent is not a namespace"); return false; - + } + DeclContextToDIEMap::iterator pos = m_decl_ctx_to_die.find(clang_namespace_decl); if (pos == m_decl_ctx_to_die.end()) + { + if (log) + log->Printf("Found a match in a namespace, but its parent is not the requested namespace"); + return false; + } return decl_ctx_die == pos->second; } @@ -2010,6 +2021,10 @@ return true; } } + + if (log) + log->Printf("Found a match, but its parent doesn't exist"); + return false; } uint32_t From scallanan at apple.com Thu Oct 13 17:18:56 2011 From: scallanan at apple.com (Sean Callanan) Date: Thu, 13 Oct 2011 22:18:56 -0000 Subject: [Lldb-commits] [lldb] r141899 - in /lldb/trunk: include/lldb/Symbol/SymbolContext.h source/Expression/ClangExpressionDeclMap.cpp source/Symbol/SymbolContext.cpp Message-ID: <20111013221856.9A7BC312800A@llvm.org> Author: spyffe Date: Thu Oct 13 17:18:56 2011 New Revision: 141899 URL: http://llvm.org/viewvc/llvm-project?rev=141899&view=rev Log: Cleaned up a few functions that never get used. Specifically, the expression parser used to use functions attached to SymbolContext to do lookups, but nowadays it searches a ModuleList or Module directly instead. These functions had no remaining clients so I removed them to prevent bit rot. I also removed a stray callback function from ClangExpressionDeclMap. Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Symbol/SymbolContext.cpp Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=141899&r1=141898&r2=141899&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Thu Oct 13 17:18:56 2011 @@ -220,54 +220,6 @@ uint32_t GetResolvedMask () const; - - //------------------------------------------------------------------ - /// Find a function matching the given name, working out from this - /// symbol context. - /// - /// @return - /// The number of symbol contexts found. - //------------------------------------------------------------------ - size_t - FindFunctionsByName (const ConstString &name, - uint32_t name_type_mask, - bool include_symbols, - bool append, - SymbolContextList &sc_list) const; - - - ClangNamespaceDecl - FindNamespace (const ConstString &name) const; - - //------------------------------------------------------------------ - /// Find a variable matching the given name, working out from this - /// symbol context. - /// - /// @return - /// A shared pointer to the variable found. - //------------------------------------------------------------------ - //lldb::VariableSP - //FindVariableByName (const char *name) const; - - //------------------------------------------------------------------ - /// Find a type matching the given name, working out from this - /// symbol context. - /// - /// @return - /// A shared pointer to the variable found. - //------------------------------------------------------------------ - lldb::TypeSP - FindTypeByName (const ConstString &name) const; - -// static SymbolContext -// CreateSymbolContextFromDescription (lldb::TargetSP &target, -// const char *module, -// const char *comp_unit, -// const char *function, -// const char *block_spec -// const char *line_number, -// const char *symbol); - //------------------------------------------------------------------ /// Find a name of the innermost function for the symbol context. /// Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141899&r1=141898&r2=141899&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Oct 13 17:18:56 2011 @@ -1970,23 +1970,6 @@ return NULL; } -// This is a callback used with Variable::GetValuesForVariableExpressionPath - -static uint32_t GetVariableCallback (void *baton, - const char *name, - VariableList &variable_list) -{ - Target *target = static_cast(baton); - if (target) - { - return target->GetImages().FindGlobalVariables (ConstString(name), - true, - UINT32_MAX, - variable_list); - } - return 0; -} - lldb::VariableSP ClangExpressionDeclMap::FindGlobalVariable ( Modified: lldb/trunk/source/Symbol/SymbolContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=141899&r1=141898&r2=141899&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp (original) +++ lldb/trunk/source/Symbol/SymbolContext.cpp Thu Oct 13 17:18:56 2011 @@ -452,83 +452,6 @@ return false; } -ClangNamespaceDecl -SymbolContext::FindNamespace (const ConstString &name) const -{ - ClangNamespaceDecl namespace_decl; - if (module_sp) - namespace_decl = module_sp->GetSymbolVendor()->FindNamespace (*this, name, NULL); - return namespace_decl; -} - -size_t -SymbolContext::FindFunctionsByName (const ConstString &name, - uint32_t name_type_mask, - bool include_symbols, - bool append, - SymbolContextList &sc_list) const -{ - if (!append) - sc_list.Clear(); - uint32_t old_size = sc_list.GetSize(); - - if (function != NULL) - { - // FIXME: Look in the class of the current function, if it exists, - // for methods matching name. - } - - if (module_sp) - module_sp->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list); - - if (target_sp) - { - if (!module_sp) - { - target_sp->GetImages().FindFunctions (name, name_type_mask, include_symbols, true, sc_list); - } - else - { - ModuleList &modules = target_sp->GetImages(); - uint32_t num_modules = modules.GetSize(); - for (uint32_t i = 0; i < num_modules; i++) - { - ModuleSP iter_module_sp = modules.GetModuleAtIndex(i); - if (module_sp != iter_module_sp) - iter_module_sp->FindFunctions (name, NULL, name_type_mask, include_symbols, true, sc_list); - } - } - } - return sc_list.GetSize() - old_size; -} - -//lldb::VariableSP -//SymbolContext::FindVariableByName (const char *name) const -//{ -// lldb::VariableSP return_value; -// return return_value; -//} - -lldb::TypeSP -SymbolContext::FindTypeByName (const ConstString &name) const -{ - lldb::TypeSP return_value; - - TypeList types; - - if (module_sp && module_sp->FindTypes (*this, name, NULL, false, 1, types)) - return types.GetTypeAtIndex(0); - - SymbolContext sc_for_global_search; - - sc_for_global_search.target_sp = target_sp; - - if (!return_value.get() && target_sp && target_sp->GetImages().FindTypes (sc_for_global_search, name, false, 1, types)) - return types.GetTypeAtIndex(0); - - return return_value; -} - bool SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, SymbolContext &next_frame_sc, From gclayton at apple.com Thu Oct 13 18:13:20 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 23:13:20 -0000 Subject: [Lldb-commits] [lldb] r141908 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Commands/CommandObjectTarget.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp Message-ID: <20111013231320.D63F82A6C12C@llvm.org> Author: gclayton Date: Thu Oct 13 18:13:20 2011 New Revision: 141908 URL: http://llvm.org/viewvc/llvm-project?rev=141908&view=rev Log: Fixed a case where we might end up trying to parse a type in the DWARF parser for a method whose class isn't currently in the process of completing itself. Currently, methods of a class, must be parsed when the class type that contains the method is asked to complete itself through the clang::ExternalASTSource virtual functions. Now we "do the right thing" by checking if the class is being defined, and if so we parse it, else we tell the class to complete itself so everything happens correctly. Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=141908&r1=141907&r2=141908&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Oct 13 18:13:20 2011 @@ -722,6 +722,9 @@ IsCXXClassType (lldb::clang_type_t clang_type); static bool + IsBeingDefined (lldb::clang_type_t clang_type); + + static bool IsObjCClassType (lldb::clang_type_t clang_type); static bool Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=141908&r1=141907&r2=141908&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Oct 13 18:13:20 2011 @@ -658,11 +658,6 @@ target, variable_list, valobj_list)); - -// matches = target->GetImages().FindGlobalVariables (ConstString(arg), -// true, -// UINT32_MAX, -// variable_list); matches = variable_list.GetSize(); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141908&r1=141907&r2=141908&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Oct 13 18:13:20 2011 @@ -34,6 +34,8 @@ #include "lldb/Core/Timer.h" #include "lldb/Core/Value.h" +#include "lldb/Host/Host.h" + #include "lldb/Symbol/Block.h" #include "lldb/Symbol/ClangExternalASTSourceCallbacks.h" #include "lldb/Symbol/CompileUnit.h" @@ -4275,32 +4277,67 @@ clang_type_t class_opaque_type = class_type->GetClangForwardType(); if (ClangASTContext::IsCXXClassType (class_opaque_type)) { - // Neither GCC 4.2 nor clang++ currently set a valid accessibility - // in the DWARF for C++ methods... Default to public for now... - if (accessibility == eAccessNone) - accessibility = eAccessPublic; - - if (!is_static && !die->HasChildren()) + if (ClangASTContext::IsBeingDefined (class_opaque_type)) { - // We have a C++ member function with no children (this pointer!) - // and clang will get mad if we try and make a function that isn't - // well formed in the DWARF, so we will just skip it... - type_handled = true; + // Neither GCC 4.2 nor clang++ currently set a valid accessibility + // in the DWARF for C++ methods... Default to public for now... + if (accessibility == eAccessNone) + accessibility = eAccessPublic; + + if (!is_static && !die->HasChildren()) + { + // We have a C++ member function with no children (this pointer!) + // and clang will get mad if we try and make a function that isn't + // well formed in the DWARF, so we will just skip it... + type_handled = true; + } + else + { + clang::CXXMethodDecl *cxx_method_decl; + // REMOVE THE CRASH DESCRIPTION BELOW + Host::SetCrashDescriptionWithFormat ("SymbolFileDWARF::ParseType() is adding a method %s to class %s in DIE 0x%8.8x from %s/%s", + type_name_cstr, + class_type->GetName().GetCString(), + die->GetOffset(), + m_obj_file->GetFileSpec().GetDirectory().GetCString(), + m_obj_file->GetFileSpec().GetFilename().GetCString()); + + cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type, + type_name_cstr, + clang_type, + accessibility, + is_virtual, + is_static, + is_inline, + is_explicit); + LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die); + + type_handled = cxx_method_decl != NULL; + } } else { - clang::CXXMethodDecl *cxx_method_decl; - cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type, - type_name_cstr, - clang_type, - accessibility, - is_virtual, - is_static, - is_inline, - is_explicit); - LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die); - - type_handled = cxx_method_decl != NULL; + // We were asked to parse the type for a method in a class, yet the + // class hasn't been asked to complete itself through the + // clang::ExternalASTSource protocol, so we need to just have the + // class complete itself and do things the right way, then our + // DIE should then have an entry in the m_die_to_type map. First + // we need to modify the m_die_to_type so it doesn't think we are + // trying to parse this DIE anymore... + m_die_to_type[die] = NULL; + + // Now we get the full type to force our class type to complete itself + // using the clang::ExternalASTSource protocol which will parse all + // base classes and all methods (including the method for this DIE). + class_type->GetClangFullType(); + + // The type for this DIE should have been filled in the function call above + type_ptr = m_die_to_type[die]; + if (type_ptr) + { + type_sp = type_list->FindType(type_ptr->GetID()); + break; + } } } } Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=141908&r1=141907&r2=141908&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Oct 13 18:13:20 2011 @@ -4998,6 +4998,19 @@ return false; } +bool +ClangASTContext::IsBeingDefined (lldb::clang_type_t clang_type) +{ + if (clang_type) + { + QualType qual_type (QualType::getFromOpaquePtr(clang_type)); + const clang::TagType *tag_type = dyn_cast(qual_type); + if (tag_type) + return tag_type->isBeingDefined(); + } + return false; +} + bool ClangASTContext::IsObjCClassType (clang_type_t clang_type) { From gclayton at apple.com Thu Oct 13 18:49:28 2011 From: gclayton at apple.com (Greg Clayton) Date: Thu, 13 Oct 2011 23:49:28 -0000 Subject: [Lldb-commits] [lldb] r141917 - in /lldb/trunk/source/Plugins/SymbolFile/DWARF: SymbolFileDWARF.cpp SymbolFileDWARF.h Message-ID: <20111013234928.5B08E2A6C12C@llvm.org> Author: gclayton Date: Thu Oct 13 18:49:28 2011 New Revision: 141917 URL: http://llvm.org/viewvc/llvm-project?rev=141917&view=rev Log: Modified the DWARF parser to take care of a 1 clang::DeclContext to many DIEs. Prior to this fix, there was a 1 to 1 mapping. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=141917&r1=141916&r2=141917&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Oct 13 18:49:28 2011 @@ -1376,7 +1376,7 @@ DWARFCompileUnitSP cu_sp; const DWARFDebugInfoEntry* die = debug_info->GetDIEPtr(type_uid, &cu_sp); if (die) - return GetClangDeclContextContainingDIE (cu_sp.get(), die); + return GetClangDeclContextContainingDIE (cu_sp.get(), die, NULL); } return NULL; } @@ -2011,7 +2011,7 @@ return false; } - return decl_ctx_die == pos->second; + return pos->second.count (decl_ctx_die); } else { @@ -3288,7 +3288,7 @@ { DWARFCompileUnitSP cu_sp; const DWARFDebugInfoEntry* die = DebugInfo()->GetDIEPtr(die_offset, &cu_sp); - return GetClangDeclContextContainingDIE (cu_sp.get(), die); + return GetClangDeclContextContainingDIE (cu_sp.get(), die, NULL); } return NULL; } @@ -3319,7 +3319,7 @@ if (namespace_name) { Declaration decl; // TODO: fill in the decl object - clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (curr_cu, die->GetParent())); + clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (curr_cu, die->GetParent(), NULL)); if (namespace_decl) LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die); return namespace_decl; @@ -3354,15 +3354,19 @@ } clang::DeclContext * -SymbolFileDWARF::GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die) +SymbolFileDWARF::GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die, const DWARFDebugInfoEntry **decl_ctx_die_copy) { if (m_clang_tu_decl == NULL) m_clang_tu_decl = GetClangASTContext().getASTContext()->getTranslationUnitDecl(); const DWARFDebugInfoEntry *decl_ctx_die = GetDeclContextDIEContainingDIE (cu, die); + + if (decl_ctx_die_copy) + *decl_ctx_die_copy = decl_ctx_die; if (decl_ctx_die) { + DIEToDeclContextMap::iterator pos = m_die_to_decl_ctx.find (decl_ctx_die); if (pos != m_die_to_decl_ctx.end()) return pos->second; @@ -3378,7 +3382,7 @@ if (namespace_name) { Declaration decl; // TODO: fill in the decl object - clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (cu, decl_ctx_die)); + clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (cu, decl_ctx_die, NULL)); if (namespace_decl) LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, decl_ctx_die); return namespace_decl; @@ -3864,7 +3868,7 @@ clang_type_was_created = true; clang_type = ast.CreateRecordType (type_name_cstr, tag_decl_kind, - GetClangDeclContextContainingDIE (dwarf_cu, die), + GetClangDeclContextContainingDIE (dwarf_cu, die, NULL), class_language); } @@ -3972,7 +3976,7 @@ DW_ATE_signed, byte_size * 8); clang_type = ast.CreateEnumerationType (type_name_cstr, - GetClangDeclContextContainingDIE (dwarf_cu, die), + GetClangDeclContextContainingDIE (dwarf_cu, die, NULL), decl, enumerator_clang_type); } @@ -4135,7 +4139,8 @@ // Parse the function children for the parameters - clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die); + const DWARFDebugInfoEntry *decl_ctx_die = NULL; + clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (dwarf_cu, die, &decl_ctx_die); const clang::Decl::Kind containing_decl_kind = containing_decl_ctx->getDeclKind(); const bool is_cxx_method = containing_decl_kind == clang::Decl::CXXRecord; @@ -4222,7 +4227,7 @@ // Look at the parent of this DIE and see if is is // a class or struct and see if this is actually a // C++ method - Type *class_type = ResolveType (dwarf_cu, m_decl_ctx_to_die[containing_decl_ctx]); + Type *class_type = ResolveType (dwarf_cu, decl_ctx_die); if (class_type) { if (specification_die_offset != DW_INVALID_OFFSET) @@ -5174,43 +5179,46 @@ if (iter == m_decl_ctx_to_die.end()) return; - const DWARFDebugInfoEntry *context_die = iter->second; - - if (!results) - return; - - DWARFDebugInfo* info = DebugInfo(); - - DIEArray die_offsets; - - DWARFCompileUnit* dwarf_cu = NULL; - const DWARFDebugInfoEntry* die = NULL; - size_t num_matches = m_type_index.Find (ConstString(name), die_offsets); - - if (num_matches) + for (DIEPointerSet::iterator pos = iter->second.begin(), end = iter->second.end(); pos != end; ++pos) { - for (size_t i = 0; i < num_matches; ++i) + const DWARFDebugInfoEntry *context_die = *pos; + + if (!results) + return; + + DWARFDebugInfo* info = DebugInfo(); + + DIEArray die_offsets; + + DWARFCompileUnit* dwarf_cu = NULL; + const DWARFDebugInfoEntry* die = NULL; + size_t num_matches = m_type_index.Find (ConstString(name), die_offsets); + + if (num_matches) { - const dw_offset_t die_offset = die_offsets[i]; - die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu); - - if (die->GetParent() != context_die) - continue; - - Type *matching_type = ResolveType (dwarf_cu, die); - - lldb::clang_type_t type = matching_type->GetClangFullType(); - clang::QualType qual_type = clang::QualType::getFromOpaquePtr(type); - - if (const clang::TagType *tag_type = llvm::dyn_cast(qual_type.getTypePtr())) - { - clang::TagDecl *tag_decl = tag_type->getDecl(); - results->push_back(tag_decl); - } - else if (const clang::TypedefType *typedef_type = llvm::dyn_cast(qual_type.getTypePtr())) + for (size_t i = 0; i < num_matches; ++i) { - clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl(); - results->push_back(typedef_decl); + const dw_offset_t die_offset = die_offsets[i]; + die = info->GetDIEPtrWithCompileUnitHint (die_offset, &dwarf_cu); + + if (die->GetParent() != context_die) + continue; + + Type *matching_type = ResolveType (dwarf_cu, die); + + lldb::clang_type_t type = matching_type->GetClangFullType(); + clang::QualType qual_type = clang::QualType::getFromOpaquePtr(type); + + if (const clang::TagType *tag_type = llvm::dyn_cast(qual_type.getTypePtr())) + { + clang::TagDecl *tag_decl = tag_type->getDecl(); + results->push_back(tag_decl); + } + else if (const clang::TypedefType *typedef_type = llvm::dyn_cast(qual_type.getTypePtr())) + { + clang::TypedefNameDecl *typedef_decl = typedef_type->getDecl(); + results->push_back(typedef_decl); + } } } } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=141917&r1=141916&r2=141917&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Thu Oct 13 18:49:28 2011 @@ -20,6 +20,7 @@ // Other libraries and framework includes #include "clang/AST/ExternalASTSource.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallPtrSet.h" #include "lldb/Core/ClangForward.h" #include "lldb/Core/ConstString.h" @@ -204,7 +205,9 @@ GetClangDeclContextForDIEOffset (const lldb_private::SymbolContext &sc, dw_offset_t die_offset); clang::DeclContext * - GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, const DWARFDebugInfoEntry *die); + GetClangDeclContextContainingDIE (DWARFCompileUnit *cu, + const DWARFDebugInfoEntry *die, + const DWARFDebugInfoEntry **decl_ctx_die); clang::DeclContext * GetClangDeclContextContainingDIEOffset (dw_offset_t die_offset); @@ -403,7 +406,8 @@ const DWARFDebugInfoEntry *die) { m_die_to_decl_ctx[die] = decl_ctx; - m_decl_ctx_to_die[decl_ctx] = die; + // There can be many DIEs for a single decl context + m_decl_ctx_to_die[decl_ctx].insert(die); } void @@ -448,8 +452,9 @@ std::auto_ptr m_ranges; UniqueDWARFASTTypeMap m_unique_ast_type_map; + typedef llvm::SmallPtrSet DIEPointerSet; typedef llvm::DenseMap DIEToDeclContextMap; - typedef llvm::DenseMap DeclContextToDIEMap; + typedef llvm::DenseMap DeclContextToDIEMap; typedef llvm::DenseMap DIEToTypePtr; typedef llvm::DenseMap DIEToVariableSP; typedef llvm::DenseMap DIEToClangType; From johnny.chen at apple.com Thu Oct 13 19:42:25 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 14 Oct 2011 00:42:25 -0000 Subject: [Lldb-commits] [lldb] r141925 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Breakpoint/ include/lldb/Target/ lldb.xcodeproj/ scripts/Python/ scripts/Python/interface/ source/API/ source/Breakpoint/ source/Commands/ source/Plugins/Process/MacOSX-Kernel/ source/Plugins/Process/Utility/ source/Plugins/Process/gdb-remote/ source/Target/ test/ test/python_api/default-constructor/ test/python_api/watchpoint/ test/python_api/watchpoint/watchlocation/ Message-ID: <20111014004226.536D0312800A@llvm.org> Author: johnny Date: Thu Oct 13 19:42:25 2011 New Revision: 141925 URL: http://llvm.org/viewvc/llvm-project?rev=141925&view=rev Log: SBValue::Watch() and SBValue::WatchPointee() are now the official API for creating a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee encapsulated by SBValue (WatchPointee). Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that. Modified the watchpoint related test suite to reflect the change. Plus replacing WatchpointLocation with Watchpoint throughout the code base. There are still cleanups to be dome. This patch passes the whole test suite. Check it in so that we aggressively catch regressions. Added: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h - copied, changed from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h lldb/trunk/include/lldb/Breakpoint/WatchpointList.h - copied, changed from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h lldb/trunk/source/Breakpoint/Watchpoint.cpp - copied, changed from r141877, lldb/trunk/source/Breakpoint/WatchpointLocation.cpp lldb/trunk/source/Breakpoint/WatchpointList.cpp - copied, changed from r141877, lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py - copied unchanged from r141917, lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py - copied, changed from r141905, lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py Removed: lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h lldb/trunk/source/Breakpoint/WatchpointLocation.cpp lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py Modified: lldb/trunk/include/lldb/API/SBFrame.h lldb/trunk/include/lldb/API/SBValue.h lldb/trunk/include/lldb/API/SBWatchpoint.h lldb/trunk/include/lldb/Target/Process.h lldb/trunk/include/lldb/Target/Target.h lldb/trunk/include/lldb/lldb-forward-rtti.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Python/interface/SBFrame.i lldb/trunk/scripts/Python/interface/SBTarget.i lldb/trunk/scripts/Python/interface/SBValue.i lldb/trunk/scripts/Python/interface/SBWatchpoint.i lldb/trunk/scripts/Python/modify-python-lldb.py lldb/trunk/source/API/SBFrame.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/API/SBValue.cpp lldb/trunk/source/API/SBWatchpoint.cpp lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/StopInfo.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/test/lldbutil.py lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py lldb/trunk/test/python_api/default-constructor/sb_frame.py lldb/trunk/test/python_api/default-constructor/sb_target.py lldb/trunk/test/python_api/default-constructor/sb_value.py lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Modified: lldb/trunk/include/lldb/API/SBFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFrame.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBFrame.h (original) +++ lldb/trunk/include/lldb/API/SBFrame.h Thu Oct 13 19:42:25 2011 @@ -12,6 +12,7 @@ #include "lldb/API/SBDefines.h" #include "lldb/API/SBValueList.h" +#include "lldb/API/SBWatchpoint.h" namespace lldb { @@ -220,7 +221,6 @@ #endif - void SetFrame (const lldb::StackFrameSP &lldb_object_sp); Modified: lldb/trunk/include/lldb/API/SBValue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBValue.h (original) +++ lldb/trunk/include/lldb/API/SBValue.h Thu Oct 13 19:42:25 2011 @@ -360,6 +360,10 @@ #endif private: + // Helper function for SBValue::Watch() and SBValue::WatchPointee(). + lldb::SBWatchpoint + WatchValue(bool read, bool write, bool watch_pointee); + lldb::ValueObjectSP m_opaque_sp; }; Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBWatchpoint.h (original) +++ lldb/trunk/include/lldb/API/SBWatchpoint.h Thu Oct 13 19:42:25 2011 @@ -67,26 +67,27 @@ GetDescription (lldb::SBStream &description, DescriptionLevel level); #ifndef SWIG - SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp); + SBWatchpoint (const lldb::WatchpointSP &wp_sp); #endif private: friend class SBTarget; + friend class SBValue; #ifndef SWIG - lldb_private::WatchpointLocation * + lldb_private::Watchpoint * operator->(); - lldb_private::WatchpointLocation * + lldb_private::Watchpoint * get(); - lldb::WatchpointLocationSP & + lldb::WatchpointSP & operator *(); #endif - lldb::WatchpointLocationSP m_opaque_sp; + lldb::WatchpointSP m_opaque_sp; }; Copied: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h (from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Watchpoint.h?p2=lldb/trunk/include/lldb/Breakpoint/Watchpoint.h&p1=lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h&r1=141877&r2=141925&rev=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h Thu Oct 13 19:42:25 2011 @@ -1,4 +1,4 @@ -//===-- WatchpointLocation.h ------------------------------------*- C++ -*-===// +//===-- Watchpoint.h --------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_WatchpointLocation_h_ -#define liblldb_WatchpointLocation_h_ +#ifndef liblldb_Watchpoint_h_ +#define liblldb_Watchpoint_h_ // C Includes @@ -26,14 +26,14 @@ namespace lldb_private { -class WatchpointLocation : +class Watchpoint : public StoppointLocation { public: - WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware = true); + Watchpoint (lldb::addr_t addr, size_t size, bool hardware = true); - ~WatchpointLocation (); + ~Watchpoint (); bool IsEnabled () const; @@ -79,9 +79,9 @@ static lldb::break_id_t GetNextID(); - DISALLOW_COPY_AND_ASSIGN (WatchpointLocation); + DISALLOW_COPY_AND_ASSIGN (Watchpoint); }; } // namespace lldb_private -#endif // liblldb_WatchpointLocation_h_ +#endif // liblldb_Watchpoint_h_ Copied: lldb/trunk/include/lldb/Breakpoint/WatchpointList.h (from r141877, lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointList.h?p2=lldb/trunk/include/lldb/Breakpoint/WatchpointList.h&p1=lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h&r1=141877&r2=141925&rev=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/WatchpointList.h Thu Oct 13 19:42:25 2011 @@ -1,4 +1,4 @@ -//===-- WatchpointLocationList.h --------------------------------*- C++ -*-===// +//===-- WatchpointList.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_WatchpointLocationList_h_ -#define liblldb_WatchpointLocationList_h_ +#ifndef liblldb_WatchpointList_h_ +#define liblldb_WatchpointList_h_ // C Includes // C++ Includes @@ -23,41 +23,41 @@ namespace lldb_private { //---------------------------------------------------------------------- -/// @class WatchpointLocationList WatchpointLocationList.h "lldb/Breakpoint/WatchpointLocationList.h" -/// @brief This class is used by Watchpoint to manage a list of watchpoint locations, -// each watchpoint location in the list -/// has a unique ID, and is unique by Address as well. +/// @class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h" +/// @brief This class is used by Watchpoint to manage a list of watchpoints, +// each watchpoint in the list has a unique ID, and is unique by Address as +// well. //---------------------------------------------------------------------- -class WatchpointLocationList +class WatchpointList { -// Only Target can make the location list, or add elements to it. -// This is not just some random collection of locations. Rather, the act of adding the location -// to this list sets its ID. -friend class WatchpointLocation; +// Only Target can make the watchpoint list, or add elements to it. +// This is not just some random collection of watchpoints. Rather, the act of +// adding the watchpoint to this list sets its ID. +friend class Watchpoint; public: //------------------------------------------------------------------ /// Default constructor makes an empty list. //------------------------------------------------------------------ - WatchpointLocationList(); + WatchpointList(); //------------------------------------------------------------------ /// Destructor, currently does nothing. //------------------------------------------------------------------ - ~WatchpointLocationList(); + ~WatchpointList(); //------------------------------------------------------------------ - /// Add a WatchpointLocation to the list. + /// Add a Watchpoint to the list. /// - /// @param[in] wp_loc_sp - /// A shared pointer to a watchpoint location being added to the list. + /// @param[in] wp_sp + /// A shared pointer to a watchpoint being added to the list. /// /// @return - /// The ID of the WatchpointLocation in the list. + /// The ID of the Watchpoint in the list. //------------------------------------------------------------------ lldb::watch_id_t - Add (const lldb::WatchpointLocationSP& wp_loc_sp); + Add (const lldb::WatchpointSP& wp_sp); //------------------------------------------------------------------ /// Standard "Dump" method. @@ -72,8 +72,8 @@ DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const; //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location at address - /// \a addr - const version. + /// Returns a shared pointer to the watchpoint at address /// \a addr - + /// const version. /// /// @param[in] addr /// The address to look for. @@ -82,12 +82,12 @@ /// A shared pointer to the watchpoint. May contain a NULL /// pointer if the watchpoint doesn't exist. //------------------------------------------------------------------ - const lldb::WatchpointLocationSP + const lldb::WatchpointSP FindByAddress (lldb::addr_t addr) const; //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location with id - /// \a breakID, const version. + /// Returns a shared pointer to the watchpoint with id /// \a breakID, const + /// version. /// /// @param[in] breakID /// The watchpoint location ID to seek for. @@ -96,74 +96,72 @@ /// A shared pointer to the watchpoint. May contain a NULL /// pointer if the watchpoint doesn't exist. //------------------------------------------------------------------ - lldb::WatchpointLocationSP + lldb::WatchpointSP FindByID (lldb::watch_id_t watchID) const; //------------------------------------------------------------------ - /// Returns the watchpoint location id to the watchpoint location - /// at address \a addr. + /// Returns the watchpoint id to the watchpoint /// at address \a addr. /// /// @param[in] addr /// The address to match. /// /// @result - /// The ID of the watchpoint location, or LLDB_INVALID_WATCH_ID. + /// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID. //------------------------------------------------------------------ lldb::watch_id_t FindIDByAddress (lldb::addr_t addr); //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location with - /// index \a i. + /// Returns a shared pointer to the watchpoint with index \a i. /// /// @param[in] i - /// The watchpoint location index to seek for. + /// The watchpoint index to seek for. /// /// @result - /// A shared pointer to the watchpoint location. May contain a NULL - /// pointer if the watchpoint location doesn't exist. + /// A shared pointer to the watchpoint. May contain a NULL pointer if + /// the watchpoint doesn't exist. //------------------------------------------------------------------ - lldb::WatchpointLocationSP + lldb::WatchpointSP GetByIndex (uint32_t i); //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location with index - /// \a i, const version. + /// Returns a shared pointer to the watchpoint with index \a i, const + /// version. /// /// @param[in] i - /// The watchpoint location index to seek for. + /// The watchpoint index to seek for. /// /// @result - /// A shared pointer to the watchpoint location. May contain a NULL - /// pointer if the watchpoint location doesn't exist. + /// A shared pointer to the watchpoint. May contain a NULL pointer if + /// the watchpoint location doesn't exist. //------------------------------------------------------------------ - const lldb::WatchpointLocationSP + const lldb::WatchpointSP GetByIndex (uint32_t i) const; //------------------------------------------------------------------ - /// Removes the watchpoint location given by \b watchID from this list. + /// Removes the watchpoint given by \b watchID from this list. /// /// @param[in] watchID - /// The watchpoint location ID to remove. + /// The watchpoint ID to remove. /// /// @result - /// \b true if the watchpoint location \a watchID was in the list. + /// \b true if the watchpoint \a watchID was in the list. //------------------------------------------------------------------ bool Remove (lldb::watch_id_t watchID); //------------------------------------------------------------------ - /// Returns the number hit count of all locations in this list. + /// Returns the number hit count of all watchpoints in this list. /// /// @result - /// Hit count of all locations in this list. + /// Hit count of all watchpoints in this list. //------------------------------------------------------------------ uint32_t GetHitCount () const; //------------------------------------------------------------------ - /// Enquires of the watchpoint location in this list with ID \a - /// watchID whether we should stop. + /// Enquires of the watchpoint in this list with ID \a watchID whether we + /// should stop. /// /// @param[in] context /// This contains the information about this stop. @@ -179,7 +177,7 @@ lldb::watch_id_t watchID); //------------------------------------------------------------------ - /// Returns the number of elements in this watchpoint location list. + /// Returns the number of elements in this watchpoint list. /// /// @result /// The number of elements. @@ -188,12 +186,11 @@ GetSize() const { Mutex::Locker locker(m_mutex); - return m_address_to_location.size(); + return m_address_to_watchpoint.size(); } //------------------------------------------------------------------ - /// Print a description of the watchpoint locations in this list to - /// the stream \a s. + /// Print a description of the watchpoints in this list to the stream \a s. /// /// @param[in] s /// The stream to which to print the description. @@ -215,7 +212,7 @@ RemoveAll (); //------------------------------------------------------------------ - /// Sets the passed in Locker to hold the Watchpoint Location List mutex. + /// Sets the passed in Locker to hold the Watchpoint List mutex. /// /// @param[in] locker /// The locker object that is set. @@ -224,7 +221,7 @@ GetListMutex (lldb_private::Mutex::Locker &locker); protected: - typedef std::map addr_map; + typedef std::map addr_map; addr_map::iterator GetIDIterator(lldb::watch_id_t watchID); @@ -232,10 +229,10 @@ addr_map::const_iterator GetIDConstIterator(lldb::watch_id_t watchID) const; - addr_map m_address_to_location; + addr_map m_address_to_watchpoint; mutable Mutex m_mutex; }; } // namespace lldb_private -#endif // liblldb_WatchpointLocationList_h_ +#endif // liblldb_WatchpointList_h_ Removed: lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h?rev=141924&view=auto ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocation.h (removed) @@ -1,87 +0,0 @@ -//===-- WatchpointLocation.h ------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_WatchpointLocation_h_ -#define liblldb_WatchpointLocation_h_ - -// C Includes - -// C++ Includes -#include -#include - -// Other libraries and framework includes - -// Project includes -#include "lldb/lldb-private.h" -#include "lldb/Target/Target.h" -#include "lldb/Core/UserID.h" -#include "lldb/Breakpoint/StoppointLocation.h" - -namespace lldb_private { - -class WatchpointLocation : - public StoppointLocation -{ -public: - - WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware = true); - - ~WatchpointLocation (); - - bool - IsEnabled () const; - - void - SetEnabled (bool enabled); - - virtual bool - IsHardware () const; - - virtual bool - ShouldStop (StoppointCallbackContext *context); - - bool WatchpointRead () const; - bool WatchpointWrite () const; - uint32_t GetIgnoreCount () const; - void SetIgnoreCount (uint32_t n); - void SetWatchpointType (uint32_t type); - bool SetCallback (WatchpointHitCallback callback, void *callback_baton); - void SetDeclInfo (std::string &str); - void GetDescription (Stream *s, lldb::DescriptionLevel level); - void Dump (Stream *s) const; - void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const; - Target &GetTarget() { return *m_target; } - -private: - friend class Target; - - void SetTarget(Target *target_ptr) { m_target = target_ptr; } - - Target *m_target; - bool m_enabled; // Is this watchpoint enabled - bool m_is_hardware; // Is this a hardware watchpoint - uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from - m_watch_write:1, // 1 if we stop when the watched data is written to - m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access - m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access - uint32_t m_ignore_count; // Number of times to ignore this breakpoint - WatchpointHitCallback m_callback; - void * m_callback_baton; // Callback user data to pass to callback - std::string m_decl_str; // Declaration information, if any. - - static lldb::break_id_t - GetNextID(); - - DISALLOW_COPY_AND_ASSIGN (WatchpointLocation); -}; - -} // namespace lldb_private - -#endif // liblldb_WatchpointLocation_h_ Removed: lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h?rev=141924&view=auto ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/WatchpointLocationList.h (removed) @@ -1,241 +0,0 @@ -//===-- WatchpointLocationList.h --------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_WatchpointLocationList_h_ -#define liblldb_WatchpointLocationList_h_ - -// C Includes -// C++ Includes -#include -#include -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" -#include "lldb/Core/Address.h" -#include "lldb/Host/Mutex.h" - -namespace lldb_private { - -//---------------------------------------------------------------------- -/// @class WatchpointLocationList WatchpointLocationList.h "lldb/Breakpoint/WatchpointLocationList.h" -/// @brief This class is used by Watchpoint to manage a list of watchpoint locations, -// each watchpoint location in the list -/// has a unique ID, and is unique by Address as well. -//---------------------------------------------------------------------- - -class WatchpointLocationList -{ -// Only Target can make the location list, or add elements to it. -// This is not just some random collection of locations. Rather, the act of adding the location -// to this list sets its ID. -friend class WatchpointLocation; - -public: - //------------------------------------------------------------------ - /// Default constructor makes an empty list. - //------------------------------------------------------------------ - WatchpointLocationList(); - - //------------------------------------------------------------------ - /// Destructor, currently does nothing. - //------------------------------------------------------------------ - ~WatchpointLocationList(); - - //------------------------------------------------------------------ - /// Add a WatchpointLocation to the list. - /// - /// @param[in] wp_loc_sp - /// A shared pointer to a watchpoint location being added to the list. - /// - /// @return - /// The ID of the WatchpointLocation in the list. - //------------------------------------------------------------------ - lldb::watch_id_t - Add (const lldb::WatchpointLocationSP& wp_loc_sp); - - //------------------------------------------------------------------ - /// Standard "Dump" method. - //------------------------------------------------------------------ - void - Dump (Stream *s) const; - - //------------------------------------------------------------------ - /// Dump with lldb::DescriptionLevel. - //------------------------------------------------------------------ - void - DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const; - - //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location at address - /// \a addr - const version. - /// - /// @param[in] addr - /// The address to look for. - /// - /// @result - /// A shared pointer to the watchpoint. May contain a NULL - /// pointer if the watchpoint doesn't exist. - //------------------------------------------------------------------ - const lldb::WatchpointLocationSP - FindByAddress (lldb::addr_t addr) const; - - //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location with id - /// \a breakID, const version. - /// - /// @param[in] breakID - /// The watchpoint location ID to seek for. - /// - /// @result - /// A shared pointer to the watchpoint. May contain a NULL - /// pointer if the watchpoint doesn't exist. - //------------------------------------------------------------------ - lldb::WatchpointLocationSP - FindByID (lldb::watch_id_t watchID) const; - - //------------------------------------------------------------------ - /// Returns the watchpoint location id to the watchpoint location - /// at address \a addr. - /// - /// @param[in] addr - /// The address to match. - /// - /// @result - /// The ID of the watchpoint location, or LLDB_INVALID_WATCH_ID. - //------------------------------------------------------------------ - lldb::watch_id_t - FindIDByAddress (lldb::addr_t addr); - - //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location with - /// index \a i. - /// - /// @param[in] i - /// The watchpoint location index to seek for. - /// - /// @result - /// A shared pointer to the watchpoint location. May contain a NULL - /// pointer if the watchpoint location doesn't exist. - //------------------------------------------------------------------ - lldb::WatchpointLocationSP - GetByIndex (uint32_t i); - - //------------------------------------------------------------------ - /// Returns a shared pointer to the watchpoint location with index - /// \a i, const version. - /// - /// @param[in] i - /// The watchpoint location index to seek for. - /// - /// @result - /// A shared pointer to the watchpoint location. May contain a NULL - /// pointer if the watchpoint location doesn't exist. - //------------------------------------------------------------------ - const lldb::WatchpointLocationSP - GetByIndex (uint32_t i) const; - - //------------------------------------------------------------------ - /// Removes the watchpoint location given by \b watchID from this list. - /// - /// @param[in] watchID - /// The watchpoint location ID to remove. - /// - /// @result - /// \b true if the watchpoint location \a watchID was in the list. - //------------------------------------------------------------------ - bool - Remove (lldb::watch_id_t watchID); - - //------------------------------------------------------------------ - /// Returns the number hit count of all locations in this list. - /// - /// @result - /// Hit count of all locations in this list. - //------------------------------------------------------------------ - uint32_t - GetHitCount () const; - - //------------------------------------------------------------------ - /// Enquires of the watchpoint location in this list with ID \a - /// watchID whether we should stop. - /// - /// @param[in] context - /// This contains the information about this stop. - /// - /// @param[in] watchID - /// This watch ID that we hit. - /// - /// @return - /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ - bool - ShouldStop (StoppointCallbackContext *context, - lldb::watch_id_t watchID); - - //------------------------------------------------------------------ - /// Returns the number of elements in this watchpoint location list. - /// - /// @result - /// The number of elements. - //------------------------------------------------------------------ - size_t - GetSize() const - { - Mutex::Locker locker(m_mutex); - return m_address_to_location.size(); - } - - //------------------------------------------------------------------ - /// Print a description of the watchpoint locations in this list to - /// the stream \a s. - /// - /// @param[in] s - /// The stream to which to print the description. - /// - /// @param[in] level - /// The description level that indicates the detail level to - /// provide. - /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ - void - GetDescription (Stream *s, - lldb::DescriptionLevel level); - - void - SetEnabledAll (bool enabled); - - void - RemoveAll (); - - //------------------------------------------------------------------ - /// Sets the passed in Locker to hold the Watchpoint Location List mutex. - /// - /// @param[in] locker - /// The locker object that is set. - //------------------------------------------------------------------ - void - GetListMutex (lldb_private::Mutex::Locker &locker); - -protected: - typedef std::map addr_map; - - addr_map::iterator - GetIDIterator(lldb::watch_id_t watchID); - - addr_map::const_iterator - GetIDConstIterator(lldb::watch_id_t watchID) const; - - addr_map m_address_to_location; - mutable Mutex m_mutex; -}; - -} // namespace lldb_private - -#endif // liblldb_WatchpointLocationList_h_ Modified: lldb/trunk/include/lldb/Target/Process.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Process.h (original) +++ lldb/trunk/include/lldb/Target/Process.h Thu Oct 13 19:42:25 2011 @@ -2480,10 +2480,10 @@ // Process Watchpoints (optional) //---------------------------------------------------------------------- virtual Error - EnableWatchpoint (WatchpointLocation *bp_loc); + EnableWatchpoint (Watchpoint *wp); virtual Error - DisableWatchpoint (WatchpointLocation *bp_loc); + DisableWatchpoint (Watchpoint *wp); //------------------------------------------------------------------ // Thread Queries Modified: lldb/trunk/include/lldb/Target/Target.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Target.h (original) +++ lldb/trunk/include/lldb/Target/Target.h Thu Oct 13 19:42:25 2011 @@ -18,7 +18,7 @@ #include "lldb/lldb-public.h" #include "lldb/Breakpoint/BreakpointList.h" #include "lldb/Breakpoint/BreakpointLocationCollection.h" -#include "lldb/Breakpoint/WatchpointLocationList.h" +#include "lldb/Breakpoint/WatchpointList.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Event.h" #include "lldb/Core/ModuleList.h" @@ -292,22 +292,22 @@ lldb::BreakpointResolverSP &resolver_sp, bool internal = false); - // Use this to create a watchpoint location: - lldb::WatchpointLocationSP - CreateWatchpointLocation (lldb::addr_t addr, - size_t size, - uint32_t type); + // Use this to create a watchpoint: + lldb::WatchpointSP + CreateWatchpoint (lldb::addr_t addr, + size_t size, + uint32_t type); - lldb::WatchpointLocationSP - GetLastCreatedWatchpointLocation () + lldb::WatchpointSP + GetLastCreatedWatchpoint () { - return m_last_created_watchpoint_location; + return m_last_created_watchpoint; } - WatchpointLocationList & - GetWatchpointLocationList() + WatchpointList & + GetWatchpointList() { - return m_watchpoint_location_list; + return m_watchpoint_list; } void @@ -332,28 +332,28 @@ // performed end to end, for both the debugger and the debuggee. bool - RemoveAllWatchpointLocations (bool end_to_end = true); + RemoveAllWatchpoints (bool end_to_end = true); bool - DisableAllWatchpointLocations (bool end_to_end = true); + DisableAllWatchpoints (bool end_to_end = true); bool - EnableAllWatchpointLocations (bool end_to_end = true); + EnableAllWatchpoints (bool end_to_end = true); bool - IgnoreAllWatchpointLocations (uint32_t ignore_count); + IgnoreAllWatchpoints (uint32_t ignore_count); bool - DisableWatchpointLocationByID (lldb::watch_id_t watch_id); + DisableWatchpointByID (lldb::watch_id_t watch_id); bool - EnableWatchpointLocationByID (lldb::watch_id_t watch_id); + EnableWatchpointByID (lldb::watch_id_t watch_id); bool - RemoveWatchpointLocationByID (lldb::watch_id_t watch_id); + RemoveWatchpointByID (lldb::watch_id_t watch_id); bool - IgnoreWatchpointLocationByID (lldb::watch_id_t watch_id, uint32_t ignore_count); + IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count); void ModulesDidLoad (ModuleList &module_list); @@ -877,8 +877,8 @@ BreakpointList m_breakpoint_list; BreakpointList m_internal_breakpoint_list; lldb::BreakpointSP m_last_created_breakpoint; - WatchpointLocationList m_watchpoint_location_list; - lldb::WatchpointLocationSP m_last_created_watchpoint_location; + WatchpointList m_watchpoint_list; + lldb::WatchpointSP m_last_created_watchpoint; // We want to tightly control the process destruction process so // we can correctly tear down everything that we need to, so the only // class that knows about the process lifespan is this target class. Modified: lldb/trunk/include/lldb/lldb-forward-rtti.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward-rtti.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-forward-rtti.h (original) +++ lldb/trunk/include/lldb/lldb-forward-rtti.h Thu Oct 13 19:42:25 2011 @@ -87,7 +87,7 @@ typedef SharedPtr::Type VariableSP; typedef SharedPtr::Type VariableListSP; typedef SharedPtr::Type ValueObjectListSP; - typedef SharedPtr::Type WatchpointLocationSP; + typedef SharedPtr::Type WatchpointSP; } // namespace lldb Modified: lldb/trunk/include/lldb/lldb-forward.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-forward.h (original) +++ lldb/trunk/include/lldb/lldb-forward.h Thu Oct 13 19:42:25 2011 @@ -197,8 +197,8 @@ class ValueObjectList; class Variable; class VariableList; -class WatchpointLocation; -class WatchpointLocationList; +class Watchpoint; +class WatchpointList; struct LineEntry; } // namespace lldb_private Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Oct 13 19:42:25 2011 @@ -92,7 +92,7 @@ 2689000B13353DB600698AC0 /* Stoppoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1610F1B83100F91463 /* Stoppoint.cpp */; }; 2689000D13353DB600698AC0 /* StoppointCallbackContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E0910F1B83100F91463 /* StoppointCallbackContext.cpp */; }; 2689000F13353DB600698AC0 /* StoppointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */; }; - 2689001113353DB600698AC0 /* WatchpointLocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */; }; + 2689001113353DB600698AC0 /* Watchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E1810F1B83100F91463 /* Watchpoint.cpp */; }; 2689001213353DDE00698AC0 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; }; 2689001313353DDE00698AC0 /* CommandObjectArgs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 499F381F11A5B3F300F5CE02 /* CommandObjectArgs.cpp */; }; 2689001413353DDE00698AC0 /* CommandObjectBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */; }; @@ -450,7 +450,7 @@ B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B207C4921429607D00F36E4E /* CommandObjectWatchpoint.cpp */; }; B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */; }; B271B11413D6139300C3FEDB /* FormatClasses.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94A9112D13D5DF210046D8A6 /* FormatClasses.cpp */; }; - B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointLocationList.cpp */; }; + B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B27318411416AC12006039C8 /* WatchpointList.cpp */; }; B28058A1139988B0002D96D0 /* InferiorCallPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */; }; B2A58722143119810092BFBA /* SBWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = B2A58721143119810092BFBA /* SBWatchpoint.h */; settings = {ATTRIBUTES = (Public, ); }; }; B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2A58723143119D50092BFBA /* SBWatchpoint.cpp */; }; @@ -843,7 +843,7 @@ 26BC7CF910F1B71400F91463 /* SearchFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SearchFilter.h; path = include/lldb/Core/SearchFilter.h; sourceTree = ""; }; 26BC7CFA10F1B71400F91463 /* Stoppoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Stoppoint.h; path = include/lldb/Breakpoint/Stoppoint.h; sourceTree = ""; }; 26BC7CFB10F1B71400F91463 /* StoppointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StoppointLocation.h; path = include/lldb/Breakpoint/StoppointLocation.h; sourceTree = ""; }; - 26BC7CFC10F1B71400F91463 /* WatchpointLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WatchpointLocation.h; path = include/lldb/Breakpoint/WatchpointLocation.h; sourceTree = ""; }; + 26BC7CFC10F1B71400F91463 /* Watchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Watchpoint.h; path = include/lldb/Breakpoint/Watchpoint.h; sourceTree = ""; }; 26BC7D1410F1B76300F91463 /* CommandObjectBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectBreakpoint.h; path = source/Commands/CommandObjectBreakpoint.h; sourceTree = ""; }; 26BC7D1710F1B76300F91463 /* CommandObjectDisassemble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectDisassemble.h; path = source/Commands/CommandObjectDisassemble.h; sourceTree = ""; }; 26BC7D1810F1B76300F91463 /* CommandObjectExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectExpression.h; path = source/Commands/CommandObjectExpression.h; sourceTree = ""; }; @@ -946,7 +946,7 @@ 26BC7E1510F1B83100F91463 /* SearchFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SearchFilter.cpp; path = source/Core/SearchFilter.cpp; sourceTree = ""; }; 26BC7E1610F1B83100F91463 /* Stoppoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Stoppoint.cpp; path = source/Breakpoint/Stoppoint.cpp; sourceTree = ""; }; 26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StoppointLocation.cpp; path = source/Breakpoint/StoppointLocation.cpp; sourceTree = ""; }; - 26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocation.cpp; path = source/Breakpoint/WatchpointLocation.cpp; sourceTree = ""; }; + 26BC7E1810F1B83100F91463 /* Watchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Watchpoint.cpp; path = source/Breakpoint/Watchpoint.cpp; sourceTree = ""; }; 26BC7E2D10F1B84700F91463 /* CommandObjectBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectBreakpoint.cpp; path = source/Commands/CommandObjectBreakpoint.cpp; sourceTree = ""; }; 26BC7E3010F1B84700F91463 /* CommandObjectDisassemble.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectDisassemble.cpp; path = source/Commands/CommandObjectDisassemble.cpp; sourceTree = ""; }; 26BC7E3110F1B84700F91463 /* CommandObjectExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectExpression.cpp; path = source/Commands/CommandObjectExpression.cpp; sourceTree = ""; }; @@ -1361,8 +1361,8 @@ B2462246141AD37D00F3D409 /* OptionGroupWatchpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionGroupWatchpoint.cpp; path = source/Interpreter/OptionGroupWatchpoint.cpp; sourceTree = ""; }; B2462248141AD39B00F3D409 /* OptionGroupWatchpoint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OptionGroupWatchpoint.h; path = include/lldb/Interpreter/OptionGroupWatchpoint.h; sourceTree = ""; }; B2462249141AE62200F3D409 /* Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Utils.h; path = include/lldb/Utility/Utils.h; sourceTree = ""; }; - B27318411416AC12006039C8 /* WatchpointLocationList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointLocationList.cpp; path = source/Breakpoint/WatchpointLocationList.cpp; sourceTree = ""; }; - B27318431416AC43006039C8 /* WatchpointLocationList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WatchpointLocationList.h; path = include/lldb/Breakpoint/WatchpointLocationList.h; sourceTree = ""; }; + B27318411416AC12006039C8 /* WatchpointList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WatchpointList.cpp; path = source/Breakpoint/WatchpointList.cpp; sourceTree = ""; }; + B27318431416AC43006039C8 /* WatchpointList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WatchpointList.h; path = include/lldb/Breakpoint/WatchpointList.h; sourceTree = ""; }; B28058A0139988B0002D96D0 /* InferiorCallPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = InferiorCallPOSIX.cpp; path = Utility/InferiorCallPOSIX.cpp; sourceTree = ""; }; B28058A2139988C6002D96D0 /* InferiorCallPOSIX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = InferiorCallPOSIX.h; path = Utility/InferiorCallPOSIX.h; sourceTree = ""; }; B287E63E12EFAE2C00C9BEFE /* ARMDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ARMDefines.h; path = Utility/ARMDefines.h; sourceTree = ""; }; @@ -2309,10 +2309,10 @@ 26BC7E0910F1B83100F91463 /* StoppointCallbackContext.cpp */, 26BC7CFB10F1B71400F91463 /* StoppointLocation.h */, 26BC7E1710F1B83100F91463 /* StoppointLocation.cpp */, - 26BC7CFC10F1B71400F91463 /* WatchpointLocation.h */, - B27318431416AC43006039C8 /* WatchpointLocationList.h */, - 26BC7E1810F1B83100F91463 /* WatchpointLocation.cpp */, - B27318411416AC12006039C8 /* WatchpointLocationList.cpp */, + 26BC7CFC10F1B71400F91463 /* Watchpoint.h */, + B27318431416AC43006039C8 /* WatchpointList.h */, + 26BC7E1810F1B83100F91463 /* Watchpoint.cpp */, + B27318411416AC12006039C8 /* WatchpointList.cpp */, ); name = Breakpoint; sourceTree = ""; @@ -3199,7 +3199,7 @@ 2689000B13353DB600698AC0 /* Stoppoint.cpp in Sources */, 2689000D13353DB600698AC0 /* StoppointCallbackContext.cpp in Sources */, 2689000F13353DB600698AC0 /* StoppointLocation.cpp in Sources */, - 2689001113353DB600698AC0 /* WatchpointLocation.cpp in Sources */, + 2689001113353DB600698AC0 /* Watchpoint.cpp in Sources */, 2689001213353DDE00698AC0 /* CommandObjectApropos.cpp in Sources */, 2689001313353DDE00698AC0 /* CommandObjectArgs.cpp in Sources */, 2689001413353DDE00698AC0 /* CommandObjectBreakpoint.cpp in Sources */, @@ -3498,7 +3498,7 @@ 94FA3DE01405D50400833217 /* ValueObjectConstResultChild.cpp in Sources */, 949ADF031406F648004833E1 /* ValueObjectConstResultImpl.cpp in Sources */, 26A0DA4E140F7226006DA411 /* HashedNameToDIE.cpp in Sources */, - B27318421416AC12006039C8 /* WatchpointLocationList.cpp in Sources */, + B27318421416AC12006039C8 /* WatchpointList.cpp in Sources */, 26E152261419CAD4007967D0 /* ObjectFilePECOFF.cpp in Sources */, B2462247141AD37D00F3D409 /* OptionGroupWatchpoint.cpp in Sources */, 49A71FE7141FFA5C00D59478 /* IRInterpreter.cpp in Sources */, Modified: lldb/trunk/scripts/Python/interface/SBFrame.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFrame.i?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBFrame.i (original) +++ lldb/trunk/scripts/Python/interface/SBFrame.i Thu Oct 13 19:42:25 2011 @@ -215,25 +215,6 @@ lldb::SBValue FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic); - %feature("docstring", " - /// Find and watch a variable using the frame as the scope. - /// It returns an SBValue, similar to FindValue() method, if find-and-watch - /// operation succeeds. Otherwise, an invalid SBValue is returned. - /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. - ") WatchValue; - lldb::SBValue - WatchValue (const char *name, ValueType value_type, uint32_t watch_type); - - %feature("docstring", " - /// Find and watch the location pointed to by a variable using the frame as - /// the scope. - /// It returns an SBValue, similar to FindValue() method, if find-and-watch - /// operation succeeds. Otherwise, an invalid SBValue is returned. - /// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. - ") WatchLocation; - lldb::SBValue - WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size); - bool GetDescription (lldb::SBStream &description); Modified: lldb/trunk/scripts/Python/interface/SBTarget.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBTarget.i (original) +++ lldb/trunk/scripts/Python/interface/SBTarget.i Thu Oct 13 19:42:25 2011 @@ -12,8 +12,7 @@ %feature("docstring", "Represents the target program running under the debugger. -SBTarget supports module, breakpoint, and watchpoint_location iterations. For -example, +SBTarget supports module, breakpoint, and watchpoint iterations. For example, for m in target.module_iter(): print m @@ -39,14 +38,14 @@ and, - for wp_loc in target.watchpoint_location_iter(): + for wp_loc in target.watchpoint_iter(): print wp_loc produces: -WatchpointLocation 1: addr = 0x1034ca048 size = 4 state = enabled type = rw +Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12' - hw_index = 0 hit_count = 2 ignore_count = 0 callback = 0x0 baton = 0x0" + hw_index = 0 hit_count = 2 ignore_count = 0" ) SBTarget; class SBTarget { Modified: lldb/trunk/scripts/Python/interface/SBValue.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBValue.i (original) +++ lldb/trunk/scripts/Python/interface/SBValue.i Thu Oct 13 19:42:25 2011 @@ -278,9 +278,17 @@ lldb::SBFrame GetFrame(); + %feature("docstring", " + /// Find and watch a variable. + /// It returns an SBWatchpoint, which may be invalid. + ") Watch; lldb::SBWatchpoint Watch (bool resolve_location, bool read, bool write); + %feature("docstring", " + /// Find and watch the location pointed to by a variable. + /// It returns an SBWatchpoint, which may be invalid. + ") WatchPointee; lldb::SBWatchpoint WatchPointee (bool resolve_location, bool read, bool write); Modified: lldb/trunk/scripts/Python/interface/SBWatchpoint.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBWatchpoint.i?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBWatchpoint.i (original) +++ lldb/trunk/scripts/Python/interface/SBWatchpoint.i Thu Oct 13 19:42:25 2011 @@ -10,14 +10,13 @@ namespace lldb { %feature("docstring", -"Represents an instance of watchpoint location for a specific target program. +"Represents an instance of watchpoint for a specific target program. -A watchpoint location is determined by the address and the byte size that -resulted in this particular instantiation. Each watchpoint location has its -settable options. +A watchpoint is determined by the address and the byte size that resulted in +this particular instantiation. Each watchpoint has its settable options. -See also SBTarget.watchpoint_location_iter() for for example usage of iterating -through the watchpoint locations of the target." +See also SBTarget.watchpoint_iter() for for example usage of iterating through +the watchpoints of the target." ) SBWatchpoint; class SBWatchpoint { Modified: lldb/trunk/scripts/Python/modify-python-lldb.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/scripts/Python/modify-python-lldb.py (original) +++ lldb/trunk/scripts/Python/modify-python-lldb.py Thu Oct 13 19:42:25 2011 @@ -173,7 +173,7 @@ iter_def = " def __iter__(self): return lldb_iter(self, '%s', '%s')" module_iter = " def module_iter(self): return lldb_iter(self, '%s', '%s')" breakpoint_iter = " def breakpoint_iter(self): return lldb_iter(self, '%s', '%s')" -watchpoint_location_iter = " def watchpoint_location_iter(self): return lldb_iter(self, '%s', '%s')" +watchpoint_iter = " def watchpoint_iter(self): return lldb_iter(self, '%s', '%s')" section_iter = " def section_iter(self): return lldb_iter(self, '%s', '%s')" # Called to implement the built-in function len(). @@ -222,7 +222,7 @@ # SBTarget needs special processing, see below. 'SBTarget': {'module': ('GetNumModules', 'GetModuleAtIndex'), 'breakpoint': ('GetNumBreakpoints', 'GetBreakpointAtIndex'), - 'watchpoint_location': ('GetNumWatchpointLocations', 'GetWatchpointLocationAtIndex') + 'watchpoint': ('GetNumWatchpoints', 'GetWatchpointAtIndex') }, # SBModule has an additional section_iter(), see below. @@ -369,7 +369,7 @@ if cls == "SBTarget": new_content.add_line(module_iter % (d[cls]['module'])) new_content.add_line(breakpoint_iter % (d[cls]['breakpoint'])) - new_content.add_line(watchpoint_location_iter % (d[cls]['watchpoint_location'])) + new_content.add_line(watchpoint_iter % (d[cls]['watchpoint'])) else: if (state & DEFINING_ITERATOR): new_content.add_line(iter_def % d[cls]) Modified: lldb/trunk/source/API/SBFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/API/SBFrame.cpp (original) +++ lldb/trunk/source/API/SBFrame.cpp Thu Oct 13 19:42:25 2011 @@ -14,7 +14,6 @@ #include "lldb/lldb-types.h" -#include "lldb/Breakpoint/WatchpointLocation.h" #include "lldb/Core/Address.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Log.h" @@ -406,119 +405,6 @@ return value; } -/// Find and watch a variable using the frame as the scope. -/// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. -SBValue -SBFrame::WatchValue (const char *name, ValueType value_type, uint32_t watch_type) -{ - SBValue sb_value_empty; - - if (!IsValid()) - return sb_value_empty; - - // Acquire the API locker, to be released at the end of the method call. - Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex()); - - switch (value_type) { - case eValueTypeVariableGlobal: // global variable - case eValueTypeVariableStatic: // static variable - case eValueTypeVariableArgument: // function argument variables - case eValueTypeVariableLocal: // function local variables - break; - default: - return sb_value_empty; // these are not eligible for watching - } - - SBValue sb_value = FindValue(name, value_type); - // If the SBValue is not valid, there's no point in even trying to watch it. - if (!sb_value.IsValid()) - return sb_value; - - addr_t addr = sb_value.GetLoadAddress(); - size_t size = sb_value.GetByteSize(); - - WatchpointLocationSP wp_loc_sp = m_opaque_sp->GetThread().GetProcess().GetTarget(). - CreateWatchpointLocation(addr, size, watch_type); - - if (wp_loc_sp) { - // StackFrame::GetInScopeVariableList(true) to get file globals as well. - VariableListSP var_list_sp(m_opaque_sp->GetInScopeVariableList(true)); - VariableSP var_sp = var_list_sp->FindVariable(ConstString(name)); - if (var_sp && var_sp->GetDeclaration().GetFile()) { - StreamString ss; - // True to show fullpath for declaration file. - var_sp->GetDeclaration().DumpStopContext(&ss, true); - wp_loc_sp->SetDeclInfo(ss.GetString()); - } - } - - LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - if (log) - log->Printf ("SBFrame(%p)::WatchValue (name=\"%s\", value_type=%i, watch_type=%i) => SBValue(%p) & wp_loc(%p)", - m_opaque_sp.get(), name, value_type, watch_type, sb_value.get(), wp_loc_sp.get()); - - return wp_loc_sp ? sb_value : sb_value_empty; -} - -/// Find and watch the location pointed to by a variable using the frame as -/// the scope. -/// It returns an SBValue, similar to FindValue() method, if find-and-watch -/// operation succeeds. Otherwise, an invalid SBValue is returned. -/// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch. -SBValue -SBFrame::WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size) -{ - SBValue sb_value_empty; - - if (!IsValid()) - return sb_value_empty; - - // Acquire the API locker, to be released at the end of the method call. - Mutex::Locker api_locker (m_opaque_sp->GetThread().GetProcess().GetTarget().GetAPIMutex()); - - switch (value_type) { - case eValueTypeVariableGlobal: // global variable - case eValueTypeVariableStatic: // static variable - case eValueTypeVariableArgument: // function argument variables - case eValueTypeVariableLocal: // function local variables - break; - default: - return sb_value_empty; // these are not eligible for watching - } - - SBValue sb_pointer = FindValue(name, value_type); - // If the sb_pointer is not valid, there's no point in even trying to watch it. - if (!sb_pointer.IsValid() || !sb_pointer.GetType().IsPointerType()) - return sb_value_empty; - - addr_t addr = sb_pointer.GetValueAsUnsigned(0); - if (!addr) - return sb_value_empty; - - SBValue sb_value = sb_pointer.CreateValueFromAddress("pointee", addr, sb_pointer.GetType().GetPointeeType()); - WatchpointLocationSP wp_loc_sp = m_opaque_sp->GetThread().GetProcess().GetTarget(). - CreateWatchpointLocation(addr, size, watch_type); - - if (wp_loc_sp) { - // StackFrame::GetInScopeVariableList(true) to get file globals as well. - VariableListSP var_list_sp(m_opaque_sp->GetInScopeVariableList(true)); - VariableSP var_sp = var_list_sp->FindVariable(ConstString(name)); - if (var_sp && var_sp->GetDeclaration().GetFile()) { - StreamString ss; - // True to show fullpath for declaration file. - var_sp->GetDeclaration().DumpStopContext(&ss, true); - wp_loc_sp->SetDeclInfo(ss.GetString()); - } - } - - LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); - if (log) - log->Printf ("SBFrame(%p)::WatchLocation (name=\"%s\", value_type=%i, watch_type=%i, size=%lu) => SBValue(%p) & wp_loc(%p)", - m_opaque_sp.get(), name, value_type, watch_type, size, sb_value.get(), wp_loc_sp.get()); - - return wp_loc_sp ? sb_value : sb_value_empty; -} - SBValue SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic) { Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Thu Oct 13 19:42:25 2011 @@ -887,8 +887,8 @@ { if (m_opaque_sp) { - // The watchpoint location list is thread safe, no need to lock - return m_opaque_sp->GetWatchpointLocationList().GetSize(); + // The watchpoint list is thread safe, no need to lock + return m_opaque_sp->GetWatchpointList().GetSize(); } return 0; } @@ -896,13 +896,13 @@ SBWatchpoint SBTarget::GetWatchpointAtIndex (uint32_t idx) const { - SBWatchpoint sb_watchpoint_location; + SBWatchpoint sb_watchpoint; if (m_opaque_sp) { - // The watchpoint location list is thread safe, no need to lock - *sb_watchpoint_location = m_opaque_sp->GetWatchpointLocationList().GetByIndex(idx); + // The watchpoint list is thread safe, no need to lock + *sb_watchpoint = m_opaque_sp->GetWatchpointList().GetByIndex(idx); } - return sb_watchpoint_location; + return sb_watchpoint; } bool @@ -914,12 +914,12 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - result = m_opaque_sp->RemoveWatchpointLocationByID (wp_id); + result = m_opaque_sp->RemoveWatchpointByID (wp_id); } if (log) { - log->Printf ("SBTarget(%p)::WatchpointLocationDelete (wp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) wp_id, result); + log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", m_opaque_sp.get(), (uint32_t) wp_id, result); } return result; @@ -934,12 +934,12 @@ if (m_opaque_sp && wp_id != LLDB_INVALID_WATCH_ID) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - *sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + *sb_watchpoint = m_opaque_sp->GetWatchpointList().FindByID(wp_id); } if (log) { - log->Printf ("SBTarget(%p)::FindWatchpointLocationByID (bp_id=%d) => SBWatchpoint(%p)", + log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)", m_opaque_sp.get(), (uint32_t) wp_id, sb_watchpoint.get()); } @@ -955,8 +955,9 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - // TODO: Johnny fill this in - //*sb_watchpoint = m_opaque_sp->GetWatchpointLocationList().FindByID(wp_id); + uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) | + (write ? LLDB_WATCH_TYPE_WRITE : 0); + WatchpointSP wp_sp = m_opaque_sp->CreateWatchpoint(addr, size, watch_type); } if (log) @@ -974,7 +975,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - m_opaque_sp->EnableAllWatchpointLocations (); + m_opaque_sp->EnableAllWatchpoints (); return true; } return false; @@ -986,7 +987,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - m_opaque_sp->DisableAllWatchpointLocations (); + m_opaque_sp->DisableAllWatchpoints (); return true; } return false; @@ -998,7 +999,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); - m_opaque_sp->RemoveAllWatchpointLocations (); + m_opaque_sp->RemoveAllWatchpoints (); return true; } return false; Modified: lldb/trunk/source/API/SBValue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/API/SBValue.cpp (original) +++ lldb/trunk/source/API/SBValue.cpp Thu Oct 13 19:42:25 2011 @@ -10,6 +10,7 @@ #include "lldb/API/SBValue.h" #include "lldb/API/SBStream.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" @@ -22,6 +23,7 @@ #include "lldb/Symbol/Block.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Variable.h" +#include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" @@ -1102,12 +1104,19 @@ SBValue::Watch (bool resolve_location, bool read, bool write) { lldb::SBWatchpoint sb_watchpoint; + if (!m_opaque_sp) + return sb_watchpoint; + Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); if (target) { Mutex::Locker api_locker (target->GetAPIMutex()); - // TODO: Johnny fill this in + sb_watchpoint = WatchValue(read, write, false); } + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + if (log) + log->Printf ("SBValue(%p)::Watch (resolve_location=%i, read=%i, write=%i) => wp(%p)", + m_opaque_sp.get(), resolve_location, read, write, sb_watchpoint.get()); return sb_watchpoint; } @@ -1115,13 +1124,70 @@ SBValue::WatchPointee (bool resolve_location, bool read, bool write) { lldb::SBWatchpoint sb_watchpoint; + if (!m_opaque_sp) + return sb_watchpoint; + Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get(); if (target) { Mutex::Locker api_locker (target->GetAPIMutex()); - // TODO: Johnny fill this in + sb_watchpoint = WatchValue(read, write, true); } + LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + if (log) + log->Printf ("SBValue(%p)::WatchPointee (resolve_location=%i, read=%i, write=%i) => wp(%p)", + m_opaque_sp.get(), resolve_location, read, write, sb_watchpoint.get()); return sb_watchpoint; } +// Helper function for SBValue::Watch() and SBValue::WatchPointee(). +SBWatchpoint +SBValue::WatchValue(bool read, bool write, bool watch_pointee) +{ + SBWatchpoint sb_wp_empty; + + // If the SBValue is not valid, there's no point in even trying to watch it. + if (!IsValid() || !GetFrame().IsValid()) + return sb_wp_empty; + + // Read and Write cannot both be false. + if (!read && !write) + return sb_wp_empty; + + // If we are watching the pointee, check that the SBValue is a pointer type. + if (watch_pointee && !GetType().IsPointerType()) + return sb_wp_empty; + + addr_t addr; + size_t size; + if (watch_pointee) { + addr = GetValueAsUnsigned(LLDB_INVALID_ADDRESS); + size = GetType().GetPointeeType().GetByteSize(); + } else { + addr = GetLoadAddress(); + size = GetByteSize(); + } + + // Sanity check the address and the size before calling Target::CreateWatchpoint(). + if (addr == LLDB_INVALID_ADDRESS || size == 0) + return sb_wp_empty; + + uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) | + (write ? LLDB_WATCH_TYPE_WRITE : 0); + WatchpointSP wp_sp = GetFrame().m_opaque_sp->GetThread().GetProcess().GetTarget(). + CreateWatchpoint(addr, size, watch_type); + + if (wp_sp) { + // StackFrame::GetInScopeVariableList(true) to get file globals as well. + VariableListSP var_list_sp(GetFrame().m_opaque_sp->GetInScopeVariableList(true)); + VariableSP var_sp = var_list_sp->FindVariable(ConstString(GetName())); + if (var_sp && var_sp->GetDeclaration().GetFile()) { + StreamString ss; + // True to show fullpath for declaration file. + var_sp->GetDeclaration().DumpStopContext(&ss, true); + wp_sp->SetDeclInfo(ss.GetString()); + } + } + return wp_sp; +} Modified: lldb/trunk/source/API/SBWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/API/SBWatchpoint.cpp (original) +++ lldb/trunk/source/API/SBWatchpoint.cpp Thu Oct 13 19:42:25 2011 @@ -15,8 +15,8 @@ #include "lldb/lldb-types.h" #include "lldb/lldb-defines.h" -#include "lldb/Breakpoint/WatchpointLocation.h" -#include "lldb/Breakpoint/WatchpointLocationList.h" +#include "lldb/Breakpoint/Watchpoint.h" +#include "lldb/Breakpoint/WatchpointList.h" #include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" @@ -31,8 +31,8 @@ { } -SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationSP &watch_loc_sp) : - m_opaque_sp (watch_loc_sp) +SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp) : + m_opaque_sp (wp_sp) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); @@ -40,8 +40,8 @@ { SBStream sstr; GetDescription (sstr, lldb::eDescriptionLevelBrief); - log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointLocationsSP &watch_loc_sp" - "=%p) => this.sp = %p (%s)", watch_loc_sp.get(), m_opaque_sp.get(), sstr.GetData()); + log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp" + "=%p) => this.sp = %p (%s)", wp_sp.get(), m_opaque_sp.get(), sstr.GetData()); } } @@ -156,7 +156,7 @@ if (m_opaque_sp) { Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex()); - m_opaque_sp->GetTarget().DisableWatchpointLocationByID(m_opaque_sp->GetID()); + m_opaque_sp->GetTarget().DisableWatchpointByID(m_opaque_sp->GetID()); } } @@ -227,19 +227,19 @@ return true; } -lldb_private::WatchpointLocation * +lldb_private::Watchpoint * SBWatchpoint::operator->() { return m_opaque_sp.get(); } -lldb_private::WatchpointLocation * +lldb_private::Watchpoint * SBWatchpoint::get() { return m_opaque_sp.get(); } -lldb::WatchpointLocationSP & +lldb::WatchpointSP & SBWatchpoint::operator *() { return m_opaque_sp; Copied: lldb/trunk/source/Breakpoint/Watchpoint.cpp (from r141877, lldb/trunk/source/Breakpoint/WatchpointLocation.cpp) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?p2=lldb/trunk/source/Breakpoint/Watchpoint.cpp&p1=lldb/trunk/source/Breakpoint/WatchpointLocation.cpp&r1=141877&r2=141925&rev=141925&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Thu Oct 13 19:42:25 2011 @@ -1,4 +1,4 @@ -//===-- WatchpointLocation.cpp ----------------------------------*- C++ -*-===// +//===-- Watchpoint.cpp ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" // C Includes // C++ Includes @@ -18,7 +18,7 @@ using namespace lldb; using namespace lldb_private; -WatchpointLocation::WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware) : +Watchpoint::Watchpoint (lldb::addr_t addr, size_t size, bool hardware) : StoppointLocation (GetNextID(), addr, size, hardware), m_target(NULL), m_enabled(0), @@ -33,19 +33,19 @@ { } -WatchpointLocation::~WatchpointLocation() +Watchpoint::~Watchpoint() { } break_id_t -WatchpointLocation::GetNextID() +Watchpoint::GetNextID() { static break_id_t g_next_ID = 0; return ++g_next_ID; } bool -WatchpointLocation::SetCallback (WatchpointHitCallback callback, void *callback_baton) +Watchpoint::SetCallback (WatchpointHitCallback callback, void *callback_baton) { m_callback = callback; m_callback_baton = callback_baton; @@ -53,7 +53,7 @@ } void -WatchpointLocation::SetDeclInfo (std::string &str) +Watchpoint::SetDeclInfo (std::string &str) { m_decl_str = str; return; @@ -61,7 +61,7 @@ bool -WatchpointLocation::IsHardware () const +Watchpoint::IsHardware () const { return m_is_hardware; } @@ -70,7 +70,7 @@ // should continue. bool -WatchpointLocation::ShouldStop (StoppointCallbackContext *context) +Watchpoint::ShouldStop (StoppointCallbackContext *context) { ++m_hit_count; @@ -93,20 +93,20 @@ } void -WatchpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level) +Watchpoint::GetDescription (Stream *s, lldb::DescriptionLevel level) { DumpWithLevel(s, level); return; } void -WatchpointLocation::Dump(Stream *s) const +Watchpoint::Dump(Stream *s) const { DumpWithLevel(s, lldb::eDescriptionLevelBrief); } void -WatchpointLocation::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const +Watchpoint::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const { if (s == NULL) return; @@ -114,7 +114,7 @@ assert(description_level >= lldb::eDescriptionLevelBrief && description_level <= lldb::eDescriptionLevelVerbose); - s->Printf("WatchpointLocation %u: addr = 0x%8.8llx size = %zu state = %s type = %s%s", + s->Printf("Watchpoint %u: addr = 0x%8.8llx size = %zu state = %s type = %s%s", GetID(), (uint64_t)m_addr, m_byte_size, @@ -141,13 +141,13 @@ } bool -WatchpointLocation::IsEnabled() const +Watchpoint::IsEnabled() const { return m_enabled; } void -WatchpointLocation::SetEnabled(bool enabled) +Watchpoint::SetEnabled(bool enabled) { if (!enabled) SetHardwareIndex(LLDB_INVALID_INDEX32); @@ -155,30 +155,30 @@ } void -WatchpointLocation::SetWatchpointType (uint32_t type) +Watchpoint::SetWatchpointType (uint32_t type) { m_watch_read = (type & LLDB_WATCH_TYPE_READ) != 0; m_watch_write = (type & LLDB_WATCH_TYPE_WRITE) != 0; } bool -WatchpointLocation::WatchpointRead () const +Watchpoint::WatchpointRead () const { return m_watch_read != 0; } bool -WatchpointLocation::WatchpointWrite () const +Watchpoint::WatchpointWrite () const { return m_watch_write != 0; } uint32_t -WatchpointLocation::GetIgnoreCount () const +Watchpoint::GetIgnoreCount () const { return m_ignore_count; } void -WatchpointLocation::SetIgnoreCount (uint32_t n) +Watchpoint::SetIgnoreCount (uint32_t n) { m_ignore_count = n; } Copied: lldb/trunk/source/Breakpoint/WatchpointList.cpp (from r141877, lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointList.cpp?p2=lldb/trunk/source/Breakpoint/WatchpointList.cpp&p1=lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp&r1=141877&r2=141925&rev=141925&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (original) +++ lldb/trunk/source/Breakpoint/WatchpointList.cpp Thu Oct 13 19:42:25 2011 @@ -1,4 +1,4 @@ -//===-- WatchpointLocationList.cpp ------------------------------*- C++ -*-===// +//===-- WatchpointList.cpp --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,19 +12,19 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Breakpoint/WatchpointLocationList.h" -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/WatchpointList.h" +#include "lldb/Breakpoint/Watchpoint.h" using namespace lldb; using namespace lldb_private; -WatchpointLocationList::WatchpointLocationList() : - m_address_to_location (), +WatchpointList::WatchpointList() : + m_address_to_watchpoint (), m_mutex (Mutex::eMutexTypeRecursive) { } -WatchpointLocationList::~WatchpointLocationList() +WatchpointList::~WatchpointList() { } @@ -32,65 +32,65 @@ // list, then replace it with the input one. lldb::watch_id_t -WatchpointLocationList::Add (const WatchpointLocationSP &wp_loc_sp) +WatchpointList::Add (const WatchpointSP &wp_sp) { Mutex::Locker locker (m_mutex); - lldb::addr_t wp_addr = wp_loc_sp->GetLoadAddress(); - addr_map::iterator iter = m_address_to_location.find(wp_addr); + lldb::addr_t wp_addr = wp_sp->GetLoadAddress(); + addr_map::iterator iter = m_address_to_watchpoint.find(wp_addr); - if (iter == m_address_to_location.end()) - m_address_to_location.insert(iter, addr_map::value_type(wp_addr, wp_loc_sp)); + if (iter == m_address_to_watchpoint.end()) + m_address_to_watchpoint.insert(iter, addr_map::value_type(wp_addr, wp_sp)); else - m_address_to_location[wp_addr] = wp_loc_sp; + m_address_to_watchpoint[wp_addr] = wp_sp; - return wp_loc_sp->GetID(); + return wp_sp->GetID(); } void -WatchpointLocationList::Dump (Stream *s) const +WatchpointList::Dump (Stream *s) const { DumpWithLevel(s, lldb::eDescriptionLevelBrief); } void -WatchpointLocationList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const +WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const { Mutex::Locker locker (m_mutex); s->Printf("%p: ", this); //s->Indent(); - s->Printf("WatchpointLocationList with %zu WatchpointLocations:\n", - m_address_to_location.size()); + s->Printf("WatchpointList with %zu Watchpoints:\n", + m_address_to_watchpoint.size()); s->IndentMore(); - addr_map::const_iterator pos, end = m_address_to_location.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) + addr_map::const_iterator pos, end = m_address_to_watchpoint.end(); + for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos) pos->second->DumpWithLevel(s, description_level); s->IndentLess(); } -const WatchpointLocationSP -WatchpointLocationList::FindByAddress (lldb::addr_t addr) const +const WatchpointSP +WatchpointList::FindByAddress (lldb::addr_t addr) const { - WatchpointLocationSP wp_loc_sp; + WatchpointSP wp_sp; Mutex::Locker locker (m_mutex); - if (!m_address_to_location.empty()) + if (!m_address_to_watchpoint.empty()) { - addr_map::const_iterator pos = m_address_to_location.find (addr); - if (pos != m_address_to_location.end()) - wp_loc_sp = pos->second; + addr_map::const_iterator pos = m_address_to_watchpoint.find (addr); + if (pos != m_address_to_watchpoint.end()) + wp_sp = pos->second; } - return wp_loc_sp; + return wp_sp; } -class WatchpointLocationIDMatches +class WatchpointIDMatches { public: - WatchpointLocationIDMatches (lldb::watch_id_t watch_id) : + WatchpointIDMatches (lldb::watch_id_t watch_id) : m_watch_id(watch_id) { } - bool operator() (std::pair val_pair) const + bool operator() (std::pair val_pair) const { return m_watch_id == val_pair.second.get()->GetID(); } @@ -99,119 +99,119 @@ const lldb::watch_id_t m_watch_id; }; -WatchpointLocationList::addr_map::iterator -WatchpointLocationList::GetIDIterator (lldb::watch_id_t watch_id) +WatchpointList::addr_map::iterator +WatchpointList::GetIDIterator (lldb::watch_id_t watch_id) { - return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range - WatchpointLocationIDMatches(watch_id)); // Predicate + return std::find_if(m_address_to_watchpoint.begin(), m_address_to_watchpoint.end(), // Search full range + WatchpointIDMatches(watch_id)); // Predicate } -WatchpointLocationList::addr_map::const_iterator -WatchpointLocationList::GetIDConstIterator (lldb::watch_id_t watch_id) const +WatchpointList::addr_map::const_iterator +WatchpointList::GetIDConstIterator (lldb::watch_id_t watch_id) const { - return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range - WatchpointLocationIDMatches(watch_id)); // Predicate + return std::find_if(m_address_to_watchpoint.begin(), m_address_to_watchpoint.end(), // Search full range + WatchpointIDMatches(watch_id)); // Predicate } -WatchpointLocationSP -WatchpointLocationList::FindByID (lldb::watch_id_t watch_id) const +WatchpointSP +WatchpointList::FindByID (lldb::watch_id_t watch_id) const { - WatchpointLocationSP wp_loc_sp; + WatchpointSP wp_sp; Mutex::Locker locker (m_mutex); addr_map::const_iterator pos = GetIDConstIterator(watch_id); - if (pos != m_address_to_location.end()) - wp_loc_sp = pos->second; + if (pos != m_address_to_watchpoint.end()) + wp_sp = pos->second; - return wp_loc_sp; + return wp_sp; } lldb::watch_id_t -WatchpointLocationList::FindIDByAddress (lldb::addr_t addr) +WatchpointList::FindIDByAddress (lldb::addr_t addr) { - WatchpointLocationSP wp_loc_sp = FindByAddress (addr); - if (wp_loc_sp) + WatchpointSP wp_sp = FindByAddress (addr); + if (wp_sp) { - return wp_loc_sp->GetID(); + return wp_sp->GetID(); } return LLDB_INVALID_WATCH_ID; } -WatchpointLocationSP -WatchpointLocationList::GetByIndex (uint32_t i) +WatchpointSP +WatchpointList::GetByIndex (uint32_t i) { Mutex::Locker locker (m_mutex); - WatchpointLocationSP wp_loc_sp; - if (i < m_address_to_location.size()) + WatchpointSP wp_sp; + if (i < m_address_to_watchpoint.size()) { - addr_map::const_iterator pos = m_address_to_location.begin(); + addr_map::const_iterator pos = m_address_to_watchpoint.begin(); std::advance(pos, i); - wp_loc_sp = pos->second; + wp_sp = pos->second; } - return wp_loc_sp; + return wp_sp; } -const WatchpointLocationSP -WatchpointLocationList::GetByIndex (uint32_t i) const +const WatchpointSP +WatchpointList::GetByIndex (uint32_t i) const { Mutex::Locker locker (m_mutex); - WatchpointLocationSP wp_loc_sp; - if (i < m_address_to_location.size()) + WatchpointSP wp_sp; + if (i < m_address_to_watchpoint.size()) { - addr_map::const_iterator pos = m_address_to_location.begin(); + addr_map::const_iterator pos = m_address_to_watchpoint.begin(); std::advance(pos, i); - wp_loc_sp = pos->second; + wp_sp = pos->second; } - return wp_loc_sp; + return wp_sp; } bool -WatchpointLocationList::Remove (lldb::watch_id_t watch_id) +WatchpointList::Remove (lldb::watch_id_t watch_id) { Mutex::Locker locker (m_mutex); addr_map::iterator pos = GetIDIterator(watch_id); - if (pos != m_address_to_location.end()) + if (pos != m_address_to_watchpoint.end()) { - m_address_to_location.erase(pos); + m_address_to_watchpoint.erase(pos); return true; } return false; } uint32_t -WatchpointLocationList::GetHitCount () const +WatchpointList::GetHitCount () const { uint32_t hit_count = 0; Mutex::Locker locker (m_mutex); - addr_map::const_iterator pos, end = m_address_to_location.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) + addr_map::const_iterator pos, end = m_address_to_watchpoint.end(); + for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos) hit_count += pos->second->GetHitCount(); return hit_count; } bool -WatchpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id) +WatchpointList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id) { - WatchpointLocationSP wp_loc_sp = FindByID (watch_id); - if (wp_loc_sp) + WatchpointSP wp_sp = FindByID (watch_id); + if (wp_sp) { - // Let the WatchpointLocation decide if it should stop here (could not have + // Let the Watchpoint decide if it should stop here (could not have // reached it's target hit count yet, or it could have a callback // that decided it shouldn't stop. - return wp_loc_sp->ShouldStop (context); + return wp_sp->ShouldStop (context); } - // We should stop here since this WatchpointLocation isn't valid anymore or it + // We should stop here since this Watchpoint isn't valid anymore or it // doesn't exist. return true; } void -WatchpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level) +WatchpointList::GetDescription (Stream *s, lldb::DescriptionLevel level) { Mutex::Locker locker (m_mutex); - addr_map::iterator pos, end = m_address_to_location.end(); + addr_map::iterator pos, end = m_address_to_watchpoint.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) + for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos) { s->Printf(" "); pos->second->Dump(s); @@ -219,24 +219,24 @@ } void -WatchpointLocationList::SetEnabledAll (bool enabled) +WatchpointList::SetEnabledAll (bool enabled) { Mutex::Locker locker(m_mutex); - addr_map::iterator pos, end = m_address_to_location.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) + addr_map::iterator pos, end = m_address_to_watchpoint.end(); + for (pos = m_address_to_watchpoint.begin(); pos != end; ++pos) pos->second->SetEnabled (enabled); } void -WatchpointLocationList::RemoveAll () +WatchpointList::RemoveAll () { Mutex::Locker locker(m_mutex); - m_address_to_location.clear(); + m_address_to_watchpoint.clear(); } void -WatchpointLocationList::GetListMutex (Mutex::Locker &locker) +WatchpointList::GetListMutex (Mutex::Locker &locker) { return locker.Reset (m_mutex.GetMutex()); } Removed: lldb/trunk/source/Breakpoint/WatchpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocation.cpp?rev=141924&view=auto ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (removed) @@ -1,184 +0,0 @@ -//===-- WatchpointLocation.cpp ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Breakpoint/WatchpointLocation.h" - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Stream.h" - -using namespace lldb; -using namespace lldb_private; - -WatchpointLocation::WatchpointLocation (lldb::addr_t addr, size_t size, bool hardware) : - StoppointLocation (GetNextID(), addr, size, hardware), - m_target(NULL), - m_enabled(0), - m_is_hardware(hardware), - m_watch_read(0), - m_watch_write(0), - m_watch_was_read(0), - m_watch_was_written(0), - m_ignore_count(0), - m_callback(NULL), - m_callback_baton(NULL) -{ -} - -WatchpointLocation::~WatchpointLocation() -{ -} - -break_id_t -WatchpointLocation::GetNextID() -{ - static break_id_t g_next_ID = 0; - return ++g_next_ID; -} - -bool -WatchpointLocation::SetCallback (WatchpointHitCallback callback, void *callback_baton) -{ - m_callback = callback; - m_callback_baton = callback_baton; - return true; -} - -void -WatchpointLocation::SetDeclInfo (std::string &str) -{ - m_decl_str = str; - return; -} - - -bool -WatchpointLocation::IsHardware () const -{ - return m_is_hardware; -} - -// RETURNS - true if we should stop at this breakpoint, false if we -// should continue. - -bool -WatchpointLocation::ShouldStop (StoppointCallbackContext *context) -{ - ++m_hit_count; - - if (!IsEnabled()) - return false; - - if (m_hit_count <= GetIgnoreCount()) - return false; - - uint32_t access = 0; - if (m_watch_was_read) - access |= LLDB_WATCH_TYPE_READ; - if (m_watch_was_written) - access |= LLDB_WATCH_TYPE_WRITE; - - if (m_callback) - return m_callback(m_callback_baton, context, GetID(), access); - else - return true; -} - -void -WatchpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level) -{ - DumpWithLevel(s, level); - return; -} - -void -WatchpointLocation::Dump(Stream *s) const -{ - DumpWithLevel(s, lldb::eDescriptionLevelBrief); -} - -void -WatchpointLocation::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const -{ - if (s == NULL) - return; - - assert(description_level >= lldb::eDescriptionLevelBrief && - description_level <= lldb::eDescriptionLevelVerbose); - - s->Printf("WatchpointLocation %u: addr = 0x%8.8llx size = %zu state = %s type = %s%s", - GetID(), - (uint64_t)m_addr, - m_byte_size, - m_enabled ? "enabled" : "disabled", - m_watch_read ? "r" : "", - m_watch_write ? "w" : ""); - - if (description_level >= lldb::eDescriptionLevelFull) - s->Printf("\n declare @ '%s'", m_decl_str.c_str()); - - if (description_level >= lldb::eDescriptionLevelVerbose) - if (m_callback) - s->Printf("\n hw_index = %i hit_count = %-4u ignore_count = %-4u callback = %8p baton = %8p", - GetHardwareIndex(), - GetHitCount(), - GetIgnoreCount(), - m_callback, - m_callback_baton); - else - s->Printf("\n hw_index = %i hit_count = %-4u ignore_count = %-4u", - GetHardwareIndex(), - GetHitCount(), - GetIgnoreCount()); -} - -bool -WatchpointLocation::IsEnabled() const -{ - return m_enabled; -} - -void -WatchpointLocation::SetEnabled(bool enabled) -{ - if (!enabled) - SetHardwareIndex(LLDB_INVALID_INDEX32); - m_enabled = enabled; -} - -void -WatchpointLocation::SetWatchpointType (uint32_t type) -{ - m_watch_read = (type & LLDB_WATCH_TYPE_READ) != 0; - m_watch_write = (type & LLDB_WATCH_TYPE_WRITE) != 0; -} - -bool -WatchpointLocation::WatchpointRead () const -{ - return m_watch_read != 0; -} -bool -WatchpointLocation::WatchpointWrite () const -{ - return m_watch_write != 0; -} -uint32_t -WatchpointLocation::GetIgnoreCount () const -{ - return m_ignore_count; -} - -void -WatchpointLocation::SetIgnoreCount (uint32_t n) -{ - m_ignore_count = n; -} Removed: lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp?rev=141924&view=auto ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (original) +++ lldb/trunk/source/Breakpoint/WatchpointLocationList.cpp (removed) @@ -1,242 +0,0 @@ -//===-- WatchpointLocationList.cpp ------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Breakpoint/WatchpointLocationList.h" -#include "lldb/Breakpoint/WatchpointLocation.h" - -using namespace lldb; -using namespace lldb_private; - -WatchpointLocationList::WatchpointLocationList() : - m_address_to_location (), - m_mutex (Mutex::eMutexTypeRecursive) -{ -} - -WatchpointLocationList::~WatchpointLocationList() -{ -} - -// Add watchpoint loc to the list. However, if the element already exists in the -// list, then replace it with the input one. - -lldb::watch_id_t -WatchpointLocationList::Add (const WatchpointLocationSP &wp_loc_sp) -{ - Mutex::Locker locker (m_mutex); - lldb::addr_t wp_addr = wp_loc_sp->GetLoadAddress(); - addr_map::iterator iter = m_address_to_location.find(wp_addr); - - if (iter == m_address_to_location.end()) - m_address_to_location.insert(iter, addr_map::value_type(wp_addr, wp_loc_sp)); - else - m_address_to_location[wp_addr] = wp_loc_sp; - - return wp_loc_sp->GetID(); -} - -void -WatchpointLocationList::Dump (Stream *s) const -{ - DumpWithLevel(s, lldb::eDescriptionLevelBrief); -} - -void -WatchpointLocationList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const -{ - Mutex::Locker locker (m_mutex); - s->Printf("%p: ", this); - //s->Indent(); - s->Printf("WatchpointLocationList with %zu WatchpointLocations:\n", - m_address_to_location.size()); - s->IndentMore(); - addr_map::const_iterator pos, end = m_address_to_location.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) - pos->second->DumpWithLevel(s, description_level); - s->IndentLess(); -} - -const WatchpointLocationSP -WatchpointLocationList::FindByAddress (lldb::addr_t addr) const -{ - WatchpointLocationSP wp_loc_sp; - Mutex::Locker locker (m_mutex); - if (!m_address_to_location.empty()) - { - addr_map::const_iterator pos = m_address_to_location.find (addr); - if (pos != m_address_to_location.end()) - wp_loc_sp = pos->second; - } - - return wp_loc_sp; -} - -class WatchpointLocationIDMatches -{ -public: - WatchpointLocationIDMatches (lldb::watch_id_t watch_id) : - m_watch_id(watch_id) - { - } - - bool operator() (std::pair val_pair) const - { - return m_watch_id == val_pair.second.get()->GetID(); - } - -private: - const lldb::watch_id_t m_watch_id; -}; - -WatchpointLocationList::addr_map::iterator -WatchpointLocationList::GetIDIterator (lldb::watch_id_t watch_id) -{ - return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range - WatchpointLocationIDMatches(watch_id)); // Predicate -} - -WatchpointLocationList::addr_map::const_iterator -WatchpointLocationList::GetIDConstIterator (lldb::watch_id_t watch_id) const -{ - return std::find_if(m_address_to_location.begin(), m_address_to_location.end(), // Search full range - WatchpointLocationIDMatches(watch_id)); // Predicate -} - -WatchpointLocationSP -WatchpointLocationList::FindByID (lldb::watch_id_t watch_id) const -{ - WatchpointLocationSP wp_loc_sp; - Mutex::Locker locker (m_mutex); - addr_map::const_iterator pos = GetIDConstIterator(watch_id); - if (pos != m_address_to_location.end()) - wp_loc_sp = pos->second; - - return wp_loc_sp; -} - -lldb::watch_id_t -WatchpointLocationList::FindIDByAddress (lldb::addr_t addr) -{ - WatchpointLocationSP wp_loc_sp = FindByAddress (addr); - if (wp_loc_sp) - { - return wp_loc_sp->GetID(); - } - return LLDB_INVALID_WATCH_ID; -} - -WatchpointLocationSP -WatchpointLocationList::GetByIndex (uint32_t i) -{ - Mutex::Locker locker (m_mutex); - WatchpointLocationSP wp_loc_sp; - if (i < m_address_to_location.size()) - { - addr_map::const_iterator pos = m_address_to_location.begin(); - std::advance(pos, i); - wp_loc_sp = pos->second; - } - return wp_loc_sp; -} - -const WatchpointLocationSP -WatchpointLocationList::GetByIndex (uint32_t i) const -{ - Mutex::Locker locker (m_mutex); - WatchpointLocationSP wp_loc_sp; - if (i < m_address_to_location.size()) - { - addr_map::const_iterator pos = m_address_to_location.begin(); - std::advance(pos, i); - wp_loc_sp = pos->second; - } - return wp_loc_sp; -} - -bool -WatchpointLocationList::Remove (lldb::watch_id_t watch_id) -{ - Mutex::Locker locker (m_mutex); - addr_map::iterator pos = GetIDIterator(watch_id); - if (pos != m_address_to_location.end()) - { - m_address_to_location.erase(pos); - return true; - } - return false; -} - -uint32_t -WatchpointLocationList::GetHitCount () const -{ - uint32_t hit_count = 0; - Mutex::Locker locker (m_mutex); - addr_map::const_iterator pos, end = m_address_to_location.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) - hit_count += pos->second->GetHitCount(); - return hit_count; -} - -bool -WatchpointLocationList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id) -{ - - WatchpointLocationSP wp_loc_sp = FindByID (watch_id); - if (wp_loc_sp) - { - // Let the WatchpointLocation decide if it should stop here (could not have - // reached it's target hit count yet, or it could have a callback - // that decided it shouldn't stop. - return wp_loc_sp->ShouldStop (context); - } - // We should stop here since this WatchpointLocation isn't valid anymore or it - // doesn't exist. - return true; -} - -void -WatchpointLocationList::GetDescription (Stream *s, lldb::DescriptionLevel level) -{ - Mutex::Locker locker (m_mutex); - addr_map::iterator pos, end = m_address_to_location.end(); - - for (pos = m_address_to_location.begin(); pos != end; ++pos) - { - s->Printf(" "); - pos->second->Dump(s); - } -} - -void -WatchpointLocationList::SetEnabledAll (bool enabled) -{ - Mutex::Locker locker(m_mutex); - - addr_map::iterator pos, end = m_address_to_location.end(); - for (pos = m_address_to_location.begin(); pos != end; ++pos) - pos->second->SetEnabled (enabled); -} - -void -WatchpointLocationList::RemoveAll () -{ - Mutex::Locker locker(m_mutex); - m_address_to_location.clear(); -} - -void -WatchpointLocationList::GetListMutex (Mutex::Locker &locker) -{ - return locker.Reset (m_mutex.GetMutex()); -} Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Oct 13 19:42:25 2011 @@ -14,7 +14,7 @@ #include // Other libraries and framework includes // Project includes -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Core/DataVisualization.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" @@ -550,19 +550,19 @@ size = m_option_watchpoint.watch_size; } uint32_t watch_type = m_option_watchpoint.watch_type; - WatchpointLocation *wp_loc = exe_ctx.GetTargetRef().CreateWatchpointLocation(addr, size, watch_type).get(); - if (wp_loc) + Watchpoint *wp = exe_ctx.GetTargetRef().CreateWatchpoint(addr, size, watch_type).get(); + if (wp) { if (var_sp && var_sp->GetDeclaration().GetFile()) { StreamString ss; // True to show fullpath for declaration file. var_sp->GetDeclaration().DumpStopContext(&ss, true); - wp_loc->SetDeclInfo(ss.GetString()); + wp->SetDeclInfo(ss.GetString()); } StreamString ss; output_stream.Printf("Watchpoint created: "); - wp_loc->GetDescription(&output_stream, lldb::eDescriptionLevelFull); + wp->GetDescription(&output_stream, lldb::eDescriptionLevelFull); output_stream.EOL(); result.SetStatus(eReturnStatusSuccessFinishResult); } @@ -571,7 +571,7 @@ result.AppendErrorWithFormat("Watchpoint creation failed.\n"); result.SetStatus(eReturnStatusFailed); } - return (wp_loc != NULL); + return (wp != NULL); } } else Modified: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp Thu Oct 13 19:42:25 2011 @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Breakpoint/WatchpointLocation.h" -#include "lldb/Breakpoint/WatchpointLocationList.h" +#include "lldb/Breakpoint/Watchpoint.h" +#include "lldb/Breakpoint/WatchpointList.h" #include "lldb/Core/StreamString.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -27,10 +27,10 @@ using namespace lldb_private; static void -AddWatchpointDescription(Stream *s, WatchpointLocation *wp_loc, lldb::DescriptionLevel level) +AddWatchpointDescription(Stream *s, Watchpoint *wp, lldb::DescriptionLevel level) { s->IndentMore(); - wp_loc->GetDescription(s, level); + wp->GetDescription(s, level); s->IndentLess(); s->EOL(); } @@ -280,9 +280,9 @@ return true; } - const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList(); + const WatchpointList &watchpoints = target->GetWatchpointList(); Mutex::Locker locker; - target->GetWatchpointLocationList().GetListMutex(locker); + target->GetWatchpointList().GetListMutex(locker); size_t num_watchpoints = watchpoints.GetSize(); @@ -301,8 +301,8 @@ result.AppendMessage ("Current watchpoints:"); for (size_t i = 0; i < num_watchpoints; ++i) { - WatchpointLocation *wp_loc = watchpoints.GetByIndex(i).get(); - AddWatchpointDescription(&output_stream, wp_loc, m_options.m_level); + Watchpoint *wp = watchpoints.GetByIndex(i).get(); + AddWatchpointDescription(&output_stream, wp, m_options.m_level); } result.SetStatus(eReturnStatusSuccessFinishNoResult); } @@ -320,9 +320,9 @@ const size_t size = wp_ids.size(); for (size_t i = 0; i < size; ++i) { - WatchpointLocation *wp_loc = watchpoints.FindByID(wp_ids[i]).get(); - if (wp_loc) - AddWatchpointDescription(&output_stream, wp_loc, m_options.m_level); + Watchpoint *wp = watchpoints.FindByID(wp_ids[i]).get(); + if (wp) + AddWatchpointDescription(&output_stream, wp, m_options.m_level); result.SetStatus(eReturnStatusSuccessFinishNoResult); } } @@ -359,9 +359,9 @@ return false; Mutex::Locker locker; - target->GetWatchpointLocationList().GetListMutex(locker); + target->GetWatchpointList().GetListMutex(locker); - const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList(); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -375,7 +375,7 @@ if (args.GetArgumentCount() == 0) { // No watchpoint selected; enable all currently set watchpoints. - target->EnableAllWatchpointLocations(); + target->EnableAllWatchpoints(); result.AppendMessageWithFormat("All watchpoints enabled. (%lu watchpoints)\n", num_watchpoints); result.SetStatus(eReturnStatusSuccessFinishNoResult); } @@ -393,7 +393,7 @@ int count = 0; const size_t size = wp_ids.size(); for (size_t i = 0; i < size; ++i) - if (target->EnableWatchpointLocationByID(wp_ids[i])) + if (target->EnableWatchpointByID(wp_ids[i])) ++count; result.AppendMessageWithFormat("%d watchpoints enabled.\n", count); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -431,9 +431,9 @@ return false; Mutex::Locker locker; - target->GetWatchpointLocationList().GetListMutex(locker); + target->GetWatchpointList().GetListMutex(locker); - const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList(); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); if (num_watchpoints == 0) @@ -446,7 +446,7 @@ if (args.GetArgumentCount() == 0) { // No watchpoint selected; disable all currently set watchpoints. - if (target->DisableAllWatchpointLocations()) + if (target->DisableAllWatchpoints()) { result.AppendMessageWithFormat("All watchpoints disabled. (%lu watchpoints)\n", num_watchpoints); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -471,7 +471,7 @@ int count = 0; const size_t size = wp_ids.size(); for (size_t i = 0; i < size; ++i) - if (target->DisableWatchpointLocationByID(wp_ids[i])) + if (target->DisableWatchpointByID(wp_ids[i])) ++count; result.AppendMessageWithFormat("%d watchpoints disabled.\n", count); result.SetStatus(eReturnStatusSuccessFinishNoResult); @@ -509,9 +509,9 @@ return false; Mutex::Locker locker; - target->GetWatchpointLocationList().GetListMutex(locker); + target->GetWatchpointList().GetListMutex(locker); - const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList(); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -530,7 +530,7 @@ } else { - target->RemoveAllWatchpointLocations(); + target->RemoveAllWatchpoints(); result.AppendMessageWithFormat("All watchpoints removed. (%lu watchpoints)\n", num_watchpoints); } result.SetStatus (eReturnStatusSuccessFinishNoResult); @@ -549,7 +549,7 @@ int count = 0; const size_t size = wp_ids.size(); for (size_t i = 0; i < size; ++i) - if (target->RemoveWatchpointLocationByID(wp_ids[i])) + if (target->RemoveWatchpointByID(wp_ids[i])) ++count; result.AppendMessageWithFormat("%d watchpoints deleted.\n",count); result.SetStatus (eReturnStatusSuccessFinishNoResult); @@ -651,9 +651,9 @@ return false; Mutex::Locker locker; - target->GetWatchpointLocationList().GetListMutex(locker); + target->GetWatchpointList().GetListMutex(locker); - const WatchpointLocationList &watchpoints = target->GetWatchpointLocationList(); + const WatchpointList &watchpoints = target->GetWatchpointList(); size_t num_watchpoints = watchpoints.GetSize(); @@ -666,7 +666,7 @@ if (args.GetArgumentCount() == 0) { - target->IgnoreAllWatchpointLocations(m_options.m_ignore_count); + target->IgnoreAllWatchpoints(m_options.m_ignore_count); result.AppendMessageWithFormat("All watchpoints ignored. (%lu watchpoints)\n", num_watchpoints); result.SetStatus (eReturnStatusSuccessFinishNoResult); } @@ -684,7 +684,7 @@ int count = 0; const size_t size = wp_ids.size(); for (size_t i = 0; i < size; ++i) - if (target->IgnoreWatchpointLocationByID(wp_ids[i], m_options.m_ignore_count)) + if (target->IgnoreWatchpointByID(wp_ids[i], m_options.m_ignore_count)) ++count; result.AppendMessageWithFormat("%d watchpoints ignored.\n",count); result.SetStatus (eReturnStatusSuccessFinishNoResult); Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Oct 13 19:42:25 2011 @@ -607,7 +607,7 @@ } Error -ProcessKDP::EnableWatchpoint (WatchpointLocation *wp) +ProcessKDP::EnableWatchpoint (Watchpoint *wp) { Error error; error.SetErrorString ("watchpoints are not suppported in kdp remote debugging"); @@ -615,7 +615,7 @@ } Error -ProcessKDP::DisableWatchpoint (WatchpointLocation *wp) +ProcessKDP::DisableWatchpoint (Watchpoint *wp) { Error error; error.SetErrorString ("watchpoints are not suppported in kdp remote debugging"); Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.h Thu Oct 13 19:42:25 2011 @@ -178,10 +178,10 @@ // Process Watchpoints //---------------------------------------------------------------------- virtual lldb_private::Error - EnableWatchpoint (lldb_private::WatchpointLocation *wp_loc); + EnableWatchpoint (lldb_private::Watchpoint *wp); virtual lldb_private::Error - DisableWatchpoint (lldb_private::WatchpointLocation *wp_loc); + DisableWatchpoint (lldb_private::Watchpoint *wp); CommunicationKDP & GetCommunication() Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp Thu Oct 13 19:42:25 2011 @@ -21,7 +21,7 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Unwind.h" -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "ProcessKDP.h" #include "ProcessKDPLog.h" Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Thu Oct 13 19:42:25 2011 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/StreamString.h" #include "lldb/Target/Process.h" @@ -306,15 +306,15 @@ // It's a watchpoint, then. // The exc_sub_code indicates the data break address. - lldb::WatchpointLocationSP wp_loc_sp = - thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByAddress((lldb::addr_t)exc_sub_code); - if (wp_loc_sp) + lldb::WatchpointSP wp_sp = + thread.GetProcess().GetTarget().GetWatchpointList().FindByAddress((lldb::addr_t)exc_sub_code); + if (wp_sp) { // Debugserver may piggyback the hardware index of the fired watchpoint in the exception data. // Set the hardware index if that's the case. if (exc_data_count >=3) - wp_loc_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code); - return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_loc_sp->GetID()); + wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code); + return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_sp->GetID()); } } else if (exc_code == 2) // EXC_I386_BPT Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Oct 13 19:42:25 2011 @@ -22,7 +22,7 @@ // Other libraries and framework includes -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Interpreter/Args.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Debugger.h" @@ -1900,7 +1900,7 @@ // Pre-requisite: wp != NULL. static GDBStoppointType -GetGDBStoppointType (WatchpointLocation *wp) +GetGDBStoppointType (Watchpoint *wp) { assert(wp); bool watch_read = wp->WatchpointRead(); @@ -1917,7 +1917,7 @@ } Error -ProcessGDBRemote::EnableWatchpoint (WatchpointLocation *wp) +ProcessGDBRemote::EnableWatchpoint (Watchpoint *wp) { Error error; if (wp) @@ -1951,7 +1951,7 @@ } else { - error.SetErrorString("Watchpoint location argument was NULL."); + error.SetErrorString("Watchpoint argument was NULL."); } if (error.Success()) error.SetErrorToGenericError(); @@ -1959,7 +1959,7 @@ } Error -ProcessGDBRemote::DisableWatchpoint (WatchpointLocation *wp) +ProcessGDBRemote::DisableWatchpoint (Watchpoint *wp) { Error error; if (wp) @@ -1995,7 +1995,7 @@ } else { - error.SetErrorString("Watchpoint location argument was NULL."); + error.SetErrorString("Watchpoint argument was NULL."); } if (error.Success()) error.SetErrorToGenericError(); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h Thu Oct 13 19:42:25 2011 @@ -200,10 +200,10 @@ // Process Watchpoints //---------------------------------------------------------------------- virtual lldb_private::Error - EnableWatchpoint (lldb_private::WatchpointLocation *wp_loc); + EnableWatchpoint (lldb_private::Watchpoint *wp); virtual lldb_private::Error - DisableWatchpoint (lldb_private::WatchpointLocation *wp_loc); + DisableWatchpoint (lldb_private::Watchpoint *wp); virtual bool StartNoticingNewThreads(); Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Thu Oct 13 19:42:25 2011 @@ -19,7 +19,7 @@ #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Unwind.h" -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "ProcessGDBRemote.h" #include "ProcessGDBRemoteLog.h" Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Thu Oct 13 19:42:25 2011 @@ -1997,7 +1997,7 @@ Error -Process::EnableWatchpoint (WatchpointLocation *watchpoint) +Process::EnableWatchpoint (Watchpoint *watchpoint) { Error error; error.SetErrorString("watchpoints are not supported"); @@ -2005,7 +2005,7 @@ } Error -Process::DisableWatchpoint (WatchpointLocation *watchpoint) +Process::DisableWatchpoint (Watchpoint *watchpoint) { Error error; error.SetErrorString("watchpoints are not supported"); Modified: lldb/trunk/source/Target/StopInfo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Target/StopInfo.cpp (original) +++ lldb/trunk/source/Target/StopInfo.cpp Thu Oct 13 19:42:25 2011 @@ -19,7 +19,7 @@ #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/StreamString.h" #include "lldb/Expression/ClangUserExpression.h" @@ -349,9 +349,9 @@ if (m_should_stop_is_valid) return m_should_stop; - WatchpointLocationSP wp_loc_sp = - m_thread.GetProcess().GetTarget().GetWatchpointLocationList().FindByID(GetValue()); - if (wp_loc_sp) + WatchpointSP wp_sp = + m_thread.GetProcess().GetTarget().GetWatchpointList().FindByID(GetValue()); + if (wp_sp) { // Check if we should stop at a watchpoint. StoppointCallbackContext context (event_ptr, @@ -360,7 +360,7 @@ m_thread.GetStackFrameAtIndex(0).get(), true); - m_should_stop = wp_loc_sp->ShouldStop (&context); + m_should_stop = wp_sp->ShouldStop (&context); } else { Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Thu Oct 13 19:42:25 2011 @@ -18,7 +18,7 @@ #include "lldb/Breakpoint/BreakpointResolverFileLine.h" #include "lldb/Breakpoint/BreakpointResolverFileRegex.h" #include "lldb/Breakpoint/BreakpointResolverName.h" -#include "lldb/Breakpoint/WatchpointLocation.h" +#include "lldb/Breakpoint/Watchpoint.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Event.h" #include "lldb/Core/Log.h" @@ -55,7 +55,7 @@ m_section_load_list (), m_breakpoint_list (false), m_internal_breakpoint_list (true), - m_watchpoint_location_list (), + m_watchpoint_list (), m_process_sp (), m_search_filter_sp (), m_image_search_paths (ImageSearchPathsChanged, this), @@ -126,8 +126,8 @@ // clean up needs some help from the process. m_breakpoint_list.ClearAllBreakpointSites(); m_internal_breakpoint_list.ClearAllBreakpointSites(); - // Disable watchpoint locations just on the debugger side. - DisableAllWatchpointLocations(false); + // Disable watchpoints just on the debugger side. + DisableAllWatchpoints(false); m_process_sp.reset(); } } @@ -167,7 +167,7 @@ m_breakpoint_list.RemoveAll(notify); m_internal_breakpoint_list.RemoveAll(notify); m_last_created_breakpoint.reset(); - m_last_created_watchpoint_location.reset(); + m_last_created_watchpoint.reset(); m_search_filter_sp.reset(); m_image_search_paths.Clear(notify); m_scratch_ast_context_ap.reset(); @@ -397,67 +397,66 @@ return (m_process_sp && m_process_sp->IsAlive()); } -// See also WatchpointLocation::SetWatchpointType(uint32_t type) and +// See also Watchpoint::SetWatchpointType(uint32_t type) and // the OptionGroupWatchpoint::WatchType enum type. -WatchpointLocationSP -Target::CreateWatchpointLocation(lldb::addr_t addr, size_t size, uint32_t type) +WatchpointSP +Target::CreateWatchpoint(lldb::addr_t addr, size_t size, uint32_t type) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf("Target::%s (addr = 0x%8.8llx size = %zu type = %u)\n", __FUNCTION__, addr, size, type); - WatchpointLocationSP wp_loc_sp; + WatchpointSP wp_sp; if (!ProcessIsValid()) - return wp_loc_sp; + return wp_sp; if (addr == LLDB_INVALID_ADDRESS || size == 0) - return wp_loc_sp; + return wp_sp; - // Currently we only support one watchpoint location per address, with total - // number of watchpoint locations limited by the hardware which the inferior - // is running on. - WatchpointLocationSP matched_sp = m_watchpoint_location_list.FindByAddress(addr); + // Currently we only support one watchpoint per address, with total number + // of watchpoints limited by the hardware which the inferior is running on. + WatchpointSP matched_sp = m_watchpoint_list.FindByAddress(addr); if (matched_sp) { size_t old_size = matched_sp->GetByteSize(); uint32_t old_type = (matched_sp->WatchpointRead() ? LLDB_WATCH_TYPE_READ : 0) | (matched_sp->WatchpointWrite() ? LLDB_WATCH_TYPE_WRITE : 0); - // Return the existing watchpoint location if both size and type match. + // Return the existing watchpoint if both size and type match. if (size == old_size && type == old_type) { - wp_loc_sp = matched_sp; - wp_loc_sp->SetEnabled(false); + wp_sp = matched_sp; + wp_sp->SetEnabled(false); } else { - // Nil the matched watchpoint location; we will be creating a new one. + // Nil the matched watchpoint; we will be creating a new one. m_process_sp->DisableWatchpoint(matched_sp.get()); - m_watchpoint_location_list.Remove(matched_sp->GetID()); + m_watchpoint_list.Remove(matched_sp->GetID()); } } - if (!wp_loc_sp) { - WatchpointLocation *new_loc = new WatchpointLocation(addr, size); - if (!new_loc) { - printf("WatchpointLocation ctor failed, out of memory?\n"); - return wp_loc_sp; + if (!wp_sp) { + Watchpoint *new_wp = new Watchpoint(addr, size); + if (!new_wp) { + printf("Watchpoint ctor failed, out of memory?\n"); + return wp_sp; } - new_loc->SetWatchpointType(type); - new_loc->SetTarget(this); - wp_loc_sp.reset(new_loc); - m_watchpoint_location_list.Add(wp_loc_sp); + new_wp->SetWatchpointType(type); + new_wp->SetTarget(this); + wp_sp.reset(new_wp); + m_watchpoint_list.Add(wp_sp); } - Error rc = m_process_sp->EnableWatchpoint(wp_loc_sp.get()); + Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (log) log->Printf("Target::%s (creation of watchpoint %s with id = %u)\n", __FUNCTION__, rc.Success() ? "succeeded" : "failed", - wp_loc_sp->GetID()); + wp_sp->GetID()); if (rc.Fail()) - wp_loc_sp.reset(); + wp_sp.reset(); else - m_last_created_watchpoint_location = wp_loc_sp; - return wp_loc_sp; + m_last_created_watchpoint = wp_sp; + return wp_sp; } void @@ -572,17 +571,17 @@ // The flag 'end_to_end', default to true, signifies that the operation is // performed end to end, for both the debugger and the debuggee. -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list -// for end to end operations. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end +// to end operations. bool -Target::RemoveAllWatchpointLocations (bool end_to_end) +Target::RemoveAllWatchpoints (bool end_to_end) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); if (!end_to_end) { - m_watchpoint_location_list.RemoveAll(); + m_watchpoint_list.RemoveAll(); return true; } @@ -591,32 +590,32 @@ if (!ProcessIsValid()) return false; - size_t num_watchpoints = m_watchpoint_location_list.GetSize(); + size_t num_watchpoints = m_watchpoint_list.GetSize(); for (size_t i = 0; i < num_watchpoints; ++i) { - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i); - if (!wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i); + if (!wp_sp) return false; - Error rc = m_process_sp->DisableWatchpoint(wp_loc_sp.get()); + Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } - m_watchpoint_location_list.RemoveAll (); + m_watchpoint_list.RemoveAll (); return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list -// for end to end operations. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to +// end operations. bool -Target::DisableAllWatchpointLocations (bool end_to_end) +Target::DisableAllWatchpoints (bool end_to_end) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); if (!end_to_end) { - m_watchpoint_location_list.SetEnabledAll(false); + m_watchpoint_list.SetEnabledAll(false); return true; } @@ -625,31 +624,31 @@ if (!ProcessIsValid()) return false; - size_t num_watchpoints = m_watchpoint_location_list.GetSize(); + size_t num_watchpoints = m_watchpoint_list.GetSize(); for (size_t i = 0; i < num_watchpoints; ++i) { - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i); - if (!wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i); + if (!wp_sp) return false; - Error rc = m_process_sp->DisableWatchpoint(wp_loc_sp.get()); + Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list -// for end to end operations. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to +// end operations. bool -Target::EnableAllWatchpointLocations (bool end_to_end) +Target::EnableAllWatchpoints (bool end_to_end) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); if (!end_to_end) { - m_watchpoint_location_list.SetEnabledAll(true); + m_watchpoint_list.SetEnabledAll(true); return true; } @@ -658,24 +657,24 @@ if (!ProcessIsValid()) return false; - size_t num_watchpoints = m_watchpoint_location_list.GetSize(); + size_t num_watchpoints = m_watchpoint_list.GetSize(); for (size_t i = 0; i < num_watchpoints; ++i) { - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i); - if (!wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i); + if (!wp_sp) return false; - Error rc = m_process_sp->EnableWatchpoint(wp_loc_sp.get()); + Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (rc.Fail()) return false; } return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list +// Assumption: Caller holds the list mutex lock for m_watchpoint_list // during these operations. bool -Target::IgnoreAllWatchpointLocations (uint32_t ignore_count) +Target::IgnoreAllWatchpoints (uint32_t ignore_count) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -684,21 +683,21 @@ if (!ProcessIsValid()) return false; - size_t num_watchpoints = m_watchpoint_location_list.GetSize(); + size_t num_watchpoints = m_watchpoint_list.GetSize(); for (size_t i = 0; i < num_watchpoints; ++i) { - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.GetByIndex(i); - if (!wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.GetByIndex(i); + if (!wp_sp) return false; - wp_loc_sp->SetIgnoreCount(ignore_count); + wp_sp->SetIgnoreCount(ignore_count); } return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool -Target::DisableWatchpointLocationByID (lldb::watch_id_t watch_id) +Target::DisableWatchpointByID (lldb::watch_id_t watch_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -707,10 +706,10 @@ if (!ProcessIsValid()) return false; - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.FindByID (watch_id); - if (wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.FindByID (watch_id); + if (wp_sp) { - Error rc = m_process_sp->DisableWatchpoint(wp_loc_sp.get()); + Error rc = m_process_sp->DisableWatchpoint(wp_sp.get()); if (rc.Success()) return true; @@ -719,9 +718,9 @@ return false; } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool -Target::EnableWatchpointLocationByID (lldb::watch_id_t watch_id) +Target::EnableWatchpointByID (lldb::watch_id_t watch_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -730,10 +729,10 @@ if (!ProcessIsValid()) return false; - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.FindByID (watch_id); - if (wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.FindByID (watch_id); + if (wp_sp) { - Error rc = m_process_sp->EnableWatchpoint(wp_loc_sp.get()); + Error rc = m_process_sp->EnableWatchpoint(wp_sp.get()); if (rc.Success()) return true; @@ -742,25 +741,25 @@ return false; } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool -Target::RemoveWatchpointLocationByID (lldb::watch_id_t watch_id) +Target::RemoveWatchpointByID (lldb::watch_id_t watch_id) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); - if (DisableWatchpointLocationByID (watch_id)) + if (DisableWatchpointByID (watch_id)) { - m_watchpoint_location_list.Remove(watch_id); + m_watchpoint_list.Remove(watch_id); return true; } return false; } -// Assumption: Caller holds the list mutex lock for m_watchpoint_location_list. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list. bool -Target::IgnoreWatchpointLocationByID (lldb::watch_id_t watch_id, uint32_t ignore_count) +Target::IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -769,10 +768,10 @@ if (!ProcessIsValid()) return false; - WatchpointLocationSP wp_loc_sp = m_watchpoint_location_list.FindByID (watch_id); - if (wp_loc_sp) + WatchpointSP wp_sp = m_watchpoint_list.FindByID (watch_id); + if (wp_sp) { - wp_loc_sp->SetIgnoreCount(ignore_count); + wp_sp->SetIgnoreCount(ignore_count); return true; } return false; Modified: lldb/trunk/test/lldbutil.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/lldbutil.py (original) +++ lldb/trunk/test/lldbutil.py Thu Oct 13 19:42:25 2011 @@ -105,8 +105,9 @@ def get_description(obj, option=None): """Calls lldb_obj.GetDescription() and returns a string, or None. - For SBTarget and SBBreakpointLocation lldb objects, an extra option can be - passed in to describe the detailed level of description desired: + For SBTarget, SBBreakpointLocation, and SBWatchpoint lldb objects, an extra + option can be passed in to describe the detailed level of description + desired: o lldb.eDescriptionLevelBrief o lldb.eDescriptionLevelFull o lldb.eDescriptionLevelVerbose @@ -114,7 +115,7 @@ method = getattr(obj, 'GetDescription') if not method: return None - tuple = (lldb.SBTarget, lldb.SBBreakpointLocation, lldb.SBWatchpointLocation) + tuple = (lldb.SBTarget, lldb.SBBreakpointLocation, lldb.SBWatchpoint) if isinstance(obj, tuple): if option is None: option = lldb.eDescriptionLevelBrief Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original) +++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Thu Oct 13 19:42:25 2011 @@ -350,14 +350,14 @@ sb_valuelist.fuzz_obj(obj) @python_api_test - def test_SBWatchpointLocation(self): - obj = lldb.SBWatchpointLocation() + def test_SBWatchpoint(self): + obj = lldb.SBWatchpoint() if self.TraceOn(): print obj self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. - import sb_watchpointlocation - sb_watchpointlocation.fuzz_obj(obj) + import sb_watchpoint + sb_watchpoint.fuzz_obj(obj) if __name__ == '__main__': Modified: lldb/trunk/test/python_api/default-constructor/sb_frame.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_frame.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_frame.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_frame.py Thu Oct 13 19:42:25 2011 @@ -33,6 +33,5 @@ obj.FindVariable("my_var", lldb.eDynamicCanRunTarget) obj.FindValue("your_var", lldb.eValueTypeVariableGlobal) obj.FindValue("your_var", lldb.eValueTypeVariableStatic, lldb.eDynamicCanRunTarget) - obj.WatchValue("global_var", lldb.eValueTypeVariableGlobal, lldb.LLDB_WATCH_TYPE_READ) obj.GetDescription(lldb.SBStream()) obj.Clear() Modified: lldb/trunk/test/python_api/default-constructor/sb_target.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_target.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_target.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_target.py Thu Oct 13 19:42:25 2011 @@ -40,14 +40,13 @@ obj.EnableAllBreakpoints() obj.DisableAllBreakpoints() obj.DeleteAllBreakpoints() - obj.GetNumWatchpointLocations() - obj.GetLastCreatedWatchpointLocation() - obj.GetWatchpointLocationAtIndex(0) - obj.WatchpointLocationDelete(0) - obj.FindWatchpointLocationByID(0) - obj.EnableAllWatchpointLocations() - obj.DisableAllWatchpointLocations() - obj.DeleteAllWatchpointLocations() + obj.GetNumWatchpoints() + obj.GetWatchpointAtIndex(0) + obj.DeleteWatchpoint(0) + obj.FindWatchpointByID(0) + obj.EnableAllWatchpoints() + obj.DisableAllWatchpoints() + obj.DeleteAllWatchpoints() obj.GetBroadcaster() obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief) obj.Clear() @@ -55,5 +54,5 @@ print module for bp in obj.breakpoint_iter(): print bp - for wp_loc in obj.watchpoint_location_iter(): + for wp_loc in obj.watchpoint_iter(): print wp_loc Modified: lldb/trunk/test/python_api/default-constructor/sb_value.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_value.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_value.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_value.py Thu Oct 13 19:42:25 2011 @@ -33,5 +33,7 @@ obj.GetDescription(stream) obj.GetExpressionPath(stream) obj.GetExpressionPath(stream, True) + obj.Watch(True, True, False) + obj.WatchPointee(True, False, True) for child_val in obj: print child_val Removed: lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py?rev=141924&view=auto ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_watchpointlocation.py (removed) @@ -1,18 +0,0 @@ -""" -Fuzz tests an object after the default construction to make sure it does not crash lldb. -""" - -import sys -import lldb - -def fuzz_obj(obj): - obj.GetID() - obj.GetHardwareIndex() - obj.GetWatchAddress() - obj.GetWatchSize() - obj.SetEnabled(True) - obj.IsEnabled() - obj.GetHitCount() - obj.GetIgnoreCount() - obj.SetIgnoreCount(5) - obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelVerbose) Modified: lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py (original) +++ lldb/trunk/test/python_api/watchpoint/TestSetWatchpoint.py Thu Oct 13 19:42:25 2011 @@ -1,5 +1,5 @@ """ -Use lldb Python SBFrame API to create a watchpoint for read_write of 'globl' var. +Use lldb Python SBValue API to create a watchpoint for read_write of 'globl' var. """ import os, time @@ -23,13 +23,13 @@ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test def test_watch_val_with_dsym(self): - """Exercise SBFrame.WatchValue() API to set a watchpoint.""" + """Exercise SBValue.Watch() API to set a watchpoint.""" self.buildDsym() self.do_set_watchpoint() @python_api_test def test_watch_val_with_dwarf(self): - """Exercise SBFrame.WatchValue() API to set a watchpoint.""" + """Exercise SBValue.Watch() API to set a watchpoint.""" self.buildDwarf() self.do_set_watchpoint() @@ -57,12 +57,19 @@ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) frame0 = thread.GetFrameAtIndex(0) - value = frame0.WatchValue('global', - lldb.eValueTypeVariableGlobal, - lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE) - self.assertTrue(value, "Successfully found the variable and set a watchpoint") + # Watch 'global' for read and write. + value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) + watchpoint = value.Watch(True, True, True) + self.assertTrue(value and watchpoint, + "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) + # Hide stdout if not running with '-t' option. + if not self.TraceOn(): + self.HideStdout() + + print watchpoint + # Continue. Expect the program to stop due to the variable being written to. process.Continue() Modified: lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py (original) +++ lldb/trunk/test/python_api/watchpoint/TestWatchpointIgnoreCount.py Thu Oct 13 19:42:25 2011 @@ -1,5 +1,5 @@ """ -Use lldb Python SBWatchpointLocation API to set the ignore count. +Use lldb Python SBWatchpoint API to set the ignore count. """ import os, time @@ -22,19 +22,19 @@ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test - def test_set_watch_loc_ignore_count_with_dsym(self): - """Test SBWatchpointLocation.SetIgnoreCount() API.""" + def test_set_watch_ignore_count_with_dsym(self): + """Test SBWatchpoint.SetIgnoreCount() API.""" self.buildDsym() - self.do_watchpoint_location_ignore_count() + self.do_watchpoint_ignore_count() @python_api_test - def test_set_watch_loc_ignore_count_with_dwarf(self): - """Test SBWatchpointLocation.SetIgnoreCount() API.""" + def test_set_watch_ignore_count_with_dwarf(self): + """Test SBWatchpoint.SetIgnoreCount() API.""" self.buildDwarf() - self.do_watchpoint_location_ignore_count() + self.do_watchpoint_ignore_count() - def do_watchpoint_location_ignore_count(self): - """Test SBWatchpointLocation.SetIgnoreCount() API.""" + def do_watchpoint_ignore_count(self): + """Test SBWatchpoint.SetIgnoreCount() API.""" exe = os.path.join(os.getcwd(), "a.out") # Create a target by the debugger. @@ -58,10 +58,10 @@ frame0 = thread.GetFrameAtIndex(0) # Watch 'global' for read and write. - value = frame0.WatchValue('global', - lldb.eValueTypeVariableGlobal, - lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE) - self.assertTrue(value, "Successfully found the variable and set a watchpoint") + value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) + watchpoint = value.Watch(True, True, True) + self.assertTrue(value and watchpoint, + "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) # Hide stdout if not running with '-t' option. @@ -69,30 +69,28 @@ self.HideStdout() # There should be only 1 watchpoint location under the target. - self.assertTrue(target.GetNumWatchpointLocations() == 1) - wp_loc = target.GetWatchpointLocationAtIndex(0) - last_created = target.GetLastCreatedWatchpointLocation() - self.assertTrue(wp_loc == last_created) - self.assertTrue(wp_loc.IsEnabled()) - self.assertTrue(wp_loc.GetIgnoreCount() == 0) - watch_id = wp_loc.GetID() + self.assertTrue(target.GetNumWatchpoints() == 1) + watchpoint = target.GetWatchpointAtIndex(0) + self.assertTrue(watchpoint.IsEnabled()) + self.assertTrue(watchpoint.GetIgnoreCount() == 0) + watch_id = watchpoint.GetID() self.assertTrue(watch_id != 0) - print wp_loc + print watchpoint # Now immediately set the ignore count to 2. When we continue, expect the # inferior to run to its completion without stopping due to watchpoint. - wp_loc.SetIgnoreCount(2) - print wp_loc + watchpoint.SetIgnoreCount(2) + print watchpoint process.Continue() # At this point, the inferior process should have exited. self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) # Verify some vital statistics. - self.assertTrue(wp_loc) - self.assertTrue(wp_loc.GetWatchSize() == 4) - self.assertTrue(wp_loc.GetHitCount() == 2) - print wp_loc + self.assertTrue(watchpoint) + self.assertTrue(watchpoint.GetWatchSize() == 4) + self.assertTrue(watchpoint.GetHitCount() == 2) + print watchpoint if __name__ == '__main__': Copied: lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py (from r141905, lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py?p2=lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py&p1=lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py&r1=141905&r2=141925&rev=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py (original) +++ lldb/trunk/test/python_api/watchpoint/TestWatchpointIter.py Thu Oct 13 19:42:25 2011 @@ -8,7 +8,7 @@ import lldb, lldbutil from lldbtest import * -class WatchpointLocationIteratorTestCase(TestBase): +class WatchpointIteratorTestCase(TestBase): mydir = os.path.join("python_api", "watchpoint") @@ -22,19 +22,19 @@ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test - def test_watch_loc_iter_with_dsym(self): - """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations.""" + def test_watch_iter_with_dsym(self): + """Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints.""" self.buildDsym() - self.do_watchpoint_location_iter() + self.do_watchpoint_iter() @python_api_test - def test_watch_loc_iter_with_dwarf(self): - """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations.""" + def test_watch_iter_with_dwarf(self): + """Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints.""" self.buildDwarf() - self.do_watchpoint_location_iter() + self.do_watchpoint_iter() - def do_watchpoint_location_iter(self): - """Use SBTarget.watchpoint_location_iter() to do Pythonic iteration on the available watchpoint locations.""" + def do_watchpoint_iter(self): + """Use SBTarget.watchpoint_iter() to do Pythonic iteration on the available watchpoints.""" exe = os.path.join(os.getcwd(), "a.out") # Create a target by the debugger. @@ -57,19 +57,21 @@ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) frame0 = thread.GetFrameAtIndex(0) - value = frame0.WatchValue('global', - lldb.eValueTypeVariableGlobal, - lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE) - self.assertTrue(value, "Successfully found the variable and set a watchpoint") + # Watch 'global' for read and write. + value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal) + watchpoint = value.Watch(True, True, True) + self.assertTrue(value and watchpoint, + "Successfully found the variable and set a watchpoint") self.DebugSBValue(value) + # Hide stdout if not running with '-t' option. + if not self.TraceOn(): + self.HideStdout() + # There should be only 1 watchpoint location under the target. - self.assertTrue(target.GetNumWatchpointLocations() == 1) - wp_loc = target.GetWatchpointLocationAtIndex(0) - last_created = target.GetLastCreatedWatchpointLocation() - self.assertTrue(wp_loc == last_created) - self.assertTrue(wp_loc.IsEnabled()) - watch_id = wp_loc.GetID() + self.assertTrue(target.GetNumWatchpoints() == 1) + self.assertTrue(watchpoint.IsEnabled()) + watch_id = watchpoint.GetID() self.assertTrue(watch_id != 0) # Continue. Expect the program to stop due to the variable being written to. @@ -89,17 +91,17 @@ # We currently only support hardware watchpoint. Verify that we have a # meaningful hardware index at this point. Exercise the printed repr of # SBWatchpointLocation. - print wp_loc - self.assertTrue(wp_loc.GetHardwareIndex() != -1) + print watchpoint + self.assertTrue(watchpoint.GetHardwareIndex() != -1) - # SBWatchpointLocation.GetDescription() takes a description level arg. - print lldbutil.get_description(wp_loc, lldb.eDescriptionLevelFull) + # SBWatchpoint.GetDescription() takes a description level arg. + print lldbutil.get_description(watchpoint, lldb.eDescriptionLevelFull) # Now disable the 'rw' watchpoint. The program won't stop when it reads # 'global' next. - wp_loc.SetEnabled(False) - self.assertTrue(wp_loc.GetHardwareIndex() == -1) - self.assertFalse(wp_loc.IsEnabled()) + watchpoint.SetEnabled(False) + self.assertTrue(watchpoint.GetHardwareIndex() == -1) + self.assertFalse(watchpoint.IsEnabled()) # Continue. The program does not stop again when the variable is being # read from because the watchpoint location has been disabled. @@ -109,11 +111,11 @@ self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) # Verify some vital statistics and exercise the iterator API. - for wp_loc in target.watchpoint_location_iter(): - self.assertTrue(wp_loc) - self.assertTrue(wp_loc.GetWatchSize() == 4) - self.assertTrue(wp_loc.GetHitCount() == 1) - print wp_loc + for watchpoint in target.watchpoint_iter(): + self.assertTrue(watchpoint) + self.assertTrue(watchpoint.GetWatchSize() == 4) + self.assertTrue(watchpoint.GetHitCount() == 1) + print watchpoint if __name__ == '__main__': Removed: lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py?rev=141924&view=auto ============================================================================== --- lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py (original) +++ lldb/trunk/test/python_api/watchpoint/TestWatchpointLocationIter.py (removed) @@ -1,123 +0,0 @@ -""" -Use lldb Python SBTarget API to iterate on the watchpoint(s) for the target. -""" - -import os, time -import re -import unittest2 -import lldb, lldbutil -from lldbtest import * - -class WatchpointLocationIteratorTestCase(TestBase): - - mydir = os.path.join("python_api", "watchpoint") - - def setUp(self): - # Call super's setUp(). - TestBase.setUp(self) - # Our simple source filename. - self.source = 'main.c' - # Find the line number to break inside main(). - self.line = line_number(self.source, '// Set break point at this line.') - - @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - @python_api_test - def test_watch_loc_iter_with_dsym(self): - """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations.""" - self.buildDsym() - self.do_watchpoint_location_iter() - - @python_api_test - def test_watch_loc_iter_with_dwarf(self): - """Exercise SBTarget.watchpoint_location_iter() API to iterate on the available watchpoint locations.""" - self.buildDwarf() - self.do_watchpoint_location_iter() - - def do_watchpoint_location_iter(self): - """Use SBTarget.watchpoint_location_iter() to do Pythonic iteration on the available watchpoint locations.""" - exe = os.path.join(os.getcwd(), "a.out") - - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Create a breakpoint on main.c in order to set our watchpoint later. - breakpoint = target.BreakpointCreateByLocation(self.source, self.line) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Now launch the process, and do not stop at the entry point. - process = target.LaunchSimple(None, None, os.getcwd()) - - # We should be stopped due to the breakpoint. Get frame #0. - process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) - frame0 = thread.GetFrameAtIndex(0) - - value = frame0.WatchValue('global', - lldb.eValueTypeVariableGlobal, - lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE) - self.assertTrue(value, "Successfully found the variable and set a watchpoint") - self.DebugSBValue(value) - - # There should be only 1 watchpoint location under the target. - self.assertTrue(target.GetNumWatchpointLocations() == 1) - wp_loc = target.GetWatchpointLocationAtIndex(0) - last_created = target.GetLastCreatedWatchpointLocation() - self.assertTrue(wp_loc == last_created) - self.assertTrue(wp_loc.IsEnabled()) - watch_id = wp_loc.GetID() - self.assertTrue(watch_id != 0) - - # Continue. Expect the program to stop due to the variable being written to. - process.Continue() - - # Hide stdout if not running with '-t' option. - if not self.TraceOn(): - self.HideStdout() - - # Print the stack traces. - lldbutil.print_stacktraces(process) - - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint) - self.assertTrue(thread, "The thread stopped due to watchpoint") - self.DebugSBValue(value) - - # We currently only support hardware watchpoint. Verify that we have a - # meaningful hardware index at this point. Exercise the printed repr of - # SBWatchpointLocation. - print wp_loc - self.assertTrue(wp_loc.GetHardwareIndex() != -1) - - # SBWatchpointLocation.GetDescription() takes a description level arg. - print lldbutil.get_description(wp_loc, lldb.eDescriptionLevelFull) - - # Now disable the 'rw' watchpoint. The program won't stop when it reads - # 'global' next. - wp_loc.SetEnabled(False) - self.assertTrue(wp_loc.GetHardwareIndex() == -1) - self.assertFalse(wp_loc.IsEnabled()) - - # Continue. The program does not stop again when the variable is being - # read from because the watchpoint location has been disabled. - process.Continue() - - # At this point, the inferior process should have exited. - self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED) - - # Verify some vital statistics and exercise the iterator API. - for wp_loc in target.watchpoint_location_iter(): - self.assertTrue(wp_loc) - self.assertTrue(wp_loc.GetWatchSize() == 4) - self.assertTrue(wp_loc.GetHitCount() == 1) - print wp_loc - - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py?rev=141925&r1=141924&r2=141925&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (original) +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Thu Oct 13 19:42:25 2011 @@ -1,5 +1,5 @@ """ -Use lldb Python SBFrame.WatchLocation() API to create a watchpoint for write of '*g_char_ptr'. +Use lldb Python SBValue.WatchPointee() API to create a watchpoint for write of '*g_char_ptr'. """ import os, time @@ -59,12 +59,23 @@ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) frame0 = thread.GetFrameAtIndex(0) - value = frame0.WatchLocation('g_char_ptr', - lldb.eValueTypeVariableGlobal, - lldb.LLDB_WATCH_TYPE_WRITE, - 1) - self.assertTrue(value, "Successfully found the location and set a watchpoint") + value = frame0.FindValue('g_char_ptr', + lldb.eValueTypeVariableGlobal) + pointee = value.CreateValueFromAddress("pointee", + value.GetValueAsUnsigned(0), + value.GetType().GetPointeeType()) + # Watch for write to *g_char_ptr. + watchpoint = value.WatchPointee(True, False, True) + self.assertTrue(value and watchpoint, + "Successfully found the pointer and set a watchpoint") self.DebugSBValue(value) + self.DebugSBValue(pointee) + + # Hide stdout if not running with '-t' option. + if not self.TraceOn(): + self.HideStdout() + + print watchpoint # Continue. Expect the program to stop due to the variable being written to. process.Continue() @@ -75,6 +86,7 @@ thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint) self.assertTrue(thread, "The thread stopped due to watchpoint") self.DebugSBValue(value) + self.DebugSBValue(pointee) self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False, substrs = [self.violating_func]) From johnny.chen at apple.com Thu Oct 13 19:56:28 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 14 Oct 2011 00:56:28 -0000 Subject: [Lldb-commits] [lldb] r141928 - /lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Message-ID: <20111014005628.A8341312800A@llvm.org> Author: johnny Date: Thu Oct 13 19:56:28 2011 New Revision: 141928 URL: http://llvm.org/viewvc/llvm-project?rev=141928&view=rev Log: Fix wrong docstring with respect to API usage. Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py?rev=141928&r1=141927&r2=141928&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (original) +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Thu Oct 13 19:56:28 2011 @@ -24,19 +24,19 @@ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") @python_api_test - def test_watch_val_with_dsym(self): - """Exercise SBFrame.WatchLocation() API to set a watchpoint.""" + def test_watch_location_with_dsym(self): + """Exercise SBValue.WatchPointee() API to set a watchpoint.""" self.buildDsym() self.do_set_watchlocation() @python_api_test - def test_watch_val_with_dwarf(self): - """Exercise SBFrame.WatchLocation() API to set a watchpoint.""" + def test_watch_location_with_dwarf(self): + """Exercise SBValue.WatchPointee() API to set a watchpoint.""" self.buildDwarf() self.do_set_watchlocation() def do_set_watchlocation(self): - """Use SBFrame.WatchLocation() to set a watchpoint and verify that the program stops later due to the watchpoint.""" + """Use SBValue.WatchPointee() to set a watchpoint and verify that the program stops later due to the watchpoint.""" exe = os.path.join(os.getcwd(), "a.out") # Create a target by the debugger. From scallanan at apple.com Thu Oct 13 20:15:27 2011 From: scallanan at apple.com (Sean Callanan) Date: Fri, 14 Oct 2011 01:15:27 -0000 Subject: [Lldb-commits] [lldb] r141930 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Message-ID: <20111014011527.C8D40312800A@llvm.org> Author: spyffe Date: Thu Oct 13 20:15:27 2011 New Revision: 141930 URL: http://llvm.org/viewvc/llvm-project?rev=141930&view=rev Log: Improved logging for FindExternalLexicalDecls to make it easier to track down which members belong to which structs (and which call to FindExternalLexicalDecls is doing the reporting). Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141930&r1=141929&r2=141930&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Thu Oct 13 20:15:27 2011 @@ -2512,19 +2512,25 @@ ASTContext *ast_context = &context_decl->getASTContext(); + static unsigned int invocation_id = 0; + unsigned int current_id = invocation_id++; + if (log) { if (const NamedDecl *context_named_decl = dyn_cast(context_decl)) - log->Printf("FindExternalLexicalDecls in '%s' (a %s) with %s predicate", + log->Printf("FindExternalLexicalDecls[%u] in '%s' (a %s) with %s predicate", + current_id, context_named_decl->getNameAsString().c_str(), context_decl->getDeclKindName(), (predicate ? "non-null" : "null")); else if(context_decl) - log->Printf("FindExternalLexicalDecls in a %s with %s predicate", + log->Printf("FindExternalLexicalDecls[%u] in a %s with %s predicate", + current_id, context_decl->getDeclKindName(), (predicate ? "non-null" : "null")); else - log->Printf("FindExternalLexicalDecls in a NULL context with %s predicate", + log->Printf("FindExternalLexicalDecls[%u] in a NULL context with %s predicate", + current_id, (predicate ? "non-null" : "null")); } @@ -2575,7 +2581,11 @@ llvm::raw_string_ostream decl_print_stream(decl_print_string); decl->print(decl_print_stream); decl_print_stream.flush(); - log->Printf(" Adding lexical decl %s", decl_print_string.c_str()); + + if (const NamedDecl *context_named_decl = dyn_cast(context_decl)) + log->Printf(" [%d] Adding [to %s] lexical decl %s", current_id, context_named_decl->getNameAsString().c_str(), decl_print_string.c_str()); + else + log->Printf(" [%d] Adding lexical decl %s", current_id, decl_print_string.c_str()); } Decl *copied_decl = ast_importer->CopyDecl(original_ctx, decl); From johnny.chen at apple.com Thu Oct 13 20:16:39 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 14 Oct 2011 01:16:39 -0000 Subject: [Lldb-commits] [lldb] r141931 - in /lldb/trunk: source/API/SBTarget.cpp test/python_api/default-constructor/sb_target.py test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Message-ID: <20111014011639.F2473312800A@llvm.org> Author: johnny Date: Thu Oct 13 20:16:39 2011 New Revision: 141931 URL: http://llvm.org/viewvc/llvm-project?rev=141931&view=rev Log: Add a test case to exercise the newly added SB API: lldb::SBWatchpoint SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write) Added: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Modified: lldb/trunk/source/API/SBTarget.cpp lldb/trunk/test/python_api/default-constructor/sb_target.py Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=141931&r1=141930&r2=141931&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Thu Oct 13 20:16:39 2011 @@ -957,7 +957,7 @@ Mutex::Locker api_locker (m_opaque_sp->GetAPIMutex()); uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) | (write ? LLDB_WATCH_TYPE_WRITE : 0); - WatchpointSP wp_sp = m_opaque_sp->CreateWatchpoint(addr, size, watch_type); + sb_watchpoint = m_opaque_sp->CreateWatchpoint(addr, size, watch_type); } if (log) Modified: lldb/trunk/test/python_api/default-constructor/sb_target.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_target.py?rev=141931&r1=141930&r2=141931&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_target.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_target.py Thu Oct 13 20:16:39 2011 @@ -47,6 +47,7 @@ obj.EnableAllWatchpoints() obj.DisableAllWatchpoints() obj.DeleteAllWatchpoints() + obj.WatchAddress(123, 8, True, True) obj.GetBroadcaster() obj.GetDescription(lldb.SBStream(), lldb.eDescriptionLevelBrief) obj.Clear() @@ -54,5 +55,5 @@ print module for bp in obj.breakpoint_iter(): print bp - for wp_loc in obj.watchpoint_iter(): - print wp_loc + for wp in obj.watchpoint_iter(): + print wp Added: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=141931&view=auto ============================================================================== --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (added) +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Thu Oct 13 20:16:39 2011 @@ -0,0 +1,102 @@ +""" +Use lldb Python SBtarget.WatchAddress() API to create a watchpoint for write of '*g_char_ptr'. +""" + +import os, time +import re +import unittest2 +import lldb, lldbutil +from lldbtest import * + +class TargetWatchAddressAPITestCase(TestBase): + + mydir = os.path.join("python_api", "watchpoint", "watchlocation") + + def setUp(self): + # Call super's setUp(). + TestBase.setUp(self) + # Our simple source filename. + self.source = 'main.cpp' + # Find the line number to break inside main(). + self.line = line_number(self.source, '// Set break point at this line.') + # This is for verifying that watch location works. + self.violating_func = "do_bad_thing_with_location"; + + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") + @python_api_test + def test_watch_address_with_dsym(self): + """Exercise SBTarget.WatchAddress() API to set a watchpoint.""" + self.buildDsym() + self.do_set_watchaddress() + + @python_api_test + def test_watch_val_with_dwarf(self): + """Exercise SBTarget.WatchAddress() API to set a watchpoint.""" + self.buildDwarf() + self.do_set_watchaddress() + + def do_set_watchaddress(self): + """Use SBTarget.WatchAddress() to set a watchpoint and verify that the program stops later due to the watchpoint.""" + exe = os.path.join(os.getcwd(), "a.out") + + # Create a target by the debugger. + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + # Now create a breakpoint on main.c. + breakpoint = target.BreakpointCreateByLocation(self.source, self.line) + self.assertTrue(breakpoint and + breakpoint.GetNumLocations() == 1, + VALID_BREAKPOINT) + + # Now launch the process, and do not stop at the entry point. + process = target.LaunchSimple(None, None, os.getcwd()) + + # We should be stopped due to the breakpoint. Get frame #0. + process = target.GetProcess() + self.assertTrue(process.GetState() == lldb.eStateStopped, + PROCESS_STOPPED) + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) + frame0 = thread.GetFrameAtIndex(0) + + value = frame0.FindValue('g_char_ptr', + lldb.eValueTypeVariableGlobal) + pointee = value.CreateValueFromAddress("pointee", + value.GetValueAsUnsigned(0), + value.GetType().GetPointeeType()) + # Watch for write to *g_char_ptr. + watchpoint = target.WatchAddress(value.GetValueAsUnsigned(), 1, False, True) + print watchpoint + self.assertTrue(value and watchpoint, + "Successfully found the pointer and set a watchpoint") + self.DebugSBValue(value) + self.DebugSBValue(pointee) + + # Hide stdout if not running with '-t' option. + if not self.TraceOn(): + self.HideStdout() + + print watchpoint + + # Continue. Expect the program to stop due to the variable being written to. + process.Continue() + + if (self.TraceOn()): + lldbutil.print_stacktraces(process) + + thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint) + self.assertTrue(thread, "The thread stopped due to watchpoint") + self.DebugSBValue(value) + self.DebugSBValue(pointee) + + self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False, + substrs = [self.violating_func]) + + # This finishes our test. + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() From gclayton at apple.com Fri Oct 14 02:41:33 2011 From: gclayton at apple.com (Greg Clayton) Date: Fri, 14 Oct 2011 07:41:33 -0000 Subject: [Lldb-commits] [lldb] r141948 - in /lldb/trunk: include/lldb/Interpreter/CommandInterpreter.h include/lldb/Utility/AnsiTerminal.h include/lldb/Utility/SharedCluster.h lldb.xcodeproj/project.pbxproj lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme source/Core/Debugger.cpp source/Interpreter/CommandInterpreter.cpp Message-ID: <20111014074133.C416A312800A@llvm.org> Author: gclayton Date: Fri Oct 14 02:41:33 2011 New Revision: 141948 URL: http://llvm.org/viewvc/llvm-project?rev=141948&view=rev Log: Added the ability to run expressions in any command. Expressions can be inserted in commands by using backticks: (lldb) memory read `$rsp-16` `$rsp+16` (lldb) memory read -c `(int)strlen(argv[0])` `argv[0]` The result of the expression will be inserted into the command as a sort of preprocess stage where this gets done first. We might need to tweak where this preprocess stage goes, but it is very functional already. Added ansi color support to the Debugger::FormatPrompt() so you can use things like "${ansi.fg.blue}" and "${ansi.bold}" many more. This helps in adding colors to your prompts without needing to know the ANSI color code strings. Added: lldb/trunk/include/lldb/Utility/AnsiTerminal.h Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h lldb/trunk/include/lldb/Utility/SharedCluster.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=141948&r1=141947&r2=141948&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri Oct 14 02:41:33 2011 @@ -455,6 +455,9 @@ GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL); private: + + Error + PreprocessCommand (std::string &command); Debugger &m_debugger; // The debugger session that this interpreter is associated with ExecutionContext m_exe_ctx; // The current execution context to use when handling commands Added: lldb/trunk/include/lldb/Utility/AnsiTerminal.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/AnsiTerminal.h?rev=141948&view=auto ============================================================================== --- lldb/trunk/include/lldb/Utility/AnsiTerminal.h (added) +++ lldb/trunk/include/lldb/Utility/AnsiTerminal.h Fri Oct 14 02:41:33 2011 @@ -0,0 +1,86 @@ +//===---------------------AnsiTerminal.h ------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + + + +#define ANSI_FG_COLOR_BLACK 30 +#define ANSI_FG_COLOR_RED 31 +#define ANSI_FG_COLOR_GREEN 32 +#define ANSI_FG_COLOR_YELLOW 33 +#define ANSI_FG_COLOR_BLUE 34 +#define ANSI_FG_COLOR_PURPLE 35 +#define ANSI_FG_COLOR_CYAN 36 +#define ANSI_FG_COLOR_WHITE 37 + +#define ANSI_BG_COLOR_BLACK 40 +#define ANSI_BG_COLOR_RED 41 +#define ANSI_BG_COLOR_GREEN 42 +#define ANSI_BG_COLOR_YELLOW 44 +#define ANSI_BG_COLOR_BLUE 44 +#define ANSI_BG_COLOR_PURPLE 45 +#define ANSI_BG_COLOR_CYAN 46 +#define ANSI_BG_COLOR_WHITE 47 + +#define ANSI_SPECIAL_FRAMED 51 +#define ANSI_SPECIAL_ENCIRCLED 52 + +#define ANSI_CTRL_NORMAL 0 +#define ANSI_CTRL_BOLD 1 +#define ANSI_CTRL_FAINT 2 +#define ANSI_CTRL_ITALIC 3 +#define ANSI_CTRL_UNDERLINE 4 +#define ANSI_CTRL_SLOW_BLINK 5 +#define ANSI_CTRL_FAST_BLINK 6 +#define ANSI_CTRL_IMAGE_NEGATIVE 7 +#define ANSI_CTRL_CONCEAL 8 +#define ANSI_CTRL_CROSSED_OUT 9 + +#define ANSI_ESC_START "\033[" +#define ANSI_ESC_END "m" + +#define ANSI_1_CTRL(ctrl1) "\033["##ctrl1 ANSI_ESC_END +#define ANSI_2_CTRL(ctrl1,ctrl2) "\033["##ctrl1";"##ctrl2 ANSI_ESC_END + +namespace lldb_utility { + + namespace ansi { + const char *k_escape_start = "\033["; + const char *k_escape_end = "m"; + + const char *k_fg_black = "30"; + const char *k_fg_red = "31"; + const char *k_fg_green = "32"; + const char *k_fg_yellow = "33"; + const char *k_fg_blue = "34"; + const char *k_fg_purple = "35"; + const char *k_fg_cyan = "36"; + const char *k_fg_white = "37"; + + const char *k_bg_black = "40"; + const char *k_bg_red = "41"; + const char *k_bg_green = "42"; + const char *k_bg_yellow = "43"; + const char *k_bg_blue = "44"; + const char *k_bg_purple = "45"; + const char *k_bg_cyan = "46"; + const char *k_bg_white = "47"; + + const char *k_ctrl_normal = "0"; + const char *k_ctrl_bold = "1"; + const char *k_ctrl_faint = "2"; + const char *k_ctrl_italic = "3"; + const char *k_ctrl_underline = "4"; + const char *k_ctrl_slow_blink = "5"; + const char *k_ctrl_fast_blink = "6"; + const char *k_ctrl_negative = "7"; + const char *k_ctrl_conceal = "8"; + const char *k_ctrl_crossed_out = "9"; + + } +} Modified: lldb/trunk/include/lldb/Utility/SharedCluster.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharedCluster.h?rev=141948&r1=141947&r2=141948&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/SharedCluster.h (original) +++ lldb/trunk/include/lldb/Utility/SharedCluster.h Fri Oct 14 02:41:33 2011 @@ -1,4 +1,4 @@ -//===---------------------SharedCluster.h --------------------------*- C++ -*-===// +//===------------------SharedCluster.h --------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=141948&r1=141947&r2=141948&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Oct 14 02:41:33 2011 @@ -358,6 +358,7 @@ 26BD407F135D2AE000237D80 /* FileLineResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BD407E135D2ADF00237D80 /* FileLineResolver.cpp */; }; 26C72C94124322890068DC16 /* SBStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C72C93124322890068DC16 /* SBStream.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26C72C961243229A0068DC16 /* SBStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26C72C951243229A0068DC16 /* SBStream.cpp */; }; + 26CF992514428766001E4138 /* AnsiTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = 26CF992414428766001E4138 /* AnsiTerminal.h */; }; 26D265A2136B40EE002EEE45 /* SharingPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 261B5A5311C3F2AD00AABD0A /* SharingPtr.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26D265BC136B4269002EEE45 /* lldb-public.h in Headers */ = {isa = PBXBuildFile; fileRef = 26651A14133BEC76005B64B7 /* lldb-public.h */; settings = {ATTRIBUTES = (Public, ); }; }; 26D5E15F135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26D5E15E135BAEA2006EA0A7 /* OptionGroupArchitecture.cpp */; }; @@ -1067,6 +1068,7 @@ 26C72C951243229A0068DC16 /* SBStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBStream.cpp; path = source/API/SBStream.cpp; sourceTree = ""; }; 26C81CA411335651004BDC5A /* UUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UUID.h; path = include/lldb/Core/UUID.h; sourceTree = ""; }; 26C81CA511335651004BDC5A /* UUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UUID.cpp; path = source/Core/UUID.cpp; sourceTree = ""; }; + 26CF992414428766001E4138 /* AnsiTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnsiTerminal.h; path = include/lldb/Utility/AnsiTerminal.h; sourceTree = ""; }; 26D0DD5010FE554D00271C65 /* BreakpointResolverAddress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverAddress.h; path = include/lldb/Breakpoint/BreakpointResolverAddress.h; sourceTree = ""; }; 26D0DD5110FE554D00271C65 /* BreakpointResolverFileLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverFileLine.h; path = include/lldb/Breakpoint/BreakpointResolverFileLine.h; sourceTree = ""; }; 26D0DD5210FE554D00271C65 /* BreakpointResolverName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BreakpointResolverName.h; path = include/lldb/Breakpoint/BreakpointResolverName.h; sourceTree = ""; }; @@ -1943,6 +1945,7 @@ 2682F168115ED9C800CCFF99 /* Utility */ = { isa = PBXGroup; children = ( + 26CF992414428766001E4138 /* AnsiTerminal.h */, 264723A511FA076E00DE380C /* CleanUp.h */, 94611EAF13CCA363003A22AF /* RefCounter.h */, 94611EB113CCA4A4003A22AF /* RefCounter.cpp */, @@ -2893,6 +2896,7 @@ 496B015B1406DEB100F830D5 /* IRInterpreter.h in Headers */, 2682100D143A59AE004BCF2D /* MappedHash.h in Headers */, 2626B6AE143E1BEA00EF935C /* RangeMap.h in Headers */, + 26CF992514428766001E4138 /* AnsiTerminal.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme?rev=141948&r1=141947&r2=141948&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme (original) +++ lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme Fri Oct 14 02:41:33 2011 @@ -86,7 +86,7 @@ launchStyle = "0" useCustomWorkingDirectory = "NO" customWorkingDirectory = "/Volumes/work/gclayton/Documents/devb/attach" - buildConfiguration = "Release" + buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "YES" debugDocumentVersioning = "YES" allowLocationSimulation = "YES"> Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=141948&r1=141947&r2=141948&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Fri Oct 14 02:41:33 2011 @@ -31,7 +31,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Thread.h" - +#include "lldb/Utility/AnsiTerminal.h" using namespace lldb; using namespace lldb_private; @@ -1303,6 +1303,214 @@ format_addr = *addr; } } + else if (::strncmp (var_name_begin, "ansi.", strlen("ansi.")) == 0) + { + var_success = true; + var_name_begin += strlen("ansi."); // Skip the "ansi." + if (::strncmp (var_name_begin, "fg.", strlen("fg.")) == 0) + { + var_name_begin += strlen("fg."); // Skip the "fg." + if (::strncmp (var_name_begin, "black}", strlen("black}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_black, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "red}", strlen("red}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_red, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "green}", strlen("green}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_green, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "yellow}", strlen("yellow}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_yellow, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "blue}", strlen("blue}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_blue, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "purple}", strlen("purple}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_purple, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "cyan}", strlen("cyan}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_cyan, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "white}", strlen("white}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_fg_white, + lldb_utility::ansi::k_escape_end); + } + else + { + var_success = false; + } + } + else if (::strncmp (var_name_begin, "bg.", strlen("bg.")) == 0) + { + var_name_begin += strlen("bg."); // Skip the "bg." + if (::strncmp (var_name_begin, "black}", strlen("black}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_black, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "red}", strlen("red}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_red, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "green}", strlen("green}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_green, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "yellow}", strlen("yellow}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_yellow, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "blue}", strlen("blue}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_blue, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "purple}", strlen("purple}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_purple, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "cyan}", strlen("cyan}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_cyan, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "white}", strlen("white}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_bg_white, + lldb_utility::ansi::k_escape_end); + } + else + { + var_success = false; + } + } + else if (::strncmp (var_name_begin, "normal}", strlen ("normal}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_normal, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "bold}", strlen("bold}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_bold, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "faint}", strlen("faint}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_faint, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "italic}", strlen("italic}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_italic, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "underline}", strlen("underline}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_underline, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "slow-blink}", strlen("slow-blink}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_slow_blink, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "fast-blink}", strlen("fast-blink}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_fast_blink, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "negative}", strlen("negative}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_negative, + lldb_utility::ansi::k_escape_end); + } + else if (::strncmp (var_name_begin, "conceal}", strlen("conceal}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_conceal, + lldb_utility::ansi::k_escape_end); + + } + else if (::strncmp (var_name_begin, "crossed-out}", strlen("crossed-out}")) == 0) + { + s.Printf ("%s%s%s", + lldb_utility::ansi::k_escape_start, + lldb_utility::ansi::k_ctrl_crossed_out, + lldb_utility::ansi::k_escape_end); + } + else + { + var_success = false; + } + } break; case 'p': Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=141948&r1=141947&r2=141948&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Oct 14 02:41:33 2011 @@ -947,6 +947,118 @@ } } +Error +CommandInterpreter::PreprocessCommand (std::string &command) +{ + // The command preprocessor needs to do things to the command + // line before any parsing of arguments or anything else is done. + // The only current stuff that gets proprocessed is anyting enclosed + // in backtick ('`') characters is evaluated as an expression and + // the result of the expression must be a scalar that can be substituted + // into the command. An example would be: + // (lldb) memory read `$rsp + 20` + Error error; // Error for any expressions that might not evaluate + size_t start_backtick; + size_t pos = 0; + while ((start_backtick = command.find ('`', pos)) != std::string::npos) + { + if (start_backtick > 0 && command[start_backtick-1] == '\\') + { + // The backtick was preceeded by a '\' character, remove the slash + // and don't treat the backtick as the start of an expression + command.erase(start_backtick-1, 1); + // No need to add one to start_backtick since we just deleted a char + pos = start_backtick; + } + else + { + const size_t expr_content_start = start_backtick + 1; + const size_t end_backtick = command.find ('`', expr_content_start); + if (end_backtick == std::string::npos) + return error; + else if (end_backtick == expr_content_start) + { + // Empty expression (two backticks in a row) + command.erase (start_backtick, 2); + } + else + { + std::string expr_str (command, expr_content_start, end_backtick - expr_content_start); + + Target *target = m_exe_ctx.GetTargetPtr(); + if (target) + { + const bool unwind_on_error = true; + const bool keep_in_memory = false; + ValueObjectSP expr_result_valobj_sp; + ExecutionResults expr_result = target->EvaluateExpression (expr_str.c_str(), + m_exe_ctx.GetFramePtr(), + eExecutionPolicyOnlyWhenNeeded, + unwind_on_error, keep_in_memory, + eNoDynamicValues, + expr_result_valobj_sp); + if (expr_result == eExecutionCompleted) + { + Scalar scalar; + if (expr_result_valobj_sp->ResolveValue (scalar)) + { + command.erase (start_backtick, end_backtick - start_backtick + 1); + StreamString value_strm; + const bool show_type = false; + scalar.GetValue (&value_strm, show_type); + size_t value_string_size = value_strm.GetSize(); + if (value_string_size) + { + command.insert (start_backtick, value_strm.GetData(), value_string_size); + pos = start_backtick + value_string_size; + continue; + } + else + { + error.SetErrorStringWithFormat("expression value didn't result in a scalar value for the expression '%s'", expr_str.c_str()); + } + } + else + { + error.SetErrorStringWithFormat("expression value didn't result in a scalar value for the expression '%s'", expr_str.c_str()); + } + } + else + { + if (expr_result_valobj_sp) + error = expr_result_valobj_sp->GetError(); + if (error.Success()) + { + + switch (expr_result) + { + case eExecutionSetupError: + error.SetErrorStringWithFormat("expression setup error for the expression '%s'", expr_str.c_str()); + break; + case eExecutionCompleted: + break; + case eExecutionDiscarded: + error.SetErrorStringWithFormat("expression discarded for the expression '%s'", expr_str.c_str()); + break; + case eExecutionInterrupted: + error.SetErrorStringWithFormat("expression interrupted for the expression '%s'", expr_str.c_str()); + break; + case eExecutionTimedOut: + error.SetErrorStringWithFormat("expression timed out for the expression '%s'", expr_str.c_str()); + break; + } + } + } + } + } + if (error.Fail()) + break; + } + } + return error; +} + + bool CommandInterpreter::HandleCommand (const char *command_line, bool add_to_history, @@ -1045,6 +1157,15 @@ return true; } + + Error error (PreprocessCommand (command_string)); + + if (error.Fail()) + { + result.AppendError (error.AsCString()); + result.SetStatus(eReturnStatusFailed); + return false; + } // Phase 1. // Before we do ANY kind of argument processing, etc. we need to figure out what the real/final command object From johnny.chen at apple.com Fri Oct 14 12:37:39 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 14 Oct 2011 17:37:39 -0000 Subject: [Lldb-commits] [lldb] r141963 - in /lldb/trunk/test/functionalities: command_python/ command_script/ command_script/TestCommandPython.py command_script/TestCommandScript.py Message-ID: <20111014173739.2823E312800A@llvm.org> Author: johnny Date: Fri Oct 14 12:37:38 2011 New Revision: 141963 URL: http://llvm.org/viewvc/llvm-project?rev=141963&view=rev Log: Rename directory command_python to command_script, and the test file, too. Added: lldb/trunk/test/functionalities/command_script/ - copied from r141917, lldb/trunk/test/functionalities/command_python/ lldb/trunk/test/functionalities/command_script/TestCommandScript.py - copied, changed from r141917, lldb/trunk/test/functionalities/command_python/TestCommandPython.py Removed: lldb/trunk/test/functionalities/command_python/ lldb/trunk/test/functionalities/command_script/TestCommandPython.py Removed: lldb/trunk/test/functionalities/command_script/TestCommandPython.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_python/TestCommandPython.py?rev=141917&view=auto ============================================================================== --- lldb/trunk/test/functionalities/command_script/TestCommandPython.py (original) +++ lldb/trunk/test/functionalities/command_script/TestCommandPython.py (removed) @@ -1,97 +0,0 @@ -""" -Test lldb Python commands. -""" - -import os, time -import unittest2 -import lldb -from lldbtest import * - -class CmdPythonTestCase(TestBase): - - mydir = os.path.join("functionalities", "command_python") - - @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - def test_with_dsym (self): - self.buildDsym () - self.pycmd_tests () - - def test_with_dwarf (self): - self.buildDwarf () - self.pycmd_tests () - - def pycmd_tests (self): - exe = os.path.join (os.getcwd(), "a.out") - self.expect("file " + exe, - patterns = [ "Current executable set to .*a.out" ]) - - self.runCmd("command source py_import") - - # This is the function to remove the custom commands in order to have a - # clean slate for the next test case. - def cleanup(): - self.runCmd('command script delete welcome', check=False) - self.runCmd('command script delete targetname', check=False) - self.runCmd('command script delete longwait', check=False) - - # Execute the cleanup function during test case tear down. - self.addTearDownHook(cleanup) - - # We don't want to display the stdout if not in TraceOn() mode. - if not self.TraceOn(): - self.HideStdout() - - self.expect('welcome Enrico', - substrs = ['Hello Enrico, welcome to LLDB']); - - self.expect("help welcome", - substrs = ['Just a docstring for welcome_impl', - 'A command that says hello to LLDB users']) - - self.expect("help", - substrs = ['Run Python function welcome.welcome_impl', - 'welcome']) - - self.expect("help -a", - substrs = ['Run Python function welcome.welcome_impl', - 'welcome']) - - self.expect("help -u", matching=False, - substrs = ['Run Python function welcome.welcome_impl', - 'welcome']) - - self.runCmd("command script delete welcome"); - - self.expect('welcome Enrico', matching=False, error=True, - substrs = ['Hello Enrico, welcome to LLDB']); - - self.expect('targetname', - substrs = ['a.out']) - - self.expect('targetname fail', error=True, - substrs = ['a test for error in command']) - - self.expect('command script list', - substrs = ['targetname', - 'Run Python function welcome.target_name_impl']) - - self.expect("help targetname", - substrs = ['Run Python function welcome.target_name_imp', - 'This command takes \'raw\' input', - 'quote stuff']) - - self.expect("longwait", - substrs = ['Done; if you saw the delays I am doing OK']) - - self.runCmd("command script clear") - - self.expect('command script list', matching=False, - substrs = ['targetname', - 'longwait']) - -if __name__ == '__main__': - import atexit - lldb.SBDebugger.Initialize() - atexit.register(lambda: lldb.SBDebugger.Terminate()) - unittest2.main() - Copied: lldb/trunk/test/functionalities/command_script/TestCommandScript.py (from r141917, lldb/trunk/test/functionalities/command_python/TestCommandPython.py) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/command_script/TestCommandScript.py?p2=lldb/trunk/test/functionalities/command_script/TestCommandScript.py&p1=lldb/trunk/test/functionalities/command_python/TestCommandPython.py&r1=141917&r2=141963&rev=141963&view=diff ============================================================================== --- lldb/trunk/test/functionalities/command_python/TestCommandPython.py (original) +++ lldb/trunk/test/functionalities/command_script/TestCommandScript.py Fri Oct 14 12:37:38 2011 @@ -9,7 +9,7 @@ class CmdPythonTestCase(TestBase): - mydir = os.path.join("functionalities", "command_python") + mydir = os.path.join("functionalities", "command_script") @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym (self): From johnny.chen at apple.com Fri Oct 14 13:10:00 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 14 Oct 2011 18:10:00 -0000 Subject: [Lldb-commits] [lldb] r141965 - /lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Message-ID: <20111014181000.C73FF312800A@llvm.org> Author: johnny Date: Fri Oct 14 13:10:00 2011 New Revision: 141965 URL: http://llvm.org/viewvc/llvm-project?rev=141965&view=rev Log: Remove debug 'print watchpoint' statement. Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Modified: lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=141965&r1=141964&r2=141965&view=diff ============================================================================== --- lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (original) +++ lldb/trunk/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Fri Oct 14 13:10:00 2011 @@ -66,7 +66,6 @@ value.GetType().GetPointeeType()) # Watch for write to *g_char_ptr. watchpoint = target.WatchAddress(value.GetValueAsUnsigned(), 1, False, True) - print watchpoint self.assertTrue(value and watchpoint, "Successfully found the pointer and set a watchpoint") self.DebugSBValue(value) From johnny.chen at apple.com Fri Oct 14 14:15:48 2011 From: johnny.chen at apple.com (Johnny Chen) Date: Fri, 14 Oct 2011 19:15:48 -0000 Subject: [Lldb-commits] [lldb] r141979 - in /lldb/trunk: include/lldb/API/SBWatchpoint.h include/lldb/Breakpoint/Watchpoint.h scripts/Python/interface/SBWatchpoint.i source/API/SBWatchpoint.cpp source/Breakpoint/Watchpoint.cpp test/python_api/default-constructor/sb_watchpoint.py Message-ID: <20111014191548.6E72C312800A@llvm.org> Author: johnny Date: Fri Oct 14 14:15:48 2011 New Revision: 141979 URL: http://llvm.org/viewvc/llvm-project?rev=141979&view=rev Log: Add SBWatchpoint::GetError() API, which is not currently populated as yet. Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h lldb/trunk/include/lldb/Breakpoint/Watchpoint.h lldb/trunk/scripts/Python/interface/SBWatchpoint.i lldb/trunk/source/API/SBWatchpoint.cpp lldb/trunk/source/Breakpoint/Watchpoint.cpp lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?rev=141979&r1=141978&r2=141979&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBWatchpoint.h (original) +++ lldb/trunk/include/lldb/API/SBWatchpoint.h Fri Oct 14 14:15:48 2011 @@ -29,15 +29,15 @@ operator = (const lldb::SBWatchpoint &rhs); #endif - lldb::SBError - GetError (); + bool + IsValid() const; + + SBError + GetError(); watch_id_t GetID (); - bool - IsValid() const; - /// With -1 representing an invalid hardware index. int32_t GetHardwareIndex (); Modified: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Watchpoint.h?rev=141979&r1=141978&r2=141979&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/Watchpoint.h (original) +++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h Fri Oct 14 14:15:48 2011 @@ -58,6 +58,7 @@ void Dump (Stream *s) const; void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const; Target &GetTarget() { return *m_target; } + const Error &GetError() { return m_error; } private: friend class Target; @@ -65,16 +66,18 @@ void SetTarget(Target *target_ptr) { m_target = target_ptr; } Target *m_target; - bool m_enabled; // Is this watchpoint enabled - bool m_is_hardware; // Is this a hardware watchpoint - uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from - m_watch_write:1, // 1 if we stop when the watched data is written to - m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access - m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access - uint32_t m_ignore_count; // Number of times to ignore this breakpoint + bool m_enabled; // Is this watchpoint enabled + bool m_is_hardware; // Is this a hardware watchpoint + uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from + m_watch_write:1, // 1 if we stop when the watched data is written to + m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access + m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access + uint32_t m_ignore_count; // Number of times to ignore this breakpoint WatchpointHitCallback m_callback; - void * m_callback_baton; // Callback user data to pass to callback - std::string m_decl_str; // Declaration information, if any. + void * m_callback_baton; // Callback user data to pass to callback + std::string m_decl_str; // Declaration information, if any. + Error m_error; // An error object describing errors creating watchpoint. + static lldb::break_id_t GetNextID(); Modified: lldb/trunk/scripts/Python/interface/SBWatchpoint.i URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBWatchpoint.i?rev=141979&r1=141978&r2=141979&view=diff ============================================================================== --- lldb/trunk/scripts/Python/interface/SBWatchpoint.i (original) +++ lldb/trunk/scripts/Python/interface/SBWatchpoint.i Fri Oct 14 14:15:48 2011 @@ -28,12 +28,15 @@ ~SBWatchpoint (); - watch_id_t - GetID (); - bool IsValid(); + SBError + GetError(); + + watch_id_t + GetID (); + %feature("docstring", " //------------------------------------------------------------------ /// With -1 representing an invalid hardware index. Modified: lldb/trunk/source/API/SBWatchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=141979&r1=141978&r2=141979&view=diff ============================================================================== --- lldb/trunk/source/API/SBWatchpoint.cpp (original) +++ lldb/trunk/source/API/SBWatchpoint.cpp Fri Oct 14 14:15:48 2011 @@ -86,25 +86,19 @@ bool SBWatchpoint::IsValid() const { - return m_opaque_sp.get() != NULL; -#if 0 - if (m_opaque_sp) - return m_opaque_sp->GetError().Success(); + if (m_opaque_sp && m_opaque_sp->GetError().Success()) + return true; return false; -#endif } SBError SBWatchpoint::GetError () { SBError sb_error; -#if 0 if (m_opaque_sp) { - // TODO: Johnny fill this in - sb_error.ref() = m_opaque_sp->GetError(); + sb_error.SetError(m_opaque_sp->GetError()); } -#endif return sb_error; } Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=141979&r1=141978&r2=141979&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Fri Oct 14 14:15:48 2011 @@ -29,7 +29,9 @@ m_watch_was_written(0), m_ignore_count(0), m_callback(NULL), - m_callback_baton(NULL) + m_callback_baton(NULL), + m_decl_str(), + m_error() { } Modified: lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py?rev=141979&r1=141978&r2=141979&view=diff ============================================================================== --- lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py (original) +++ lldb/trunk/test/python_api/default-constructor/sb_watchpoint.py Fri Oct 14 14:15:48 2011 @@ -7,6 +7,8 @@ def fuzz_obj(obj): obj.GetID() + obj.IsValid() + obj.GetError() obj.GetHardwareIndex() obj.GetWatchAddress() obj.GetWatchSize() From scallanan at apple.com Fri Oct 14 15:34:21 2011 From: scallanan at apple.com (Sean Callanan) Date: Fri, 14 Oct 2011 20:34:21 -0000 Subject: [Lldb-commits] [lldb] r141987 - in /lldb/trunk: include/lldb/Expression/ClangExpressionDeclMap.h source/Expression/ASTResultSynthesizer.cpp source/Expression/ClangExpressionDeclMap.cpp source/Expression/DWARFExpression.cpp source/Symbol/ClangASTImporter.cpp Message-ID: <20111014203422.059512A6C12C@llvm.org> Author: spyffe Date: Fri Oct 14 15:34:21 2011 New Revision: 141987 URL: http://llvm.org/viewvc/llvm-project?rev=141987&view=rev Log: Improved expression logging. Now all calls to FindExternalVisibleDecls and FindExternalLexicalDecls are marked and given unique IDs, so that all logging done as part of their execution can be traced back to the proper call. Also there was some logging that really wasn't helpful in most cases so I disabled it unless verbose logging (log enable -v lldb expr) is enabled. Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h lldb/trunk/source/Expression/ASTResultSynthesizer.cpp lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp lldb/trunk/source/Expression/DWARFExpression.cpp lldb/trunk/source/Symbol/ClangASTImporter.cpp Modified: lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h?rev=141987&r1=141986&r2=141987&view=diff ============================================================================== --- lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h (original) +++ lldb/trunk/include/lldb/Expression/ClangExpressionDeclMap.h Fri Oct 14 15:34:21 2011 @@ -849,6 +849,10 @@ /// redundant, but ClangExpressionDeclMap operates in RTTI land so /// it can't access DeclarationName. /// + /// @param[in] current_id + /// The ID for the current FindExternalVisibleDecls invocation, + /// for logging purposes. + /// /// @return /// True on success; false otherwise. //------------------------------------------------------------------ @@ -856,7 +860,8 @@ FindExternalVisibleDecls (NameSearchContext &context, lldb::ModuleSP module, ClangNamespaceDecl &namespace_decl, - const ConstString &name); + const ConstString &name, + unsigned int current_id); //------------------------------------------------------------------ /// Given a stack frame, find a variable that matches the given name and @@ -978,7 +983,8 @@ //------------------------------------------------------------------ void AddOneVariable (NameSearchContext &context, - lldb::VariableSP var); + lldb::VariableSP var, + unsigned int current_id); //------------------------------------------------------------------ /// Use the NameSearchContext to generate a Decl for the given @@ -989,10 +995,15 @@ /// /// @param[in] pvar /// The persistent variable that needs a Decl. + /// + /// @param[in] current_id + /// The ID of the current invocation of FindExternalVisibleDecls + /// for logging purposes. //------------------------------------------------------------------ void AddOneVariable (NameSearchContext &context, - lldb::ClangExpressionVariableSP &pvar_sp); + lldb::ClangExpressionVariableSP &pvar_sp, + unsigned int current_id); //------------------------------------------------------------------ /// Use the NameSearchContext to generate a Decl for the given LLDB @@ -1007,7 +1018,8 @@ //------------------------------------------------------------------ void AddOneGenericVariable (NameSearchContext &context, - Symbol &symbol); + Symbol &symbol, + unsigned int current_id); //------------------------------------------------------------------ /// Use the NameSearchContext to generate a Decl for the given @@ -1028,7 +1040,8 @@ void AddOneFunction (NameSearchContext &context, Function *fun, - Symbol *sym); + Symbol *sym, + unsigned int current_id); //------------------------------------------------------------------ /// Use the NameSearchContext to generate a Decl for the given @@ -1042,7 +1055,8 @@ //------------------------------------------------------------------ void AddOneRegister (NameSearchContext &context, - const RegisterInfo *reg_info); + const RegisterInfo *reg_info, + unsigned int current_id); //------------------------------------------------------------------ /// Use the NameSearchContext to generate a Decl for the given @@ -1060,7 +1074,8 @@ //------------------------------------------------------------------ void AddOneType (NameSearchContext &context, - TypeFromUser &type, + TypeFromUser &type, + unsigned int current_id, bool add_method = false); //------------------------------------------------------------------ Modified: lldb/trunk/source/Expression/ASTResultSynthesizer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ASTResultSynthesizer.cpp?rev=141987&r1=141986&r2=141987&view=diff ============================================================================== --- lldb/trunk/source/Expression/ASTResultSynthesizer.cpp (original) +++ lldb/trunk/source/Expression/ASTResultSynthesizer.cpp Fri Oct 14 15:34:21 2011 @@ -65,7 +65,7 @@ if (NamedDecl *named_decl = dyn_cast(D)) { - if (log) + if (log && log->GetVerbose()) { if (named_decl->getIdentifier()) log->Printf("TransformTopLevelDecl(%s)", named_decl->getIdentifier()->getNameStart()); Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=141987&r1=141986&r2=141987&view=diff ============================================================================== --- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original) +++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Oct 14 15:34:21 2011 @@ -2020,19 +2020,22 @@ if (m_parser_vars->m_ignore_lookups) { - if (log) + if (log && log->GetVerbose()) log->Printf("Ignoring a query during an import"); return; } + static unsigned int invocation_id = 0; + unsigned int current_id = invocation_id++; + if (log) { if (!context.m_decl_context) - log->Printf("FindExternalVisibleDecls for '%s' in a NULL DeclContext", name.GetCString()); + log->Printf("FindExternalVisibleDecls[%u] for '%s' in a NULL DeclContext", current_id, name.GetCString()); else if (const NamedDecl *context_named_decl = dyn_cast(context.m_decl_context)) - log->Printf("FindExternalVisibleDecls for '%s' in '%s'", name.GetCString(), context_named_decl->getNameAsString().c_str()); + log->Printf("FindExternalVisibleDecls[%u] for '%s' in '%s'", current_id, name.GetCString(), context_named_decl->getNameAsString().c_str()); else - log->Printf("FindExternalVisibleDecls for '%s' in a '%s'", name.GetCString(), context.m_decl_context->getDeclKindName()); + log->Printf("FindExternalVisibleDecls[%u] for '%s' in a '%s'", current_id, name.GetCString(), context.m_decl_context->getDeclKindName()); } context.m_namespace_map.reset(new ClangASTImporter::NamespaceMap); @@ -2041,22 +2044,27 @@ { ClangASTImporter::NamespaceMapSP namespace_map = m_parser_vars->m_ast_importer->GetNamespaceMap(namespace_context); - if (log) - log->Printf("Inspecting namespace map %p (%d entries)", namespace_map.get(), (int)namespace_map->size()); + if (log && log->GetVerbose()) + log->Printf(" FEVD[%u] Inspecting namespace map %p (%d entries)", + current_id, + namespace_map.get(), + (int)namespace_map->size()); for (ClangASTImporter::NamespaceMap::iterator i = namespace_map->begin(), e = namespace_map->end(); i != e; ++i) { if (log) - log->Printf(" Searching namespace %s in module %s", + log->Printf(" FEVD[%u] Searching namespace %s in module %s", + current_id, i->second.GetNamespaceDecl()->getNameAsString().c_str(), i->first->GetFileSpec().GetFilename().GetCString()); FindExternalVisibleDecls(context, i->first, i->second, - name); + name, + current_id); } } else if (!isa(context.m_decl_context)) @@ -2069,18 +2077,22 @@ ClangNamespaceDecl namespace_decl; if (log) - log->Printf(" Searching the root namespace"); + log->Printf(" FEVD[%u] Searching the root namespace", current_id); FindExternalVisibleDecls(context, lldb::ModuleSP(), namespace_decl, - name); + name, + current_id); } if (!context.m_namespace_map->empty()) { - if (log) - log->Printf("Registering namespace map %p (%d entries)", context.m_namespace_map.get(), (int)context.m_namespace_map->size()); + if (log && log->GetVerbose()) + log->Printf(" FEVD[%u] Registering namespace map %p (%d entries)", + current_id, + context.m_namespace_map.get(), + (int)context.m_namespace_map->size()); NamespaceDecl *clang_namespace_decl = AddNamespace(context, context.m_namespace_map); @@ -2093,7 +2105,8 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, lldb::ModuleSP module_sp, ClangNamespaceDecl &namespace_decl, - const ConstString &name) + const ConstString &name, + unsigned int current_id) { assert (m_struct_vars.get()); assert (m_parser_vars.get()); @@ -2139,9 +2152,9 @@ if (!this_type) return; - if (log) + if (log && log->GetVerbose()) { - log->PutCString ("Type for \"this\" is: "); + log->Printf (" FEVD[%u] Type for \"this\" is: ", current_id); StreamString strm; this_type->Dump(&strm, true); log->PutCString (strm.GetData()); @@ -2171,7 +2184,7 @@ StreamString type_stream; class_user_type.DumpTypeCode(&type_stream); type_stream.Flush(); - log->Printf("Adding type for $__lldb_class: %s", type_stream.GetString().c_str()); + log->Printf(" FEVD[%u] Adding type for $__lldb_class: %s", current_id, type_stream.GetString().c_str()); } AddOneType(context, class_user_type, true); @@ -2224,7 +2237,7 @@ StreamString type_stream; class_user_type.DumpTypeCode(&type_stream); type_stream.Flush(); - log->Printf("Adding type for $__lldb_objc_class: %s", type_stream.GetString().c_str()); + log->Printf(" FEVD[%u] Adding type for $__lldb_objc_class: %s", current_id, type_stream.GetString().c_str()); } AddOneType(context, class_user_type, false); @@ -2267,7 +2280,7 @@ break; if (log) - log->Printf("Found persistent type %s", name.GetCString()); + log->Printf(" FEVD[%u] Found persistent type %s", current_id, name.GetCString()); context.AddNamedDecl(parser_ptype_type_decl); } while (0); @@ -2276,7 +2289,7 @@ if (pvar_sp) { - AddOneVariable(context, pvar_sp); + AddOneVariable(context, pvar_sp, current_id); return; } @@ -2286,8 +2299,11 @@ { const RegisterInfo *reg_info(m_parser_vars->m_exe_ctx->GetRegisterContext()->GetRegisterInfoByName(reg_name)); + if (log) + log->Printf(" FEVD[%u] Found register %s", current_id, reg_info->name); + if (reg_info) - AddOneRegister(context, reg_info); + AddOneRegister(context, reg_info, current_id); } } else @@ -2307,7 +2323,7 @@ // If we found a variable in scope, no need to pull up function names if (err.Success() && var != NULL) { - AddOneVariable(context, var); + AddOneVariable(context, var, current_id); context.m_found.variable = true; } } @@ -2321,7 +2337,7 @@ if (var) { - AddOneVariable(context, var); + AddOneVariable(context, var, current_id); context.m_found.variable = true; } } @@ -2366,7 +2382,7 @@ // TODO only do this if it's a C function; C++ functions may be // overloaded if (!context.m_found.function_with_type_info) - AddOneFunction(context, sym_ctx.function, NULL); + AddOneFunction(context, sym_ctx.function, NULL, current_id); context.m_found.function_with_type_info = true; context.m_found.function = true; } @@ -2383,12 +2399,12 @@ { if (generic_symbol) { - AddOneFunction (context, NULL, generic_symbol); + AddOneFunction (context, NULL, generic_symbol, current_id); context.m_found.function = true; } else if (non_extern_symbol) { - AddOneFunction (context, NULL, non_extern_symbol); + AddOneFunction (context, NULL, non_extern_symbol, current_id); context.m_found.function = true; } } @@ -2403,7 +2419,7 @@ if (data_symbol) { - AddOneGenericVariable(context, *data_symbol); + AddOneGenericVariable(context, *data_symbol, current_id); context.m_found.variable = true; } } @@ -2426,7 +2442,8 @@ context.m_namespace_map->push_back(std::pair(module_sp, found_namespace_decl)); if (log) - log->Printf("Found namespace %s in module %s", + log->Printf(" FEVD[%u] Found namespace %s in module %s", + current_id, name.GetCString(), module_sp->GetFileSpec().GetFilename().GetCString()); } @@ -2461,7 +2478,8 @@ context.m_namespace_map->push_back(std::pair(image, found_namespace_decl)); if (log) - log->Printf("Found namespace %s in module %s", + log->Printf(" FEVD[%u] Found namespace %s in module %s", + current_id, name.GetCString(), image->GetFileSpec().GetFilename().GetCString()); } @@ -2483,10 +2501,12 @@ if (log) { - log->Printf("Matching type found for \"%s\": ", name.GetCString()); - StreamString strm; - type_sp->Dump(&strm, true); - log->PutCString (strm.GetData()); + const char *name_string = type_sp->GetName().GetCString(); + + log->Printf(" FEVD[%u] Matching type found for \"%s\": %s", + current_id, + name.GetCString(), + (name_string ? name_string : "")); } TypeFromUser user_type(type_sp->GetClangFullType(), @@ -2551,7 +2571,7 @@ llvm::raw_string_ostream decl_print_stream(decl_print_string); original_decl->print(decl_print_stream); decl_print_stream.flush(); - log->Printf("Original decl:\n%s", decl_print_string.c_str()); + log->Printf(" FELD[%u] Original decl:\n%s", current_id, decl_print_string.c_str()); } if (TagDecl *original_tag_decl = dyn_cast(original_decl)) @@ -2583,9 +2603,9 @@ decl_print_stream.flush(); if (const NamedDecl *context_named_decl = dyn_cast(context_decl)) - log->Printf(" [%d] Adding [to %s] lexical decl %s", current_id, context_named_decl->getNameAsString().c_str(), decl_print_string.c_str()); + log->Printf(" FELD[%d] Adding [to %s] lexical decl %s", current_id, context_named_decl->getNameAsString().c_str(), decl_print_string.c_str()); else - log->Printf(" [%d] Adding lexical decl %s", current_id, decl_print_string.c_str()); + log->Printf(" FELD[%d] Adding lexical decl %s", current_id, decl_print_string.c_str()); } Decl *copied_decl = ast_importer->CopyDecl(original_ctx, decl); @@ -2729,7 +2749,7 @@ } void -ClangExpressionDeclMap::AddOneVariable (NameSearchContext &context, VariableSP var) +ClangExpressionDeclMap::AddOneVariable (NameSearchContext &context, VariableSP var, unsigned int current_id) { assert (m_parser_vars.get()); @@ -2770,7 +2790,7 @@ var_decl->print(var_decl_print_stream); var_decl_print_stream.flush(); - log->Printf("Found variable %s, returned %s", decl_name.c_str(), var_decl_print_string.c_str()); + log->Printf(" FEVD[%u] Found variable %s, returned %s", current_id, decl_name.c_str(), var_decl_print_string.c_str()); //if (log->GetVerbose()) //{ @@ -2783,7 +2803,8 @@ void ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context, - ClangExpressionVariableSP &pvar_sp) + ClangExpressionVariableSP &pvar_sp, + unsigned int current_id) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); @@ -2809,13 +2830,14 @@ var_decl->print(var_decl_print_stream); var_decl_print_stream.flush(); - log->Printf("Added pvar %s, returned %s", pvar_sp->GetName().GetCString(), var_decl_print_string.c_str()); + log->Printf(" FEVD[%u] Added pvar %s, returned %s", current_id, pvar_sp->GetName().GetCString(), var_decl_print_string.c_str()); } } void ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, - Symbol &symbol) + Symbol &symbol, + unsigned int current_id) { assert(m_parser_vars.get()); @@ -2870,7 +2892,7 @@ var_decl->print(var_decl_print_stream); var_decl_print_stream.flush(); - log->Printf("Found variable %s, returned %s", decl_name.c_str(), var_decl_print_string.c_str()); + log->Printf(" FEVD[%u] Found variable %s, returned %s", current_id, decl_name.c_str(), var_decl_print_string.c_str()); //if (log->GetVerbose()) //{ @@ -2939,7 +2961,8 @@ void ClangExpressionDeclMap::AddOneRegister (NameSearchContext &context, - const RegisterInfo *reg_info) + const RegisterInfo *reg_info, + unsigned int current_id) { lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); @@ -2950,7 +2973,7 @@ if (!ast_type) { if (log) - log->Printf("Tried to add a type for %s, but couldn't get one", context.m_decl_name.getAsString().c_str()); + log->Printf(" Tried to add a type for %s, but couldn't get one", context.m_decl_name.getAsString().c_str()); return; } @@ -2972,14 +2995,14 @@ entity->m_parser_vars->m_llvm_value = NULL; entity->m_parser_vars->m_lldb_value = NULL; - if (log) + if (log && log->GetVerbose()) { std::string var_decl_print_string; llvm::raw_string_ostream var_decl_print_stream(var_decl_print_string); var_decl->print(var_decl_print_stream); var_decl_print_stream.flush(); - log->Printf("Added register %s, returned %s", context.m_decl_name.getAsString().c_str(), var_decl_print_string.c_str()); + log->Printf(" FEVD[%d] Added register %s, returned %s", current_id, context.m_decl_name.getAsString().c_str(), var_decl_print_string.c_str()); } } @@ -3008,7 +3031,8 @@ void ClangExpressionDeclMap::AddOneFunction (NameSearchContext &context, Function* fun, - Symbol* symbol) + Symbol* symbol, + unsigned int current_id) { assert (m_parser_vars.get()); @@ -3029,7 +3053,7 @@ if (!fun_type) { if (log) - log->PutCString("Skipped a function because it has no type"); + log->PutCString(" Skipped a function because it has no type"); return; } @@ -3038,7 +3062,7 @@ if (!fun_opaque_type) { if (log) - log->PutCString("Skipped a function because it has no Clang type"); + log->PutCString(" Skipped a function because it has no Clang type"); return; } @@ -3058,7 +3082,7 @@ else { if (log) - log->PutCString("AddOneFunction called with no function and no symbol"); + log->PutCString(" AddOneFunction called with no function and no symbol"); return; } @@ -3089,13 +3113,18 @@ fun_decl->print(fun_decl_print_stream); fun_decl_print_stream.flush(); - log->Printf("Found %s function %s, returned %s", (fun ? "specific" : "generic"), decl_name.c_str(), fun_decl_print_string.c_str()); + log->Printf(" FEVD[%u] Found %s function %s, returned %s", + current_id, + (fun ? "specific" : "generic"), + decl_name.c_str(), + fun_decl_print_string.c_str()); } } void ClangExpressionDeclMap::AddOneType(NameSearchContext &context, TypeFromUser &ut, + unsigned int current_id, bool add_method) { ASTContext *parser_ast_context = context.GetASTContext(); Modified: lldb/trunk/source/Expression/DWARFExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=141987&r1=141986&r2=141987&view=diff ============================================================================== --- lldb/trunk/source/Expression/DWARFExpression.cpp (original) +++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Oct 14 15:34:21 2011 @@ -1038,7 +1038,7 @@ const uint32_t op_offset = offset; const uint8_t op = opcodes.GetU8(&offset); - if (log) + if (log && log->GetVerbose()) { size_t count = stack.size(); log->Printf("Stack before operation has %lu values:", count); @@ -2875,7 +2875,7 @@ error_ptr->SetErrorString ("Stack empty after evaluation."); return false; } - else if (log) + else if (log && log->GetVerbose()) { size_t count = stack.size(); log->Printf("Stack after operation has %lu values:", count); Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=141987&r1=141986&r2=141987&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Fri Oct 14 15:34:21 2011 @@ -51,7 +51,7 @@ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (log) - log->Printf("Completing a TagDecl named %s", decl->getName().str().c_str()); + log->Printf(" [ClangASTImporter] Completing a TagDecl named %s", decl->getName().str().c_str()); DeclOrigin decl_origin = GetDeclOrigin(decl); @@ -75,7 +75,7 @@ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS)); if (log) - log->Printf("Completing an ObjCInterfaceDecl named %s", interface_decl->getName().str().c_str()); + log->Printf(" [ClangASTImporter] Completing an ObjCInterfaceDecl named %s", interface_decl->getName().str().c_str()); DeclOrigin decl_origin = GetDeclOrigin(interface_decl); @@ -125,7 +125,7 @@ to_tag_decl->setHasExternalLexicalStorage(); if (log) - log->Printf("Imported a TagDecl named %s%s%s", + log->Printf(" [ClangASTImporter] Imported a TagDecl named %s%s%s", from_tag_decl->getName().str().c_str(), (to_tag_decl->hasExternalLexicalStorage() ? " Lexical" : ""), (to_tag_decl->hasExternalVisibleStorage() ? " Visible" : "")); From gclayton at apple.com Fri Oct 14 16:34:45 2011 From: gclayton at apple.com (Greg Clayton) Date: Fri, 14 Oct 2011 21:34:45 -0000 Subject: [Lldb-commits] [lldb] r142005 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp Message-ID: <20111014213445.DD8F1312800A@llvm.org> Author: gclayton Date: Fri Oct 14 16:34:45 2011 New Revision: 142005 URL: http://llvm.org/viewvc/llvm-project?rev=142005&view=rev Log: Make sure we create only unique one namespace per AST when parsing the DWARF. Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=142005&r1=142004&r2=142005&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Oct 14 16:34:45 2011 @@ -540,7 +540,6 @@ clang::NamespaceDecl * GetUniqueNamespaceDeclaration (const char *name, - const Declaration &decl, clang::DeclContext *decl_ctx); //------------------------------------------------------------------ Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=142005&r1=142004&r2=142005&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Fri Oct 14 16:34:45 2011 @@ -1145,11 +1145,12 @@ if (obj_file) obj_file_name = obj_file->GetFileSpec().GetFilename().AsCString(); const char *die_name = GetName (dwarf2Data, cu); - s.Printf ("CU: %s OBJFILE: %s DIE: %s (0x%x).", - cu_name ? cu_name : "", - obj_file_name ? obj_file_name : "", - die_name ? die_name : "", - GetOffset()); + s.Printf ("0x%8.8x/0x%8.8x: %-30s (from %s in %s)", + cu->GetOffset(), + GetOffset(), + die_name ? die_name : "", + cu_name ? cu_name : "", + obj_file_name ? obj_file_name : ""); } //---------------------------------------------------------------------- Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=142005&r1=142004&r2=142005&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 14 16:34:45 2011 @@ -3313,16 +3313,41 @@ clang::NamespaceDecl * SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebugInfoEntry *die) { - if (die->Tag() == DW_TAG_namespace) + if (die && die->Tag() == DW_TAG_namespace) { - const char *namespace_name = die->GetAttributeValueAsString(this, curr_cu, DW_AT_name, NULL); - if (namespace_name) - { - Declaration decl; // TODO: fill in the decl object - clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (curr_cu, die->GetParent(), NULL)); - if (namespace_decl) - LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die); + // See if we already parsed this namespace DIE and associated it with a + // uniqued namespace declaration + clang::NamespaceDecl *namespace_decl = static_cast(m_die_to_decl_ctx[die]); + if (namespace_decl) return namespace_decl; + else + { + const char *namespace_name = die->GetAttributeValueAsString(this, curr_cu, DW_AT_name, NULL); + if (namespace_name) + { + clang::DeclContext *containing_decl_ctx = GetClangDeclContextContainingDIE (curr_cu, die, NULL); + namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, containing_decl_ctx); + LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO)); + if (log) + { + const char *object_name = m_obj_file->GetModule()->GetObjectName().GetCString(); + log->Printf ("ASTContext => %p: 0x%8.8x: DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl * %p in %s/%s%s%s%s (original = %p)", + GetClangASTContext().getASTContext(), + die->GetOffset(), + namespace_name, + namespace_decl, + m_obj_file->GetFileSpec().GetDirectory().GetCString(), + m_obj_file->GetFileSpec().GetFilename().GetCString(), + object_name ? "(" : "", + object_name ? object_name : "", + object_name ? "(" : "", + namespace_decl->getOriginalNamespace()); + } + + if (namespace_decl) + LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, die); + return namespace_decl; + } } } return NULL; @@ -3377,17 +3402,7 @@ return m_clang_tu_decl; case DW_TAG_namespace: - { - const char *namespace_name = decl_ctx_die->GetAttributeValueAsString(this, cu, DW_AT_name, NULL); - if (namespace_name) - { - Declaration decl; // TODO: fill in the decl object - clang::NamespaceDecl *namespace_decl = GetClangASTContext().GetUniqueNamespaceDeclaration (namespace_name, decl, GetClangDeclContextContainingDIE (cu, decl_ctx_die, NULL)); - if (namespace_decl) - LinkDeclContextToDIE((clang::DeclContext*)namespace_decl, decl_ctx_die); - return namespace_decl; - } - } + return ResolveNamespaceDIE (cu, decl_ctx_die); break; case DW_TAG_structure_type: Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=142005&r1=142004&r2=142005&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 14 16:34:45 2011 @@ -4115,18 +4115,30 @@ #pragma mark Namespace Declarations NamespaceDecl * -ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, const Declaration &decl, DeclContext *decl_ctx) +ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx) { - // TODO: Do something intelligent with the Declaration object passed in - // like maybe filling in the SourceLocation with it... + NamespaceDecl *namespace_decl = NULL; if (name) { ASTContext *ast = getASTContext(); if (decl_ctx == NULL) decl_ctx = ast->getTranslationUnitDecl(); - return NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), &ast->Idents.get(name)); + + IdentifierInfo &identifier_info = ast->Idents.get(name); + DeclarationName decl_name (&identifier_info); + clang::DeclContext::lookup_result result = decl_ctx->lookup(decl_name); + for (clang::DeclContext::lookup_iterator pos = result.first, end = result.second; pos != end; ++pos) + { + namespace_decl = dyn_cast(*pos); + if (namespace_decl) + return namespace_decl; + } + + namespace_decl = NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), &identifier_info); + + decl_ctx->addDecl (namespace_decl); } - return NULL; + return namespace_decl; } From scallanan at apple.com Fri Oct 14 16:43:51 2011 From: scallanan at apple.com (Sean Callanan) Date: Fri, 14 Oct 2011 21:43:51 -0000 Subject: [Lldb-commits] [lldb] r142006 - /lldb/trunk/scripts/buildbot.py Message-ID: <20111014214351.84C432A6C12C@llvm.org> Author: spyffe Date: Fri Oct 14 16:43:51 2011 New Revision: 142006 URL: http://llvm.org/viewvc/llvm-project?rev=142006&view=rev Log: Added a buildbot script that automatically checks out the latest LLDB, LLVM and Clang and makes sure they work okay together. The buildbot is currently Mac OS X only because it uses xcodebuild. Right now, the portion that runs the LLDB test suite is commented out because of code-signing problems (specifically, on Mac OS 10.7 a UI dialog appears asking for the user's permission to attach to the inferior process). You can use the buildbot like this: ./scripts/buildbot.py -b /tmp/lldb-build -l /tmp/lldb.log /tmp/lldb-build and /tmp/lldb.log should not exist when the script is run. /tmp/lldb-build is a temporary directory and is removed at the end of a normal execution. /tmp/lldb.log is a log file that sticks around. The buildbot does not require built versions of anything; it will do the building itself. Added: lldb/trunk/scripts/buildbot.py (with props) Added: lldb/trunk/scripts/buildbot.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/buildbot.py?rev=142006&view=auto ============================================================================== --- lldb/trunk/scripts/buildbot.py (added) +++ lldb/trunk/scripts/buildbot.py Fri Oct 14 16:43:51 2011 @@ -0,0 +1,152 @@ +#!/usr/bin/env python + +import argparse +import os +import os.path +import shutil +import subprocess +import sys + +class BuildError(Exception): + def __init__(self, + string=None, + path=None, + inferior_error=None): + self.m_string = string + self.m_path = path + self.m_inferior_error = inferior_error + def __str__(self): + if self.m_path and self.m_string: + return "Build error: %s (referring to %s)" % (self.m_string, self.m_path) + if self.m_path: + return "Build error (referring to %s)" % (self.m_path) + if self.m_string: + return "Build error: %s" % (self.m_string) + return "Build error" + +class LLDBBuildBot: + def __init__(self, + build_directory_path, + log_path, + lldb_repository_url="http://llvm.org/svn/llvm-project/lldb/trunk", + llvm_repository_url="http://llvm.org/svn/llvm-project/llvm/trunk", + clang_repository_url="http://llvm.org/svn/llvm-project/cfe/trunk", + revision=None): + self.m_build_directory_path = os.path.abspath(build_directory_path) + self.m_log_path = os.path.abspath(log_path) + self.m_lldb_repository_url = lldb_repository_url + self.m_llvm_repository_url = llvm_repository_url + self.m_clang_repository_url = clang_repository_url + self.m_revision = revision + self.m_log_stream = None + def Setup(self): + if os.path.exists(self.m_build_directory_path): + raise BuildError(string="Build directory exists", path=self.m_build_directory_path) + if os.path.exists(self.m_log_path): + raise BuildError(string="Log file exists", path=self.m_log_path) + self.m_log_stream = open(self.m_log_path, 'w') + os.mkdir(self.m_build_directory_path) + def Checkout(self): + os.chdir(self.m_build_directory_path) + + cmdline_prefix = [] + + if self.m_revision != None: + cmdline_prefix = ["svn", "-r %s" % (self.m_revision), "co"] + else: + cmdline_prefix = ["svn", "co"] + + returncode = subprocess.call(cmdline_prefix + [self.m_lldb_repository_url, "lldb"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + if returncode != 0: + raise BuildError(string="Couldn't checkout LLDB") + + os.chdir("lldb") + + returncode = subprocess.call(cmdline_prefix + [self.m_llvm_repository_url, "llvm.checkout"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + + if returncode != 0: + raise BuildError(string="Couldn't checkout LLVM") + + os.symlink("llvm.checkout", "llvm") + + os.chdir("llvm/tools") + + returncode = subprocess.call(cmdline_prefix + [self.m_clang_repository_url, "clang"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + + if returncode != 0: + raise BuildError(string="Couldn't checkout Clang") + def Build(self): + os.chdir(self.m_build_directory_path) + os.chdir("lldb/llvm") + + returncode = subprocess.call(["./configure", "--disable-optimized", "--enable-assertions", "--enable-targets=x86,x86_64,arm"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + + if returncode != 0: + raise BuildError(string="Couldn't configure LLVM/Clang") + + returncode = subprocess.call(["make"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + + if returncode != 0: + raise BuildError(string="Couldn't build LLVM/Clang") + + os.chdir(self.m_build_directory_path) + os.chdir("lldb") + + returncode = subprocess.call(["xcodebuild", + "-project", "lldb.xcodeproj", + "-target", "lldb-tool", + "-configuration", "Debug", + "-arch", "x86_64", + "LLVM_CONFIGURATION=Debug+Asserts", + "OBJROOT=build"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + + if returncode != 0: + raise BuildError(string="Couldn't build LLDB") + def Test(self): + os.chdir(self.m_build_directory_path) + os.chdir("lldb/test") + + returncode = subprocess.call(["./dotest.py", "-t"], + stdout=self.m_log_stream, + stderr=self.m_log_stream) + def Takedown(self): + os.chdir("/tmp") + self.m_log_stream.close() + shutil.rmtree(self.m_build_directory_path) + def Run(self): + self.Setup() + self.Checkout() + self.Build() + #self.Test() + self.Takedown() + +def GetArgParser(): + parser = argparse.ArgumentParser(description="Try to build LLDB/LLVM/Clang and run the full test suite.") + parser.add_argument("--build-path", "-b", required=True, help="A (nonexistent) path to put temporary build products into", metavar="path") + parser.add_argument("--log-file", "-l", required=True, help="The name of a (nonexistent) log file", metavar="file") + parser.add_argument("--revision", "-r", required=False, help="The LLVM revision to use", metavar="N") + return parser + +parser = GetArgParser() +arg_dict = vars(parser.parse_args()) + +build_bot = LLDBBuildBot(build_directory_path=arg_dict["build_path"], + log_path=arg_dict["log_file"], + revision=arg_dict["revision"]) + +try: + build_bot.Run() +except BuildError as err: + print err Propchange: lldb/trunk/scripts/buildbot.py ------------------------------------------------------------------------------ svn:executable = * From gclayton at apple.com Fri Oct 14 17:47:18 2011 From: gclayton at apple.com (Greg Clayton) Date: Fri, 14 Oct 2011 22:47:18 -0000 Subject: [Lldb-commits] [lldb] r142011 - in /lldb/trunk: include/lldb/Symbol/ClangASTContext.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp source/Symbol/ClangASTContext.cpp Message-ID: <20111014224718.7E3C6312800A@llvm.org> Author: gclayton Date: Fri Oct 14 17:47:18 2011 New Revision: 142011 URL: http://llvm.org/viewvc/llvm-project?rev=142011&view=rev Log: Add function decls to their parent decl context. Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=142011&r1=142010&r2=142011&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Oct 14 17:47:18 2011 @@ -547,7 +547,8 @@ //------------------------------------------------------------------ clang::FunctionDecl * - CreateFunctionDeclaration (const char *name, + CreateFunctionDeclaration (clang::DeclContext *decl_ctx, + const char *name, lldb::clang_type_t function_Type, int storage, bool is_inline); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=142011&r1=142010&r2=142011&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Oct 14 17:47:18 2011 @@ -4368,7 +4368,8 @@ if (!type_handled) { // We just have a function that isn't part of a class - clang::FunctionDecl *function_decl = ast.CreateFunctionDeclaration (type_name_cstr, + clang::FunctionDecl *function_decl = ast.CreateFunctionDeclaration (containing_decl_ctx, + type_name_cstr, clang_type, storage, is_inline); Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=142011&r1=142010&r2=142011&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 14 17:47:18 2011 @@ -4145,41 +4145,42 @@ #pragma mark Function Types FunctionDecl * -ClangASTContext::CreateFunctionDeclaration (const char *name, clang_type_t function_clang_type, int storage, bool is_inline) +ClangASTContext::CreateFunctionDeclaration (DeclContext *decl_ctx, const char *name, clang_type_t function_clang_type, int storage, bool is_inline) { - if (name) - { - ASTContext *ast = getASTContext(); - assert (ast != NULL); + FunctionDecl *func_decl = NULL; + ASTContext *ast = getASTContext(); + if (decl_ctx == NULL) + decl_ctx = ast->getTranslationUnitDecl(); - if (name && name[0]) - { - return FunctionDecl::Create(*ast, - ast->getTranslationUnitDecl(), - SourceLocation(), - SourceLocation(), - DeclarationName (&ast->Idents.get(name)), - QualType::getFromOpaquePtr(function_clang_type), - NULL, - (FunctionDecl::StorageClass)storage, - (FunctionDecl::StorageClass)storage, - is_inline); - } - else - { - return FunctionDecl::Create(*ast, - ast->getTranslationUnitDecl(), - SourceLocation(), - SourceLocation(), - DeclarationName (), - QualType::getFromOpaquePtr(function_clang_type), - NULL, - (FunctionDecl::StorageClass)storage, - (FunctionDecl::StorageClass)storage, - is_inline); - } + if (name && name[0]) + { + func_decl = FunctionDecl::Create (*ast, + decl_ctx, + SourceLocation(), + SourceLocation(), + DeclarationName (&ast->Idents.get(name)), + QualType::getFromOpaquePtr(function_clang_type), + NULL, + (FunctionDecl::StorageClass)storage, + (FunctionDecl::StorageClass)storage, + is_inline); } - return NULL; + else + { + func_decl = FunctionDecl::Create (*ast, + decl_ctx, + SourceLocation(), + SourceLocation(), + DeclarationName (), + QualType::getFromOpaquePtr(function_clang_type), + NULL, + (FunctionDecl::StorageClass)storage, + (FunctionDecl::StorageClass)storage, + is_inline); + } + if (func_decl) + decl_ctx->addDecl (func_decl); + return func_decl; } clang_type_t @@ -4204,10 +4205,10 @@ proto_info.NumExceptions = 0; proto_info.Exceptions = NULL; - return ast->getFunctionType(QualType::getFromOpaquePtr(result_type), - qual_type_args.empty() ? NULL : &qual_type_args.front(), - qual_type_args.size(), - proto_info).getAsOpaquePtr(); // NoReturn); + return ast->getFunctionType (QualType::getFromOpaquePtr(result_type), + qual_type_args.empty() ? NULL : &qual_type_args.front(), + qual_type_args.size(), + proto_info).getAsOpaquePtr(); // NoReturn); } ParmVarDecl * @@ -5218,6 +5219,8 @@ name ? &identifier_table->get(name) : NULL, // Identifier ast->CreateTypeSourceInfo(qual_type)); + //decl_ctx->addDecl (decl); + decl->setAccess(AS_public); // TODO respect proper access specifier // Get a uniqued QualType for the typedef decl type From jingham at apple.com Fri Oct 14 19:21:37 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 15 Oct 2011 00:21:37 -0000 Subject: [Lldb-commits] [lldb] r142024 - in /lldb/trunk/source/Plugins/Process/gdb-remote: ProcessGDBRemote.cpp ThreadGDBRemote.cpp Message-ID: <20111015002138.0073A312800A@llvm.org> Author: jingham Date: Fri Oct 14 19:21:37 2011 New Revision: 142024 URL: http://llvm.org/viewvc/llvm-project?rev=142024&view=rev Log: Quiet the default "log enable lldb step" output down a little bit. Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=142024&r1=142023&r2=142024&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Oct 14 19:21:37 2011 @@ -2539,7 +2539,7 @@ lldb::BreakpointSP break_sp = m_target.GetBreakpointByID(m_thread_observation_bps[i]); if (break_sp) { - if (log) + if (log && log->GetVerbose()) log->Printf("Enabled noticing new thread breakpoint."); break_sp->SetEnabled(true); } @@ -2552,7 +2552,7 @@ Breakpoint *breakpoint = m_target.CreateBreakpoint (NULL, NULL, bp_names[i], eFunctionNameTypeFull, true).get(); if (breakpoint) { - if (log) + if (log && log->GetVerbose()) log->Printf("Successfully created new thread notification breakpoint at \"%s\".", bp_names[i]); m_thread_observation_bps.push_back(breakpoint->GetID()); breakpoint->SetCallback (ProcessGDBRemote::NewThreadNotifyBreakpointHit, this, true); @@ -2573,7 +2573,7 @@ ProcessGDBRemote::StopNoticingNewThreads() { LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - if (log) + if (log && log->GetVerbose()) log->Printf ("Disabling new thread notification breakpoint."); size_t num_bps = m_thread_observation_bps.size(); if (num_bps != 0) Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp?rev=142024&r1=142023&r2=142024&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp Fri Oct 14 19:21:37 2011 @@ -75,7 +75,7 @@ Thread::WillResume(resume_state); int signo = GetResumeSignal(); - lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STEP)); + lldb::LogSP log(lldb_private::GetLogIfAnyCategoriesSet (GDBR_LOG_THREAD)); if (log) log->Printf ("Resuming thread: %4.4x with state: %s.", GetID(), StateAsCString(resume_state)); From jingham at apple.com Fri Oct 14 19:23:43 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 15 Oct 2011 00:23:43 -0000 Subject: [Lldb-commits] [lldb] r142025 - in /lldb/trunk/source/Target: Thread.cpp ThreadList.cpp Message-ID: <20111015002343.BA63E2A6C12C@llvm.org> Author: jingham Date: Fri Oct 14 19:23:43 2011 New Revision: 142025 URL: http://llvm.org/viewvc/llvm-project?rev=142025&view=rev Log: Make the "log enable lldb-step" output easier to parse. Modified: lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadList.cpp Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=142025&r1=142024&r2=142025&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Fri Oct 14 19:23:43 2011 @@ -262,9 +262,11 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) { + log->Printf ("^^^^^^^^ Thread::ShouldStop Begin ^^^^^^^^"); StreamString s; + s.IndentMore(); DumpThreadPlans(&s); - log->PutCString (s.GetData()); + log->Printf ("Plan stack initial state:\n%s", s.GetData()); } // The top most plan always gets to do the trace log... @@ -274,6 +276,9 @@ { bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr); + if (log) + log->Printf("Plan %s explains stop, auto-continue %i.", current_plan->GetName(), over_ride_stop); + // We're starting from the base plan, so just let it decide; if (PlanIsBasePlan(current_plan)) { @@ -330,7 +335,7 @@ } else if (current_plan->TracerExplainsStop()) { - return false; + should_stop = false; } else { @@ -348,6 +353,14 @@ } } + if (log) + { + StreamString s; + s.IndentMore(); + DumpThreadPlans(&s); + log->Printf ("Plan stack final state:\n%s", s.GetData()); + log->Printf ("vvvvvvvv Thread::ShouldStop End (returning %i) vvvvvvvv", should_stop); + } return should_stop; } @@ -850,36 +863,48 @@ { uint32_t stack_size = m_plan_stack.size(); int i; + s->Indent(); s->Printf ("Plan Stack for thread #%u: tid = 0x%4.4x, stack_size = %d\n", GetIndexID(), GetID(), stack_size); for (i = stack_size - 1; i >= 0; i--) { - s->Printf ("Element %d: ", i); s->IndentMore(); + s->Indent(); + s->Printf ("Element %d: ", i); m_plan_stack[i]->GetDescription (s, eDescriptionLevelFull); - s->IndentLess(); s->EOL(); + s->IndentLess(); } stack_size = m_completed_plan_stack.size(); - s->Printf ("Completed Plan Stack: %d elements.\n", stack_size); - for (i = stack_size - 1; i >= 0; i--) + if (stack_size > 0) { - s->Printf ("Element %d: ", i); - s->IndentMore(); - m_completed_plan_stack[i]->GetDescription (s, eDescriptionLevelFull); - s->IndentLess(); - s->EOL(); + s->Indent(); + s->Printf ("Completed Plan Stack: %d elements.\n", stack_size); + for (i = stack_size - 1; i >= 0; i--) + { + s->IndentMore(); + s->Indent(); + s->Printf ("Element %d: ", i); + m_completed_plan_stack[i]->GetDescription (s, eDescriptionLevelFull); + s->EOL(); + s->IndentLess(); + } } stack_size = m_discarded_plan_stack.size(); - s->Printf ("Discarded Plan Stack: %d elements.\n", stack_size); - for (i = stack_size - 1; i >= 0; i--) + if (stack_size > 0) { - s->Printf ("Element %d: ", i); - s->IndentMore(); - m_discarded_plan_stack[i]->GetDescription (s, eDescriptionLevelFull); - s->IndentLess(); - s->EOL(); + s->Indent(); + s->Printf ("Discarded Plan Stack: %d elements.\n", stack_size); + for (i = stack_size - 1; i >= 0; i--) + { + s->IndentMore(); + s->Indent(); + s->Printf ("Element %d: ", i); + m_discarded_plan_stack[i]->GetDescription (s, eDescriptionLevelFull); + s->EOL(); + s->IndentLess(); + } } } Modified: lldb/trunk/source/Target/ThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=142025&r1=142024&r2=142025&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadList.cpp (original) +++ lldb/trunk/source/Target/ThreadList.cpp Fri Oct 14 19:23:43 2011 @@ -187,7 +187,10 @@ collection::iterator pos, end = m_threads.end(); if (log) - log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size()); + { + log->PutCString(""); + log->Printf ("ThreadList::%s: %zu threads", __FUNCTION__, m_threads.size()); + } // Run through the threads and ask whether we should stop. Don't ask // suspended threads, however, it makes more sense for them to preserve their @@ -199,7 +202,7 @@ if (thread_sp->GetResumeState () == eStateSuspended) { if (log) - log->Printf ("%s tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = 0 (ignore since thread was suspended)", + log->Printf ("ThreadList::%s for tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = 0 (ignore since thread was suspended)", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC()); @@ -209,26 +212,25 @@ if (thread_sp->ThreadStoppedForAReason() == false) { if (log) - log->Printf ("%s tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = 0 (ignore since no stop reason)", + log->Printf ("ThreadList::%s for tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = 0 (ignore since no stop reason)", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC()); continue; } - const bool thread_should_stop = thread_sp->ShouldStop(event_ptr); if (log) - log->Printf ("%s tid = 0x%4.4x, pc = 0x%16.16llx, should_stop = %i", + log->Printf ("ThreadList::%s for tid = 0x%4.4x, pc = 0x%16.16llx", __FUNCTION__, thread_sp->GetID (), - thread_sp->GetRegisterContext()->GetPC(), - thread_should_stop); + thread_sp->GetRegisterContext()->GetPC()); + const bool thread_should_stop = thread_sp->ShouldStop(event_ptr); if (thread_should_stop) should_stop |= true; } if (log) - log->Printf ("%s overall should_stop = %i", __FUNCTION__, should_stop); + log->Printf ("ThreadList::%s overall should_stop = %i", __FUNCTION__, should_stop); if (should_stop) { @@ -254,7 +256,7 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) - log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size()); + log->Printf ("ThreadList::%s %zu threads", __FUNCTION__, m_threads.size()); // Run through the threads and ask whether we should report this event. // For stopping, a YES vote wins over everything. A NO vote wins over NO opinion. @@ -265,7 +267,7 @@ { const Vote vote = thread_sp->ShouldReportStop (event_ptr); if (log) - log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx, vote = %s", + log->Printf ("ThreadList::%s thread 0x%4.4x: pc = 0x%16.16llx, vote = %s", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC(), @@ -287,7 +289,7 @@ else { if (log) - log->Printf ("%s thread 0x%4.4x: pc = 0x%16.16llx voted %s, but lost out because result was %s", + log->Printf ("ThreadList::%s thread 0x%4.4x: pc = 0x%16.16llx voted %s, but lost out because result was %s", __FUNCTION__, thread_sp->GetID (), thread_sp->GetRegisterContext()->GetPC(), @@ -299,7 +301,7 @@ } } if (log) - log->Printf ("%s returning %s", __FUNCTION__, GetVoteAsCString (result)); + log->Printf ("ThreadList::%s returning %s", __FUNCTION__, GetVoteAsCString (result)); return result; } @@ -360,7 +362,7 @@ m_process->UpdateThreadListIfNeeded(); LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - if (log) + if (log && log->GetVerbose()) log->Printf ("Turning off notification of new threads while single stepping a thread."); collection::iterator pos, end = m_threads.end(); @@ -416,14 +418,14 @@ if (wants_solo_run) { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - if (log) + if (log && log->GetVerbose()) log->Printf ("Turning on notification of new threads while single stepping a thread."); m_process->StartNoticingNewThreads(); } else { LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - if (log) + if (log && log->GetVerbose()) log->Printf ("Turning off notification of new threads while single stepping a thread."); m_process->StopNoticingNewThreads(); } From jingham at apple.com Fri Oct 14 19:24:48 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 15 Oct 2011 00:24:48 -0000 Subject: [Lldb-commits] [lldb] r142026 - in /lldb/trunk: include/lldb/Target/ThreadPlanStepInRange.h include/lldb/Target/ThreadPlanStepOverRange.h include/lldb/Target/ThreadPlanStepRange.h source/Target/ThreadPlanStepInRange.cpp source/Target/ThreadPlanStepOverRange.cpp source/Target/ThreadPlanStepRange.cpp Message-ID: <20111015002448.5B5F6312800A@llvm.org> Author: jingham Date: Fri Oct 14 19:24:48 2011 New Revision: 142026 URL: http://llvm.org/viewvc/llvm-project?rev=142026&view=rev Log: Make the step range plans capable of supporting multiple ranges. Also make their constructors public, there isn't any good reason why you shouldn't be able to make these plans. Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h lldb/trunk/include/lldb/Target/ThreadPlanStepOverRange.h lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp lldb/trunk/source/Target/ThreadPlanStepRange.cpp Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h?rev=142026&r1=142025&r2=142026&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepInRange.h Fri Oct 14 19:24:48 2011 @@ -27,6 +27,11 @@ public ThreadPlanShouldStopHere { public: + ThreadPlanStepInRange (Thread &thread, + const AddressRange &range, + const SymbolContext &addr_context, + lldb::RunMode stop_others); + virtual ~ThreadPlanStepInRange (); @@ -46,11 +51,6 @@ protected: - ThreadPlanStepInRange (Thread &thread, - const AddressRange &range, - const SymbolContext &addr_context, - lldb::RunMode stop_others); - virtual void SetFlagsToDefault (); Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOverRange.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepOverRange.h?rev=142026&r1=142025&r2=142026&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepOverRange.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepOverRange.h Fri Oct 14 19:24:48 2011 @@ -24,6 +24,13 @@ class ThreadPlanStepOverRange : public ThreadPlanStepRange { public: + + ThreadPlanStepOverRange (Thread &thread, + const AddressRange &range, + const SymbolContext &addr_context, + lldb::RunMode stop_others, + bool okay_to_discard = false); + virtual ~ThreadPlanStepOverRange (); virtual void GetDescription (Stream *s, lldb::DescriptionLevel level); @@ -36,8 +43,6 @@ protected: - ThreadPlanStepOverRange (Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others, bool okay_to_discard = false); - private: friend ThreadPlan * Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h?rev=142026&r1=142025&r2=142026&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h Fri Oct 14 19:24:48 2011 @@ -25,6 +25,13 @@ class ThreadPlanStepRange : public ThreadPlan { public: + ThreadPlanStepRange (ThreadPlanKind kind, + const char *name, + Thread &thread, + const AddressRange &range, + const SymbolContext &addr_context, + lldb::RunMode stop_others); + virtual ~ThreadPlanStepRange (); virtual void GetDescription (Stream *s, lldb::DescriptionLevel level) = 0; @@ -37,22 +44,18 @@ virtual bool WillStop (); virtual bool MischiefManaged (); -protected: + void AddRange(const AddressRange &new_range); - ThreadPlanStepRange (ThreadPlanKind kind, - const char *name, - Thread &thread, - const AddressRange &range, - const SymbolContext &addr_context, - lldb::RunMode stop_others); +protected: bool InRange(); bool FrameIsYounger(); bool FrameIsOlder(); bool InSymbol(); + void DumpRanges (Stream *s); SymbolContext m_addr_context; - AddressRange m_address_range; + std::vector m_address_ranges; lldb::RunMode m_stop_others; uint32_t m_stack_depth; StackID m_stack_id; // Use the stack ID so we can tell step out from step in. Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=142026&r1=142025&r2=142026&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Oct 14 19:24:48 2011 @@ -63,7 +63,7 @@ else { s->Printf ("Stepping through range (stepping into functions): "); - m_address_range.Dump (s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress); + DumpRanges(s); } } Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=142026&r1=142025&r2=142026&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Fri Oct 14 19:24:48 2011 @@ -58,7 +58,7 @@ else { s->Printf ("stepping through range (stepping over functions): "); - m_address_range.Dump (s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress); + DumpRanges(s); } } Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=142026&r1=142025&r2=142026&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Oct 14 19:24:48 2011 @@ -41,13 +41,14 @@ lldb::RunMode stop_others) : ThreadPlan (kind, name, thread, eVoteNoOpinion, eVoteNoOpinion), m_addr_context (addr_context), - m_address_range (range), + m_address_ranges (), m_stop_others (stop_others), m_stack_depth (0), m_stack_id (), m_no_more_plans (false), m_first_run_event (true) { + AddRange(range); m_stack_depth = m_thread.GetStackFrameCount(); m_stack_id = m_thread.GetStackFrameAtIndex(0)->GetStackID(); } @@ -97,6 +98,33 @@ return vote; } +void +ThreadPlanStepRange::AddRange(const AddressRange &new_range) +{ + // For now I'm just adding the ranges. At some point we may want to + // condense the ranges if they overlap, though I don't think it is likely + // to be very important. + m_address_ranges.push_back (new_range); +} + +void +ThreadPlanStepRange::DumpRanges(Stream *s) +{ + size_t num_ranges = m_address_ranges.size(); + if (num_ranges == 1) + { + m_address_ranges[0].Dump (s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress); + } + else + { + for (size_t i = 0; i < num_ranges; i++) + { + s->PutCString("%d: "); + m_address_ranges[i].Dump (s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress); + } + } +} + bool ThreadPlanStepRange::InRange () { @@ -105,7 +133,13 @@ lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC(); - ret_value = m_address_range.ContainsLoadAddress(pc_load_addr, &m_thread.GetProcess().GetTarget()); + size_t num_ranges = m_address_ranges.size(); + for (size_t i = 0; i < num_ranges; i++) + { + ret_value = m_address_ranges[i].ContainsLoadAddress(pc_load_addr, &m_thread.GetProcess().GetTarget()); + if (ret_value) + break; + } if (!ret_value) { @@ -120,12 +154,14 @@ if (m_addr_context.line_entry.line == new_context.line_entry.line) { m_addr_context = new_context; - m_address_range = m_addr_context.line_entry.range; + AddRange(m_addr_context.line_entry.range); ret_value = true; if (log) { StreamString s; - m_address_range.Dump (&s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress); + m_addr_context.line_entry.range.Dump (&s, + &m_thread.GetProcess().GetTarget(), + Address::DumpStyleLoadAddress); log->Printf ("Step range plan stepped to another range of same line: %s", s.GetData()); } @@ -138,12 +174,15 @@ // But we probably don't want to be in the middle of a line range, so in that case reset the stepping // range to the line we've stepped into the middle of and continue. m_addr_context = new_context; - m_address_range = m_addr_context.line_entry.range; + m_address_ranges.clear(); + AddRange(m_addr_context.line_entry.range); ret_value = true; if (log) { StreamString s; - m_address_range.Dump (&s, &m_thread.GetProcess().GetTarget(), Address::DumpStyleLoadAddress); + m_addr_context.line_entry.range.Dump (&s, + &m_thread.GetProcess().GetTarget(), + Address::DumpStyleLoadAddress); log->Printf ("Step range plan stepped to the middle of new line(%d): %s, continuing to clear this line.", new_context.line_entry.line, From jingham at apple.com Fri Oct 14 19:57:29 2011 From: jingham at apple.com (Jim Ingham) Date: Sat, 15 Oct 2011 00:57:29 -0000 Subject: [Lldb-commits] [lldb] r142031 - in /lldb/trunk: include/lldb/Target/ThreadPlanStepOut.h source/Target/ThreadPlanStepOut.cpp Message-ID: <20111015005729.2325E312800A@llvm.org> Author: jingham Date: Fri Oct 14 19:57:28 2011 New Revision: 142031 URL: http://llvm.org/viewvc/llvm-project?rev=142031&view=rev Log: Make "next" and "step-out" work when in stepping over or out of inlined functions. Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h lldb/trunk/source/Target/ThreadPlanStepOut.cpp Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h?rev=142031&r1=142030&r2=142031&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepOut.h Fri Oct 14 19:57:28 2011 @@ -19,10 +19,19 @@ namespace lldb_private { +class ThreadPlanStepOverRange; class ThreadPlanStepOut : public ThreadPlan { public: + ThreadPlanStepOut (Thread &thread, + SymbolContext *addr_context, + bool first_insn, + bool stop_others, + Vote stop_vote, + Vote run_vote, + uint32_t frame_idx); + virtual ~ThreadPlanStepOut (); virtual void GetDescription (Stream *s, lldb::DescriptionLevel level); @@ -34,16 +43,11 @@ virtual bool WillResume (lldb::StateType resume_state, bool current_plan); virtual bool WillStop (); virtual bool MischiefManaged (); + virtual void DidPush(); - ThreadPlanStepOut (Thread &thread, - SymbolContext *addr_context, - bool first_insn, - bool stop_others, - Vote stop_vote, - Vote run_vote, - uint32_t frame_idx); protected: - + bool QueueInlinedStepPlan (bool queue_now); + private: SymbolContext *m_step_from_context; lldb::addr_t m_step_from_insn; @@ -52,6 +56,8 @@ lldb::addr_t m_return_addr; bool m_first_insn; bool m_stop_others; + lldb::ThreadPlanSP m_step_through_inline_plan_sp; + lldb::ThreadPlanSP m_step_out_plan_sp; friend ThreadPlan * Thread::QueueThreadPlanForStepOut (bool abort_other_plans, Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=142031&r1=142030&r2=142031&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Fri Oct 14 19:57:28 2011 @@ -20,6 +20,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" +#include "lldb/Target/ThreadPlanStepOverRange.h" using namespace lldb; using namespace lldb_private; @@ -44,18 +45,43 @@ m_return_bp_id (LLDB_INVALID_BREAK_ID), m_return_addr (LLDB_INVALID_ADDRESS), m_first_insn (first_insn), - m_stop_others (stop_others) + m_stop_others (stop_others), + m_step_through_inline_plan_sp(), + m_step_out_plan_sp () + { m_step_from_insn = m_thread.GetRegisterContext()->GetPC(0); - // Find the return address and set a breakpoint there: - // FIXME - can we do this more securely if we know first_insn? - StackFrameSP return_frame_sp (m_thread.GetStackFrameAtIndex(frame_idx + 1)); - if (return_frame_sp) + StackFrameSP immediate_return_from_sp (m_thread.GetStackFrameAtIndex (frame_idx)); + + m_stack_depth = m_thread.GetStackFrameCount() - frame_idx; + + // If the frame directly below the one we are returning to is inlined, we have to be + // a little more careful. It is non-trivial to determine the real "return code address" for + // an inlined frame, so we have to work our way to that frame and then step out. + if (immediate_return_from_sp && immediate_return_from_sp->IsInlined()) + { + if (frame_idx > 0) + { + // First queue a plan that gets us to this inlined frame, and when we get there we'll queue a second + // plan that walks us out of this frame. + m_step_out_plan_sp.reset (new ThreadPlanStepOut(m_thread, NULL, false, stop_others, eVoteNoOpinion, eVoteNoOpinion, frame_idx - 1)); + m_step_out_plan_sp->SetOkayToDiscard(true); + } + else + { + // If we're already at the inlined frame we're stepping through, then just do that now. + QueueInlinedStepPlan(false); + } + + } + else if (return_frame_sp) { - // TODO: check for inlined frames and do the right thing... - m_return_addr = return_frame_sp->GetRegisterContext()->GetPC(); + // Find the return address and set a breakpoint there: + // FIXME - can we do this more securely if we know first_insn? + + m_return_addr = return_frame_sp->GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess().GetTarget()); Breakpoint *return_bp = m_thread.GetProcess().GetTarget().CreateBreakpoint (m_return_addr, true).get(); if (return_bp != NULL) { @@ -64,7 +90,15 @@ } } - m_stack_depth = m_thread.GetStackFrameCount() - frame_idx; +} + +void +ThreadPlanStepOut::DidPush() +{ + if (m_step_out_plan_sp) + m_thread.QueueThreadPlan(m_step_out_plan_sp, false); + else if (m_step_through_inline_plan_sp) + m_thread.QueueThreadPlan(m_step_through_inline_plan_sp, false); } ThreadPlanStepOut::~ThreadPlanStepOut () @@ -80,18 +114,31 @@ s->Printf ("step out"); else { - s->Printf ("Stepping out from address 0x%llx to return address 0x%llx using breakpoint site %d", - (uint64_t)m_step_from_insn, - (uint64_t)m_return_addr, - m_return_bp_id); + if (m_step_out_plan_sp) + s->Printf ("Stepping out to inlined frame at depth: %d so we can walk through it.", m_stack_depth); + else if (m_step_through_inline_plan_sp) + s->Printf ("Stepping out by stepping through inlined function."); + else + s->Printf ("Stepping out from address 0x%llx to return address 0x%llx at depth: %d using breakpoint site %d", + (uint64_t)m_step_from_insn, + (uint64_t)m_return_addr, + m_stack_depth, + m_return_bp_id); } } bool ThreadPlanStepOut::ValidatePlan (Stream *error) { - if (m_return_bp_id == LLDB_INVALID_BREAK_ID) + if (m_step_out_plan_sp) + return m_step_out_plan_sp->ValidatePlan (error); + else if (m_step_through_inline_plan_sp) + return m_step_through_inline_plan_sp->ValidatePlan (error); + else if (m_return_bp_id == LLDB_INVALID_BREAK_ID) + { + error->PutCString("Could not create return address breakpoint."); return false; + } else return true; } @@ -99,8 +146,29 @@ bool ThreadPlanStepOut::PlanExplainsStop () { + // If one of our child plans just finished, then we do explain the stop. + if (m_step_out_plan_sp) + { + if (m_step_out_plan_sp->MischiefManaged()) + { + // If this one is done, then we are all done. + SetPlanComplete(); + return true; + } + else + return false; + } + else if (m_step_through_inline_plan_sp) + { + if (m_step_through_inline_plan_sp->MischiefManaged()) + return true; + else + return false; + } + // We don't explain signals or breakpoints (breakpoints that handle stepping in or // out will be handled by a child plan. + StopInfoSP stop_info_sp = GetPrivateStopReason(); if (stop_info_sp) { @@ -143,13 +211,48 @@ bool ThreadPlanStepOut::ShouldStop (Event *event_ptr) { - if (IsPlanComplete() || m_stack_depth > m_thread.GetStackFrameCount()) - { - SetPlanComplete(); - return true; - } - else - return false; + if (IsPlanComplete()) + { + return true; + } + else if (m_stack_depth > m_thread.GetStackFrameCount()) + { + SetPlanComplete(); + return true; + } + else + { + if (m_step_out_plan_sp) + { + if (m_step_out_plan_sp->MischiefManaged()) + { + // Now step through the inlined stack we are in: + if (QueueInlinedStepPlan(true)) + { + return false; + } + else + { + SetPlanComplete (); + return true; + } + } + else + return m_step_out_plan_sp->ShouldStop(event_ptr); + } + else if (m_step_through_inline_plan_sp) + { + if (m_step_through_inline_plan_sp->MischiefManaged()) + { + SetPlanComplete(); + return true; + } + else + return m_step_through_inline_plan_sp->ShouldStop(event_ptr); + } + else + return false; + } } bool @@ -168,6 +271,9 @@ ThreadPlanStepOut::WillResume (StateType resume_state, bool current_plan) { ThreadPlan::WillResume (resume_state, current_plan); + if (m_step_out_plan_sp || m_step_through_inline_plan_sp) + return true; + if (m_return_bp_id == LLDB_INVALID_BREAK_ID) return false; @@ -183,21 +289,20 @@ bool ThreadPlanStepOut::WillStop () { - Breakpoint *return_bp = m_thread.GetProcess().GetTarget().GetBreakpointByID(m_return_bp_id).get(); - if (return_bp != NULL) - return_bp->SetEnabled (false); + if (m_return_bp_id != LLDB_INVALID_BREAK_ID) + { + Breakpoint *return_bp = m_thread.GetProcess().GetTarget().GetBreakpointByID(m_return_bp_id).get(); + if (return_bp != NULL) + return_bp->SetEnabled (false); + } + return true; } bool ThreadPlanStepOut::MischiefManaged () { - if (m_return_bp_id == LLDB_INVALID_BREAK_ID) - { - // If I couldn't set this breakpoint, then I'm just going to jettison myself. - return true; - } - else if (IsPlanComplete()) + if (IsPlanComplete()) { // Did I reach my breakpoint? If so I'm done. // @@ -208,8 +313,12 @@ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); if (log) log->Printf("Completed step out plan."); - m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_return_bp_id); - m_return_bp_id = LLDB_INVALID_BREAK_ID; + if (m_return_bp_id != LLDB_INVALID_BREAK_ID) + { + m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_return_bp_id); + m_return_bp_id = LLDB_INVALID_BREAK_ID; + } + ThreadPlan::MischiefManaged (); return true; } @@ -219,3 +328,62 @@ } } +bool +ThreadPlanStepOut::QueueInlinedStepPlan (bool queue_now) +{ + // Now figure out the range of this inlined block, and set up a "step through range" + // plan for that. If we've been provided with a context, then use the block in that + // context. + StackFrameSP immediate_return_from_sp (m_thread.GetStackFrameAtIndex (0)); + if (!immediate_return_from_sp) + return false; + + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + if (log) + { + StreamString s; + immediate_return_from_sp->Dump(&s, true, false); + log->Printf("Queuing inlined frame to step past: %s.", s.GetData()); + } + + Block *from_block = immediate_return_from_sp->GetFrameBlock(); + if (from_block) + { + Block *inlined_block = from_block->GetContainingInlinedBlock(); + if (inlined_block) + { + size_t num_ranges = inlined_block->GetNumRanges(); + AddressRange inline_range; + if (inlined_block->GetRangeAtIndex(0, inline_range)) + { + SymbolContext inlined_sc; + inlined_block->CalculateSymbolContext(&inlined_sc); + RunMode run_mode = m_stop_others ? lldb::eOnlyThisThread : lldb::eAllThreads; + ThreadPlanStepOverRange *step_through_inline_plan_ptr = new ThreadPlanStepOverRange(m_thread, + inline_range, + inlined_sc, + run_mode); + step_through_inline_plan_ptr->SetOkayToDiscard(true); + StreamString errors; + if (!step_through_inline_plan_ptr->ValidatePlan(&errors)) + { + //FIXME: Log this failure. + delete step_through_inline_plan_ptr; + return false; + } + + for (size_t i = 1; i < num_ranges; i++) + { + if (inlined_block->GetRangeAtIndex (i, inline_range)) + step_through_inline_plan_ptr->AddRange (inline_range); + } + m_step_through_inline_plan_sp.reset (step_through_inline_plan_ptr); + if (queue_now) + m_thread.QueueThreadPlan (m_step_through_inline_plan_sp, false); + return true; + } + } + } + + return false; +} From scallanan at apple.com Fri Oct 14 20:15:07 2011 From: scallanan at apple.com (Sean Callanan) Date: Sat, 15 Oct 2011 01:15:07 -0000 Subject: [Lldb-commits] [lldb] r142033 - /lldb/trunk/source/Symbol/ClangASTContext.cpp Message-ID: <20111015011507.C2C24312800A@llvm.org> Author: spyffe Date: Fri Oct 14 20:15:07 2011 New Revision: 142033 URL: http://llvm.org/viewvc/llvm-project?rev=142033&view=rev Log: Handled the call operator properly. Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=142033&r1=142032&r2=142033&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Oct 14 20:15:07 2011 @@ -1378,20 +1378,25 @@ } static inline bool -check_op_param (bool unary, bool binary, uint32_t num_params) +check_op_param (uint32_t op_kind, bool unary, bool binary, uint32_t num_params) { + // Special-case call since it can take any number of operands + if(op_kind == OO_Call) + return true; + // The parameter count doens't include "this" if (num_params == 0) return unary; if (num_params == 1) return binary; + else return false; } - +; bool ClangASTContext::CheckOverloadedOperatorKindParameterCount (uint32_t op_kind, uint32_t num_params) { -#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) case OO_##Name: return check_op_param (Unary, Binary, num_params); +#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) case OO_##Name: return check_op_param (op_kind, Unary, Binary, num_params); switch (op_kind) { #include "clang/Basic/OperatorKinds.def" From dawn at burble.org Fri Oct 14 21:58:53 2011 From: dawn at burble.org (dawn at burble.org) Date: Fri, 14 Oct 2011 19:58:53 -0700 Subject: [Lldb-commits] [PATCH] fixes for Linux Message-ID: <20111015025853.GA24361@bloodbath.burble.org> This patch fixes debugging of single threaded apps on Linux. It also adds some asserts and additional logging support. Thanks in advance, -Dawn