[Lldb-commits] [lldb] r162004 - in /lldb/branches/apple/python-GIL: ./ examples/python/ include/lldb/Breakpoint/ source/Breakpoint/ source/Commands/ source/Target/ test/functionalities/completion/ test/functionalities/data-formatter/data-formatter-disabling/ test/functionalities/watchpoint/variable_out_of_scope/ tools/driver/ www/
Johnny Chen
johnny.chen at apple.com
Wed Aug 15 17:36:19 PDT 2012
Author: johnny
Date: Wed Aug 15 19:36:19 2012
New Revision: 162004
URL: http://llvm.org/viewvc/llvm-project?rev=162004&view=rev
Log:
Merge changes from ToT trunk.
Added:
lldb/branches/apple/python-GIL/test/functionalities/watchpoint/variable_out_of_scope/
- copied from r162002, lldb/trunk/test/functionalities/watchpoint/variable_out_of_scope/
lldb/branches/apple/python-GIL/test/functionalities/watchpoint/variable_out_of_scope/Makefile
- copied unchanged from r162002, lldb/trunk/test/functionalities/watchpoint/variable_out_of_scope/Makefile
lldb/branches/apple/python-GIL/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
- copied unchanged from r162002, lldb/trunk/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
lldb/branches/apple/python-GIL/test/functionalities/watchpoint/variable_out_of_scope/main.c
- copied unchanged from r162002, lldb/trunk/test/functionalities/watchpoint/variable_out_of_scope/main.c
Modified:
lldb/branches/apple/python-GIL/ (props changed)
lldb/branches/apple/python-GIL/examples/python/crashlog.py
lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Watchpoint.h
lldb/branches/apple/python-GIL/source/Breakpoint/Watchpoint.cpp
lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp
lldb/branches/apple/python-GIL/source/Commands/CommandObjectType.cpp
lldb/branches/apple/python-GIL/source/Target/StopInfo.cpp
lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py
lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
lldb/branches/apple/python-GIL/tools/driver/Driver.cpp
lldb/branches/apple/python-GIL/tools/driver/Driver.h
lldb/branches/apple/python-GIL/www/build.html
Propchange: lldb/branches/apple/python-GIL/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 15 19:36:19 2012
@@ -1 +1 @@
-/lldb/trunk:156467-161467,161483-161768,161775-161809
+/lldb/trunk:156467-162002
Modified: lldb/branches/apple/python-GIL/examples/python/crashlog.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/examples/python/crashlog.py?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/examples/python/crashlog.py (original)
+++ lldb/branches/apple/python-GIL/examples/python/crashlog.py Wed Aug 15 19:36:19 2012
@@ -219,7 +219,7 @@
# print 'PARSE_MODE_NORMAL'
elif parse_mode == PARSE_MODE_NORMAL:
if line.startswith ('Process:'):
- (self.process_name, pid_with_brackets) = line[8:].strip().split()
+ (self.process_name, pid_with_brackets) = line[8:].strip().split(' [')
self.process_id = pid_with_brackets.strip('[]')
elif line.startswith ('Path:'):
self.process_path = line[5:].strip()
Modified: lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Watchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Watchpoint.h?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Watchpoint.h (original)
+++ lldb/branches/apple/python-GIL/include/lldb/Breakpoint/Watchpoint.h Wed Aug 15 19:36:19 2012
@@ -36,6 +36,9 @@
~Watchpoint ();
+ void
+ IncrementFalseAlarmsAndReviseHitCount();
+
bool
IsEnabled () const;
@@ -162,7 +165,8 @@
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
+ uint32_t m_ignore_count; // Number of times to ignore this watchpoint
+ uint32_t m_false_alarms; // Number of false alarms.
std::string m_decl_str; // Declaration information, if any.
std::string m_watch_spec_str; // Spec for the watchpoint.
std::string m_snapshot_old_str; // Old snapshot for the watchpoint value as by ValueObject::DumpValueObject().
Modified: lldb/branches/apple/python-GIL/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Breakpoint/Watchpoint.cpp?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Breakpoint/Watchpoint.cpp Wed Aug 15 19:36:19 2012
@@ -34,6 +34,7 @@
m_watch_was_read(0),
m_watch_was_written(0),
m_ignore_count(0),
+ m_false_alarms(0),
m_decl_str(),
m_watch_spec_str(),
m_snapshot_old_str(),
@@ -94,6 +95,17 @@
return;
}
+// Strip at most one character from the end of the string.
+static inline std::string
+RStripOnce(const std::string &str, const char c)
+{
+ std::string res = str;
+ size_t len = res.length();
+ if (len && res.at(len - 1) == '\n')
+ res.resize(len - 1);
+ return res;
+}
+
std::string
Watchpoint::GetOldSnapshot() const
{
@@ -103,11 +115,7 @@
void
Watchpoint::SetOldSnapshot (const std::string &str)
{
- size_t len = str.length();
- m_snapshot_old_str = str;
- if (len && str.at(len - 1) == '\n')
- m_snapshot_old_str.resize(len - 1);
- return;
+ m_snapshot_old_str = RStripOnce(str, '\n');
}
std::string
@@ -120,11 +128,7 @@
Watchpoint::SetNewSnapshot (const std::string &str)
{
m_snapshot_old_str = m_snapshot_new_str;
- size_t len = str.length();
- m_snapshot_new_str = str;
- if (len && str.at(len - 1) == '\n')
- m_snapshot_new_str.resize(len - 1);
- return;
+ m_snapshot_new_str = RStripOnce(str, '\n');
}
uint64_t
@@ -183,6 +187,25 @@
m_is_watch_variable = val;
}
+void
+Watchpoint::IncrementFalseAlarmsAndReviseHitCount()
+{
+ ++m_false_alarms;
+ if (m_false_alarms)
+ {
+ if (m_hit_count >= m_false_alarms)
+ {
+ m_hit_count -= m_false_alarms;
+ m_false_alarms = 0;
+ }
+ else
+ {
+ m_false_alarms -= m_hit_count;
+ m_hit_count = 0;
+ }
+ }
+}
+
// RETURNS - true if we should stop at this breakpoint, false if we
// should continue.
Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectTarget.cpp Wed Aug 15 19:36:19 2012
@@ -151,7 +151,7 @@
m_option_group (interpreter),
m_arch_option (),
m_platform_options(true), // Do include the "--platform" option in the platform settings by passing true
- m_core_file (LLDB_OPT_SET_1, false, "core-file", 'c', 0, eArgTypePath, "Fullpath to a core file to use for this target.")
+ m_core_file (LLDB_OPT_SET_1, false, "core", 'c', 0, eArgTypePath, "Fullpath to a core file to use for this target.")
{
CommandArgumentEntry arg;
CommandArgumentData file_arg;
Modified: lldb/branches/apple/python-GIL/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Commands/CommandObjectType.cpp?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Commands/CommandObjectType.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Commands/CommandObjectType.cpp Wed Aug 15 19:36:19 2012
@@ -1956,24 +1956,46 @@
return false;
}
- for (int i = argc - 1; i >= 0; i--)
+ if (argc == 1 && strcmp(command.GetArgumentAtIndex(0),"*") == 0)
{
- const char* typeA = command.GetArgumentAtIndex(i);
- ConstString typeCS(typeA);
-
- if (!typeCS)
+ // we want to make sure to enable "system" last and "default" first
+ DataVisualization::Categories::Enable(ConstString("default"), CategoryMap::First);
+ uint32_t num_categories = DataVisualization::Categories::GetCount();
+ for (uint32_t i = 0; i < num_categories; i++)
{
- result.AppendError("empty category name not allowed");
- result.SetStatus(eReturnStatusFailed);
- return false;
+ lldb::TypeCategoryImplSP category_sp = DataVisualization::Categories::GetCategoryAtIndex(i);
+ if (category_sp)
+ {
+ if ( ::strcmp(category_sp->GetName(), "system") == 0 ||
+ ::strcmp(category_sp->GetName(), "default") == 0 )
+ continue;
+ else
+ DataVisualization::Categories::Enable(category_sp, CategoryMap::Default);
+ }
}
- DataVisualization::Categories::Enable(typeCS);
- lldb::TypeCategoryImplSP cate;
- if (DataVisualization::Categories::GetCategory(typeCS, cate) && cate.get())
+ DataVisualization::Categories::Enable(ConstString("system"), CategoryMap::Last);
+ }
+ else
+ {
+ for (int i = argc - 1; i >= 0; i--)
{
- if (cate->GetCount() == 0)
+ const char* typeA = command.GetArgumentAtIndex(i);
+ ConstString typeCS(typeA);
+
+ if (!typeCS)
+ {
+ result.AppendError("empty category name not allowed");
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
+ DataVisualization::Categories::Enable(typeCS);
+ lldb::TypeCategoryImplSP cate;
+ if (DataVisualization::Categories::GetCategory(typeCS, cate) && cate.get())
{
- result.AppendWarning("empty category enabled (typo?)");
+ if (cate->GetCount() == 0)
+ {
+ result.AppendWarning("empty category enabled (typo?)");
+ }
}
}
}
@@ -3801,7 +3823,7 @@
"Typing:\n"
"type filter add --child a -- child g Foo\n"
"frame variable a_foo\n"
- "will produce an output where only a and b are displayed\n"
+ "will produce an output where only a and g are displayed\n"
"Other children of a_foo (b,c,d,e,f,h and i) are available by asking for them, as in:\n"
"frame variable a_foo.b a_foo.c ... a_foo.i\n"
"\n"
Modified: lldb/branches/apple/python-GIL/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/source/Target/StopInfo.cpp?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/source/Target/StopInfo.cpp (original)
+++ lldb/branches/apple/python-GIL/source/Target/StopInfo.cpp Wed Aug 15 19:36:19 2012
@@ -498,6 +498,7 @@
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame)
{
+ bool snapshot_taken = true;
if (!wp_sp->IsWatchVariable())
{
// We are not watching a variable, just read from the process memory for the watched location.
@@ -535,18 +536,29 @@
wp_sp->SetNewSnapshot(ss.GetString());
}
else
- wp_sp->SetNewSnapshot("snapshot attempt failed.");
+ {
+ // The variable expression has become out of scope?
+ // Let us forget about this stop info.
+ if (log)
+ log->Printf("Snapshot attempt failed. Variable expression has become out of scope?");
+ snapshot_taken = false;
+ m_should_stop = false;
+ wp_sp->IncrementFalseAlarmsAndReviseHitCount();
+ }
- if (log)
+ if (log && snapshot_taken)
log->Printf("Watchpoint snapshot taken: '%s'\n", wp_sp->GetNewSnapshot().c_str());
}
// Now dump the snapshots we have taken.
- Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger();
- StreamSP output_sp = debugger.GetAsyncOutputStream ();
- wp_sp->DumpSnapshots(output_sp.get());
- output_sp->EOL();
- output_sp->Flush();
+ if (snapshot_taken)
+ {
+ Debugger &debugger = exe_ctx.GetTargetRef().GetDebugger();
+ StreamSP output_sp = debugger.GetAsyncOutputStream ();
+ wp_sp->DumpSnapshots(output_sp.get());
+ output_sp->EOL();
+ output_sp->Flush();
+ }
}
if (m_should_stop && wp_sp->GetConditionText() != NULL)
Modified: lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/completion/TestCompletion.py Wed Aug 15 19:36:19 2012
@@ -131,6 +131,10 @@
['Available completions:', 'create', 'delete', 'list',
'modules', 'select', 'stop-hook', 'variable'])
+ def test_target_create_dash_co(self):
+ """Test that 'target create --co' completes to 'target variable --core '."""
+ self.complete_from_to('target create --co', 'target create --core ')
+
def test_target_va(self):
"""Test that 'target va' completes to 'target variable '."""
self.complete_from_to('target va', 'target variable ')
Modified: lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py (original)
+++ lldb/branches/apple/python-GIL/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py Wed Aug 15 19:36:19 2012
@@ -83,7 +83,7 @@
self.expect('type category list', substrs = ['system is not enabled', 'gnu-libstdc++ is not enabled', 'AppKit is not enabled'])
# now enable and check that we are back to normal
- cleanup()
+ self.runCmd("type category enable *")
self.expect('type category list', substrs = ['system is enabled', 'gnu-libstdc++ is enabled', 'AppKit is enabled'])
Modified: lldb/branches/apple/python-GIL/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/driver/Driver.cpp?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/driver/Driver.cpp (original)
+++ lldb/branches/apple/python-GIL/tools/driver/Driver.cpp Wed Aug 15 19:36:19 2012
@@ -84,6 +84,8 @@
"be one of the architectures for which the program was compiled." },
{ LLDB_OPT_SET_3, true , "file" , 'f', required_argument, NULL, eArgTypeFilename,
"Tells the debugger to use the file <filename> as the program to be debugged." },
+ { LLDB_OPT_SET_3, false, "core" , 'c', required_argument, NULL, eArgTypePath,
+ "Tells the debugger to use the fullpath to <path> as the core file." },
{ LLDB_OPT_SET_4, true , "attach-name" , 'n', required_argument, NULL, eArgTypeProcessName,
"Tells the debugger to attach to a process with the given name." },
{ LLDB_OPT_SET_4, true , "wait-for" , 'w', no_argument , NULL, eArgTypeNone,
@@ -379,6 +381,7 @@
Driver::OptionData::OptionData () :
m_args(),
m_script_lang (lldb::eScriptLanguageDefault),
+ m_core_file (),
m_crash_log (),
m_source_command_files (),
m_debug_mode (false),
@@ -587,9 +590,17 @@
break;
case 'c':
- m_option_data.m_crash_log = optarg;
+ {
+ SBFileSpec file(optarg);
+ if (file.Exists())
+ {
+ m_option_data.m_core_file = optarg;
+ }
+ else
+ error.SetErrorStringWithFormat("file specified in --core (-c) option doesn't exist: '%s'", optarg);
+ }
break;
-
+
case 'e':
m_option_data.m_use_external_editor = true;
break;
@@ -691,10 +702,6 @@
::fprintf (out_fh, "%s\n", m_debugger.GetVersionString());
exit = true;
}
- else if (! m_option_data.m_crash_log.empty())
- {
- // Handle crash log stuff here.
- }
else if (m_option_data.m_process_name.empty() && m_option_data.m_process_pid == LLDB_INVALID_PROCESS_ID)
{
// Any arguments that are left over after option parsing are for
@@ -1311,6 +1318,11 @@
}
}
+ // Was there a core file specified?
+ std::string core_file_spec("");
+ if (!m_option_data.m_core_file.empty())
+ core_file_spec.append("--core ").append(m_option_data.m_core_file);
+
const size_t num_args = m_option_data.m_args.size();
if (num_args > 0)
{
@@ -1318,13 +1330,15 @@
if (m_debugger.GetDefaultArchitecture (arch_name, sizeof (arch_name)))
::snprintf (command_string,
sizeof (command_string),
- "target create --arch=%s \"%s\"",
+ "target create --arch=%s %s \"%s\"",
arch_name,
+ core_file_spec.c_str(),
m_option_data.m_args[0].c_str());
else
::snprintf (command_string,
sizeof(command_string),
- "target create \"%s\"",
+ "target create %s \"%s\"",
+ core_file_spec.c_str(),
m_option_data.m_args[0].c_str());
m_debugger.HandleCommand (command_string);
@@ -1343,6 +1357,14 @@
}
}
}
+ else if (!core_file_spec.empty())
+ {
+ ::snprintf (command_string,
+ sizeof(command_string),
+ "target create %s",
+ core_file_spec.c_str());
+ m_debugger.HandleCommand (command_string);;
+ }
// Now that all option parsing is done, we try and parse the .lldbinit
// file in the current working directory
Modified: lldb/branches/apple/python-GIL/tools/driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/tools/driver/Driver.h?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/tools/driver/Driver.h (original)
+++ lldb/branches/apple/python-GIL/tools/driver/Driver.h Wed Aug 15 19:36:19 2012
@@ -103,6 +103,7 @@
std::vector<std::string> m_args;
lldb::ScriptLanguage m_script_lang;
+ std::string m_core_file;
std::string m_crash_log;
std::vector<std::string> m_source_command_files;
bool m_debug_mode;
Modified: lldb/branches/apple/python-GIL/www/build.html
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/apple/python-GIL/www/build.html?rev=162004&r1=162003&r2=162004&view=diff
==============================================================================
--- lldb/branches/apple/python-GIL/www/build.html (original)
+++ lldb/branches/apple/python-GIL/www/build.html Wed Aug 15 19:36:19 2012
@@ -21,6 +21,14 @@
<h1 class ="postheader">Building LLDB on Mac OS X</h1>
<div class="postcontent">
<p>Building on Mac OS X is as easy as downloading the code and building the Xcode project or workspace:</p>
+ </div>
+ <div class="postcontent">
+ <h2>Preliminaries</h2>
+ <ul>
+ <li>XCode 4.3 or newer requires the "Command Line Tools" component (XCode->Preferences->Downloads->Components).</li>
+ <li>Mac OS X Lion or newer requires installing <a href="http://swig.org">Swig</a>.</li>
+ </ul>
+ <h2>Building LLDB</h2>
<ul>
<li><a href="download.html">Download</a> the lldb sources.</li>
<li>Follow the code signing instructions in <b>lldb/docs/code-signing.txt</b></li>
@@ -55,6 +63,10 @@
</ul>
<p>So for example, on a Fedora system one might say:</p>
<code>> yum install swig python-devel libedit-devel</code>
+ <p>If building using GCC instead of Clang, GCC 4.6.2 or newer is recommended.</p>
+ <ul>
+ <li><a href="http://gcc.gnu.org">GCC</a></li>
+ </ul>
<h2 >Building LLDB</h2>
<p>We first need to checkout the source trees into the appropriate locations. Both
Clang and LLDB build as subprojects of LLVM. This means we will be checking out
More information about the lldb-commits
mailing list