From johnny.chen at apple.com Mon Jan 23 13:37:53 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 23 Jan 2012 19:37:53 -0000
Subject: [Lldb-commits] [lldb] r148717 -
/lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
Message-ID: <20120123193753.DFF782A6C12C@llvm.org>
Author: johnny
Date: Mon Jan 23 13:37:53 2012
New Revision: 148717
URL: http://llvm.org/viewvc/llvm-project?rev=148717&view=rev
Log:
Dump the raw bytes and the disassembled instruction before calling self.assertTrue() instead of after,
in case the assert fails for any reason.
Modified:
lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
Modified: lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py?rev=148717&r1=148716&r2=148717&view=diff
==============================================================================
--- lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py (original)
+++ lldb/trunk/test/python_api/disassemble-raw-data/TestDisassembleRawData.py Mon Jan 23 13:37:53 2012
@@ -30,14 +30,14 @@
inst = insts.GetInstructionAtIndex(0)
- self.assertTrue (inst.GetMnemonic(target) == "movq")
- self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp")
-
if self.TraceOn():
print
print "Raw bytes: ", [hex(x) for x in raw_bytes]
print "Disassembled:", inst
+ self.assertTrue (inst.GetMnemonic(target) == "movq")
+ self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp")
+
if __name__ == '__main__':
import atexit
lldb.SBDebugger.Initialize()
From johnny.chen at apple.com Mon Jan 23 13:49:28 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 23 Jan 2012 19:49:28 -0000
Subject: [Lldb-commits] [lldb] r148719 - in /lldb/trunk:
source/Commands/CommandObjectSettings.cpp
source/Commands/CommandObjectSettings.h
test/functionalities/completion/TestCompletion.py
test/settings/TestSettings.py
Message-ID: <20120123194928.9B0082A6C12C@llvm.org>
Author: johnny
Date: Mon Jan 23 13:49:28 2012
New Revision: 148719
URL: http://llvm.org/viewvc/llvm-project?rev=148719&view=rev
Log:
Followup check in for http://llvm.org/viewvc/llvm-project?rev=148491&view=rev,
where we changed the CommandObjectSettingsSet object impl to require raw command string.
Do the same for CommandObjectSettingsAppend/InsertBefore/InsertAfter classes and
add test cases for basic functionalities as well as for variable name completion.
Modified:
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectSettings.h
lldb/trunk/test/functionalities/completion/TestCompletion.py
lldb/trunk/test/settings/TestSettings.py
Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=148719&r1=148718&r2=148719&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Mon Jan 23 13:49:28 2012
@@ -144,12 +144,12 @@
// Split the raw command into var_name and value pair.
std::string var_name_string = var_name;
llvm::StringRef raw_str(raw_command);
- llvm::StringRef value_str = raw_str.split(var_name_string).second;
- StripLeadingSpaces(value_str);
- std::string value_string = value_str.str();
+ llvm::StringRef var_value_str = raw_str.split(var_name).second;
+ StripLeadingSpaces(var_value_str);
+ std::string var_value_string = var_value_str.str();
if (!m_options.m_reset
- && value_string.empty())
+ && var_value_string.empty())
{
result.AppendError ("'settings set' command requires a valid variable value unless using '--reset' option;"
" No value supplied");
@@ -158,7 +158,7 @@
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
- value_string.c_str(),
+ var_value_string.c_str(),
eVarSetOperationAssign,
m_options.m_override,
m_interpreter.GetDebugger().GetInstanceName().AsCString());
@@ -835,11 +835,12 @@
}
bool
-CommandObjectSettingsInsertBefore::Execute (Args& command, CommandReturnObject &result)
+CommandObjectSettingsInsertBefore::ExecuteRawCommandString (const char *raw_command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
- const int argc = command.GetArgumentCount ();
+ Args cmd_args(raw_command);
+ const int argc = cmd_args.GetArgumentCount ();
if (argc < 3)
{
@@ -848,7 +849,7 @@
return false;
}
- const char *var_name = command.GetArgumentAtIndex (0);
+ const char *var_name = cmd_args.GetArgumentAtIndex (0);
std::string var_name_string;
if ((var_name == NULL) || (var_name[0] == '\0'))
{
@@ -858,9 +859,9 @@
}
var_name_string = var_name;
- command.Shift();
+ cmd_args.Shift();
- const char *index_value = command.GetArgumentAtIndex (0);
+ const char *index_value = cmd_args.GetArgumentAtIndex (0);
std::string index_value_string;
if ((index_value == NULL) || (index_value[0] == '\0'))
{
@@ -870,15 +871,15 @@
}
index_value_string = index_value;
- command.Shift();
-
- const char *var_value;
- std::string value_string;
+ cmd_args.Shift();
- command.GetQuotedCommandString (value_string);
- var_value = value_string.c_str();
+ // Split the raw command into var_name, index_value, and value triple.
+ llvm::StringRef raw_str(raw_command);
+ llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second;
+ StripLeadingSpaces(var_value_str);
+ std::string var_value_string = var_value_str.str();
- if ((var_value == NULL) || (var_value[0] == '\0'))
+ if (var_value_string.empty())
{
result.AppendError ("'settings insert-before' command requires a valid variable value;"
" No value supplied");
@@ -887,7 +888,7 @@
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
- var_value,
+ var_value_string.c_str(),
eVarSetOperationInsertBefore,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
@@ -981,11 +982,12 @@
}
bool
-CommandObjectSettingsInsertAfter::Execute (Args& command, CommandReturnObject &result)
+CommandObjectSettingsInsertAfter::ExecuteRawCommandString (const char *raw_command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
- const int argc = command.GetArgumentCount ();
+ Args cmd_args(raw_command);
+ const int argc = cmd_args.GetArgumentCount ();
if (argc < 3)
{
@@ -994,7 +996,7 @@
return false;
}
- const char *var_name = command.GetArgumentAtIndex (0);
+ const char *var_name = cmd_args.GetArgumentAtIndex (0);
std::string var_name_string;
if ((var_name == NULL) || (var_name[0] == '\0'))
{
@@ -1004,9 +1006,9 @@
}
var_name_string = var_name;
- command.Shift();
+ cmd_args.Shift();
- const char *index_value = command.GetArgumentAtIndex (0);
+ const char *index_value = cmd_args.GetArgumentAtIndex (0);
std::string index_value_string;
if ((index_value == NULL) || (index_value[0] == '\0'))
{
@@ -1016,15 +1018,15 @@
}
index_value_string = index_value;
- command.Shift();
-
- const char *var_value;
- std::string value_string;
+ cmd_args.Shift();
- command.GetQuotedCommandString (value_string);
- var_value = value_string.c_str();
+ // Split the raw command into var_name, index_value, and value triple.
+ llvm::StringRef raw_str(raw_command);
+ llvm::StringRef var_value_str = raw_str.split(var_name).second.split(index_value).second;
+ StripLeadingSpaces(var_value_str);
+ std::string var_value_string = var_value_str.str();
- if ((var_value == NULL) || (var_value[0] == '\0'))
+ if (var_value_string.empty())
{
result.AppendError ("'settings insert-after' command requires a valid variable value;"
" No value supplied");
@@ -1033,7 +1035,7 @@
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
- var_value,
+ var_value_string.c_str(),
eVarSetOperationInsertAfter,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString(),
@@ -1117,11 +1119,12 @@
}
bool
-CommandObjectSettingsAppend::Execute (Args& command, CommandReturnObject &result)
+CommandObjectSettingsAppend::ExecuteRawCommandString (const char *raw_command, CommandReturnObject &result)
{
UserSettingsControllerSP usc_sp (Debugger::GetSettingsController ());
- const int argc = command.GetArgumentCount ();
+ Args cmd_args(raw_command);
+ const int argc = cmd_args.GetArgumentCount ();
if (argc < 2)
{
@@ -1130,7 +1133,7 @@
return false;
}
- const char *var_name = command.GetArgumentAtIndex (0);
+ const char *var_name = cmd_args.GetArgumentAtIndex (0);
std::string var_name_string;
if ((var_name == NULL) || (var_name[0] == '\0'))
{
@@ -1140,15 +1143,15 @@
}
var_name_string = var_name;
- command.Shift();
-
- const char *var_value;
- std::string value_string;
+ cmd_args.Shift();
- command.GetQuotedCommandString (value_string);
- var_value = value_string.c_str();
+ // Split the raw command into var_name and value pair.
+ llvm::StringRef raw_str(raw_command);
+ llvm::StringRef var_value_str = raw_str.split(var_name).second;
+ StripLeadingSpaces(var_value_str);
+ std::string var_value_string = var_value_str.str();
- if ((var_value == NULL) || (var_value[0] == '\0'))
+ if (var_value_string.empty())
{
result.AppendError ("'settings append' command requires a valid variable value;"
" No value supplied");
@@ -1157,7 +1160,7 @@
else
{
Error err = usc_sp->SetVariable (var_name_string.c_str(),
- var_value,
+ var_value_string.c_str(),
eVarSetOperationAppend,
true,
m_interpreter.GetDebugger().GetInstanceName().AsCString());
Modified: lldb/trunk/source/Commands/CommandObjectSettings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.h?rev=148719&r1=148718&r2=148719&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.h Mon Jan 23 13:49:28 2012
@@ -253,7 +253,19 @@
virtual bool
Execute (Args& command,
- CommandReturnObject &result);
+ CommandReturnObject &result)
+ { return false; }
+
+ virtual bool
+ WantsRawCommandString() { return true; }
+
+ // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
+ virtual bool
+ WantsCompletion() { return true; }
+
+ virtual bool
+ ExecuteRawCommandString (const char *raw_command,
+ CommandReturnObject &result);
virtual int
HandleArgumentCompletion (Args &input,
@@ -282,7 +294,19 @@
virtual bool
Execute (Args& command,
- CommandReturnObject &result);
+ CommandReturnObject &result)
+ { return false; }
+
+ virtual bool
+ WantsRawCommandString() { return true; }
+
+ // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
+ virtual bool
+ WantsCompletion() { return true; }
+
+ virtual bool
+ ExecuteRawCommandString (const char *raw_command,
+ CommandReturnObject &result);
virtual int
HandleArgumentCompletion (Args &input,
@@ -311,7 +335,19 @@
virtual bool
Execute (Args& command,
- CommandReturnObject &result);
+ CommandReturnObject &result)
+ { return false; }
+
+ virtual bool
+ WantsRawCommandString() { return true; }
+
+ // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
+ virtual bool
+ WantsCompletion() { return true; }
+
+ virtual bool
+ ExecuteRawCommandString (const char *raw_command,
+ CommandReturnObject &result);
virtual int
HandleArgumentCompletion (Args &input,
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148719&r1=148718&r2=148719&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Mon Jan 23 13:49:28 2012
@@ -18,6 +18,18 @@
system(["/bin/sh", "-c", "rm -f child_send.txt"])
system(["/bin/sh", "-c", "rm -f child_read.txt"])
+ def test_settings_append_target_er(self):
+ """Test that 'settings append target.er' completes to 'settings append target.error-path'."""
+ self.complete_from_to('settings append target.er', 'settings append target.error-path')
+
+ def test_settings_insert_after_target_en(self):
+ """Test that 'settings insert-after target.en' completes to 'settings insert-after target.env-vars'."""
+ self.complete_from_to('settings insert-after target.en', 'settings insert-after target.env-vars')
+
+ def test_settings_insert_before_target_en(self):
+ """Test that 'settings insert-before target.en' completes to 'settings insert-before target.env-vars'."""
+ self.complete_from_to('settings insert-before target.en', 'settings insert-before target.env-vars')
+
def test_settings_replace_target_ru(self):
"""Test that 'settings replace target.ru' completes to 'settings replace target.run-args'."""
self.complete_from_to('settings replace target.ru', 'settings replace target.run-args')
Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=148719&r1=148718&r2=148719&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Mon Jan 23 13:49:28 2012
@@ -27,6 +27,39 @@
"environment variables",
"executable's environment"])
+ def test_append_target_env_vars(self):
+ """Test that 'replace target.run-args' works."""
+ # Append the env-vars.
+ self.runCmd('settings append target.env-vars MY_ENV_VAR=YES')
+ # And add hooks to restore the settings during tearDown().
+ self.addTearDownHook(
+ lambda: self.runCmd("settings set -r target.env-vars"))
+
+ # Check it immediately!
+ self.expect('settings show target.env-vars',
+ substrs = ['MY_ENV_VAR=YES'])
+
+ def test_insert_before_and_after_target_run_args(self):
+ """Test that 'insert-before/after target.run-args' works."""
+ # Set the run-args first.
+ self.runCmd('settings set target.run-args a b c')
+ # And add hooks to restore the settings during tearDown().
+ self.addTearDownHook(
+ lambda: self.runCmd("settings set -r target.run-args"))
+
+ # Now insert-before the index-0 element with '__a__'.
+ self.runCmd('settings insert-before target.run-args 0 __a__')
+ # And insert-after the index-1 element with '__A__'.
+ self.runCmd('settings insert-after target.run-args 1 __A__')
+ # Check it immediately!
+ self.expect('settings show target.run-args',
+ substrs = ['target.run-args (array) = ',
+ '[0]: "__a__"',
+ '[1]: "a"',
+ '[2]: "__A__"',
+ '[3]: "b"',
+ '[4]: "c"'])
+
def test_replace_target_run_args(self):
"""Test that 'replace target.run-args' works."""
# Set the run-args and then replace the index-0 element.
From johnny.chen at apple.com Mon Jan 23 17:04:00 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Mon, 23 Jan 2012 23:04:00 -0000
Subject: [Lldb-commits] [lldb] r148743 - in /lldb/trunk:
include/lldb/Breakpoint/StoppointLocation.h
source/Breakpoint/BreakpointLocation.cpp
source/Breakpoint/BreakpointSite.cpp source/Breakpoint/Watchpoint.cpp
Message-ID: <20120123230400.40EB72A6C12C@llvm.org>
Author: johnny
Date: Mon Jan 23 17:03:59 2012
New Revision: 148743
URL: http://llvm.org/viewvc/llvm-project?rev=148743&view=rev
Log:
Tiny refactoring to use member functions instead of directly accessing member fields.
Modified:
lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Breakpoint/BreakpointSite.cpp
lldb/trunk/source/Breakpoint/Watchpoint.cpp
Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=148743&r1=148742&r2=148743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Mon Jan 23 17:03:59 2012
@@ -70,7 +70,10 @@
}
void
- IncrementHitCount ();
+ IncrementHitCount ()
+ {
+ ++m_hit_count;
+ }
uint32_t
GetHardwareIndex () const
Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=148743&r1=148742&r2=148743&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Mon Jan 23 17:03:59 2012
@@ -212,12 +212,12 @@
bool should_stop = true;
LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
- m_hit_count++;
+ IncrementHitCount();
if (!IsEnabled())
return false;
- if (m_hit_count <= GetIgnoreCount())
+ if (GetHitCount() <= GetIgnoreCount())
return false;
// We only run synchronous callbacks in ShouldStop:
Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=148743&r1=148742&r2=148743&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Mon Jan 23 17:03:59 2012
@@ -61,7 +61,7 @@
bool
BreakpointSite::ShouldStop (StoppointCallbackContext *context)
{
- m_hit_count++;
+ IncrementHitCount();
return m_owners.ShouldStop (context);
}
Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=148743&r1=148742&r2=148743&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Mon Jan 23 17:03:59 2012
@@ -66,7 +66,8 @@
return;
}
-
+// Override default impl of StoppointLocation::IsHardware() since m_is_hardware
+// member field is more accurate.
bool
Watchpoint::IsHardware () const
{
@@ -79,12 +80,12 @@
bool
Watchpoint::ShouldStop (StoppointCallbackContext *context)
{
- ++m_hit_count;
+ IncrementHitCount();
if (!IsEnabled())
return false;
- if (m_hit_count <= GetIgnoreCount())
+ if (GetHitCount() <= GetIgnoreCount())
return false;
return true;
From johnny.chen at apple.com Mon Jan 23 18:11:02 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 24 Jan 2012 00:11:02 -0000
Subject: [Lldb-commits] [lldb] r148756 - in /lldb/trunk:
include/lldb/Breakpoint/StoppointLocation.h
source/Breakpoint/Watchpoint.cpp
Message-ID: <20120124001102.A1C672A6C12C@llvm.org>
Author: johnny
Date: Mon Jan 23 18:11:02 2012
New Revision: 148756
URL: http://llvm.org/viewvc/llvm-project?rev=148756&view=rev
Log:
Minor comment change. Plus use member function instead of directly accessing member field.
Modified:
lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h
lldb/trunk/source/Breakpoint/Watchpoint.cpp
Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=148756&r1=148755&r2=148756&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Mon Jan 23 18:11:02 2012
@@ -123,7 +123,7 @@
//------------------------------------------------------------------
// Classes that inherit from StoppointLocation can see and modify these
//------------------------------------------------------------------
- lldb::break_id_t m_loc_id; // Break ID
+ lldb::break_id_t m_loc_id; // Stoppoint location ID
lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't
// store a full Address since that's not needed for the breakpoint sites.
bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources)
@@ -131,7 +131,7 @@
uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for
// software breakpoints, or the optional length in bytes for
// hardware breakpoints, or the length of the watchpoint.
- uint32_t m_hit_count; // Number of times this breakpoint has been hit
+ uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit
private:
//------------------------------------------------------------------
Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=148756&r1=148755&r2=148756&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Mon Jan 23 18:11:02 2012
@@ -115,7 +115,7 @@
s->Printf("Watchpoint %u: addr = 0x%8.8llx size = %u state = %s type = %s%s",
GetID(),
- (uint64_t)m_addr,
+ GetLoadAddress(),
m_byte_size,
m_enabled ? "enabled" : "disabled",
m_watch_read ? "r" : "",
From johnny.chen at apple.com Mon Jan 23 19:53:02 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 24 Jan 2012 01:53:02 -0000
Subject: [Lldb-commits] [lldb] r148766 - /lldb/trunk/test/redo.py
Message-ID: <20120124015302.A7D8E2A6C12C@llvm.org>
Author: johnny
Date: Mon Jan 23 19:53:02 2012
New Revision: 148766
URL: http://llvm.org/viewvc/llvm-project?rev=148766&view=rev
Log:
Modify redo.py script so that if sessin_dir is left unspecified, it uses the heuristic
to find the possible session directories with names starting with %Y-%m-%d- (for example,
2012-01-23-) and employs the one with the latest timestamp. For example:
johnny:/Volumes/data/lldb/svn/latest/test $ ./redo.py
Using session dir path: /Volumes/data/lldb/svn/latest/test/2012-01-23-11_28_30
adding filterspec: DisassembleRawDataTestCase.test_disassemble_raw_data
Running ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data
LLDB build dir: /Volumes/data/lldb/svn/latest/build/Debug
LLDB-108
Path: /Volumes/data/lldb/svn/latest
URL: https://johnny at llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny at llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 148710
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 148650
Last Changed Date: 2012-01-21 18:55:08 -0800 (Sat, 21 Jan 2012)
Session logs for test failures/errors/unexpected successes will go into directory '2012-01-23-17_04_48'
Command invoked: python ./dotest.py -C clang -v -t -f DisassembleRawDataTestCase.test_disassemble_raw_data
Configuration: compiler=clang
----------------------------------------------------------------------
Collected 1 test
Change dir to: /Volumes/data/lldb/svn/latest/test/python_api/disassemble-raw-data
1: test_disassemble_raw_data (TestDisassembleRawData.DisassembleRawDataTestCase)
Test disassembling raw bytes with the API. ...
Raw bytes: ['0x48', '0x89', '0xe5']
Disassembled: movq %rsp, %rbp
ok
Restore dir to: /Volumes/data/lldb/svn/latest/test
----------------------------------------------------------------------
Ran 1 test in 0.233s
OK
Modified:
lldb/trunk/test/redo.py
Modified: lldb/trunk/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/redo.py?rev=148766&r1=148765&r2=148766&view=diff
==============================================================================
--- lldb/trunk/test/redo.py (original)
+++ lldb/trunk/test/redo.py Mon Jan 23 19:53:02 2012
@@ -15,7 +15,7 @@
for help.
"""
-import os, sys
+import os, sys, datetime
import re
# If True, redo with no '-t' option for the test driver.
@@ -36,13 +36,17 @@
def usage():
print"""\
-Usage: redo.py [-n] session_dir
+Usage: redo.py [-n] [session_dir]
where options:
-n : when running the tests, do not turn on trace mode, i.e, no '-t' option
is passed to the test driver (this will run the tests faster)
and session_dir specifies the session directory which contains previously
-recorded session infos for all the test cases which either failed or errored."""
+recorded session infos for all the test cases which either failed or errored.
+
+If sessin_dir is left unspecified, this script uses the heuristic to find the
+possible session directories with names starting with %Y-%m-%d- (for example,
+2012-01-23-) and employs the one with the latest timestamp."""
sys.exit(0)
def where(session_dir, test_dir):
@@ -97,7 +101,12 @@
global no_trace
global redo_specs
- if len(sys.argv) < 2 or len(sys.argv) > 3:
+ test_dir = sys.path[0]
+ if not test_dir.endswith('test'):
+ print "This script expects to reside in lldb's test directory."
+ sys.exit(-1)
+
+ if len(sys.argv) > 3:
usage()
index = 1
@@ -116,20 +125,29 @@
no_trace = True
index += 1
- session_dir = sys.argv[index]
-
- test_dir = sys.path[0]
- if not test_dir.endswith('test'):
- print "This script expects to reside in lldb's test directory."
- sys.exit(-1)
+ if index < len(sys.argv):
+ # Get the specified session directory.
+ session_dir = sys.argv[index]
+ else:
+ # Use heuristic to find the latest session directory.
+ name = datetime.datetime.now().strftime("%Y-%m-%d-")
+ dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)]
+ session_dir = max(dirs, key=os.path.getmtime)
+ if not session_dir or not os.path.exists(session_dir):
+ print "No default session directory found, please specify it explicitly."
+ usage()
#print "The test directory:", test_dir
session_dir_path = where(session_dir, test_dir)
- #print "Session dir path:", session_dir_path
+ print "Using session dir path:", session_dir_path
os.chdir(test_dir)
os.path.walk(session_dir_path, redo, ".log")
+ if not redo_specs:
+ print "No failures/errors recorded within the session directory, please specify a different session directory."
+ usage()
+
filters = " -f ".join(redo_specs)
compilers = (" -C %s" % "^".join(comp_specs)) if comp_specs else None
archs = (" -A %s" % "^".join(arch_specs)) if arch_specs else None
From jingham at apple.com Mon Jan 23 20:40:43 2012
From: jingham at apple.com (Jim Ingham)
Date: Tue, 24 Jan 2012 02:40:43 -0000
Subject: [Lldb-commits] [lldb] r148768 - in /lldb/trunk:
examples/python/cmdtemplate.py www/python-faq.html
Message-ID: <20120124024043.53A1F2A6C12C@llvm.org>
Author: jingham
Date: Mon Jan 23 20:40:42 2012
New Revision: 148768
URL: http://llvm.org/viewvc/llvm-project?rev=148768&view=rev
Log:
Proof-reading the python docs.
Modified:
lldb/trunk/examples/python/cmdtemplate.py
lldb/trunk/www/python-faq.html
Modified: lldb/trunk/examples/python/cmdtemplate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/cmdtemplate.py?rev=148768&r1=148767&r2=148768&view=diff
==============================================================================
--- lldb/trunk/examples/python/cmdtemplate.py (original)
+++ lldb/trunk/examples/python/cmdtemplate.py Mon Jan 23 20:40:42 2012
@@ -33,17 +33,18 @@
for arg in args:
if options.verbose:
- print commands.getoutput('/bin/ls "%s"' % arg)
+ result.PutCString(commands.getoutput('/bin/ls "%s"' % arg))
else:
- print commands.getoutput('/bin/ls -lAF "%s"' % arg)
+ result.PutCString(commands.getoutput('/bin/ls -lAF "%s"' % arg))
if __name__ == '__main__':
# This script is being run from the command line, create a debugger in case we are
# going to use any debugger functions in our function.
lldb.debugger = lldb.SBDebugger.Create()
ls (sys.argv)
-elif lldb.debugger:
- # This script is being run from LLDB in the emabedded command interpreter
+
+def __lldb_init_module (debugger, dict):
+ # This initializer is being run from LLDB in the embedded command interpreter
# Add any commands contained in this module to LLDB
- lldb.debugger.HandleCommand('command script add -f cmdtemplate.ls ls')
+ debugger.HandleCommand('command script add -f cmdtemplate.ls ls')
print '"ls" command installed, type "ls --help" for detailed help'
Modified: lldb/trunk/www/python-faq.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-faq.html?rev=148768&r1=148767&r2=148768&view=diff
==============================================================================
--- lldb/trunk/www/python-faq.html (original)
+++ lldb/trunk/www/python-faq.html Mon Jan 23 20:40:42 2012
@@ -19,8 +19,13 @@
-
The embedded python interpreter can be accessed in a variety of way from within LLDB. The
- easiest way is to type script command prompt:
+
The embedded python interpreter can be accessed in a variety of ways from within LLDB. The
+ easiest way is to use the lldb command script with no arguments at the lldb command prompt:
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> 2+3
@@ -40,9 +45,14 @@
>>>
-
This drops you into the embedded python interpreter. There are a some convenience variables
- that are set for you in the lldb python module that refer to the current program
- and debugger state:
+
This drops you into the embedded python interpreter. When running under the script command,
+ lldb sets some convenience variables that give you quick access to the currently selected entities that characterize
+ the program and debugger state. In each case, if there is no currently selected entity of the appropriate
+ type, the variable's IsValid method will return false.
+
Note also, these variables hold the values
+ of the selected objects on entry to the embedded interpreter. They do not update as you use the LLDB
+ API's to change, for example, the currently selected stack frame or thread.
+ These are all global variables contained in the
lldb python namespace :
Variable
@@ -58,9 +68,10 @@
lldb.SBDebugger
- A module global variable containing the current debugger object.
- The type is a lldb.SBDebugger object and it contains a reference to the debegger
- object that owns the command interpreter and all targets in your debug session.
+ Contains the debugger object whose script command was invoked.
+ The lldb.SBDebugger object owns the command interpreter
+ and all the targets in your debug session. There will always be a
+ Debugger in the embedded interpreter.
@@ -71,10 +82,10 @@
lldb.SBTarget
- A module global variable containing the currently selected target.
- The type is a lldb.SBTarget object and the object will only be valid if there is a current target.
- The target select <target-index> commmand can be used to change the
- currently selected target.
+ Contains the currently selected target - for instance the one made with the
+ file or selected by the target select <target-index> command.
+ The lldb.SBTarget manages one running process, and all the executable
+ and debug files for the process.
@@ -85,9 +96,9 @@
lldb.SBProcess
- A module global variable containing the current process.
- The type is a lldb.SBProcess object and the object will only be
- valid if there is a current target and that target has a process.
+ Contains the process of the currently selected target.
+ The lldb.SBProcess object manages the threads and allows access to
+ memory for the process.
@@ -98,12 +109,12 @@
lldb.SBThread
- A module global variable containing the current thread.
- The type is a lldb.SBThread object and the object will only be valid if
- the process has threads, and if the process has a thread selected.
+ Contains the currently selected thread.
+ The lldb.SBThread object manages the stack frames in that thread.
A thread is always selected in the command interpreter when a target stops.
The thread select <thread-index> commmand can be used to change the
- currently selected thread.
+ currently selected thread. So as long as you have a stopped process, there will be
+ some selected thread.
@@ -114,18 +125,20 @@
lldb.SBFrame
- A module global variable containing the current stack frame.
- The type is a lldb.SBFrame object and the object will only be valid if
- the thread is stopped and has a frame selected.
+ Contains the currently selected stack frame.
+ The lldb.SBFrame object manage the stack locals and the register set for
+ that stack.
A stack frame is always selected in the command interpreter when a target stops.
The frame select <frame-index> commmand can be used to change the
- currently selected thread.
+ currently selected frame. So as long as you have a stopped process, there will
+ be some selected frame.
-
One in the embedded interpreter, these objects can be used. Almost all of the lldb.SB objects
- are able to briefly describe themselves by printing them:
+
Once in the embedded interpreter, these objects can be used. To get started, note that almost
+ all of the lldb Python objects are able to briefly describe themselves when you pass them
+ to the Python print function:
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> print lldb.debugger
@@ -148,13 +161,13 @@
-
A python script can be run when a breakpoint gets hit. Adding python
+
One very powerful use of the lldb Python API is to have a python script run when a breakpoint gets hit. Adding python
scripts to breakpoints provides a way to create complex breakpoint
conditions and also allows for smart logging and data gathering.
-
A python function gets run when a breakpoint, and this function has
- two arguments:
+
When your process hits a breakpoint to which you have attached some python code, the code is executed as the
+ body of a function which takes two arguments:
-def breakpoint_function(frame , bp_loc ):
+def breakpoint_function_wrapper(frame , bp_loc ):
# Your code goes here
@@ -173,7 +186,7 @@
The current stack frame where the breakpoint got hit.
- The type is a lldb.SBFrame object and the object will always be valid.
+ The object will always be valid.
This frame argument might not match the currently selected stack frame found in the lldb module global variable lldb.frame .
@@ -191,25 +204,34 @@
- Now we are ready to create a python function and attach it to a breakpoint. The following example will wllow you to
- create an order file for a shared library. We do this by setting a regular exprsssion breakpoint
- at every function in a shared library. The regular expression we will use is '.' which will match
- any function that has at least any character in the function name.
+
An example will show how simple it is to write some python code and attach it to a breakpoint.
+ The following example will allow you to track the order in which the functions in a given shared library
+ are first executed during one run of your program. This is a simple method to gather an order file which
+ can be used to optimize function placement within a binary for execution locality.
+ We do this by setting a regular expression breakpoint
+ that will match every function in the shared library. The regular expression '.' will match
+ any string that has at least one character in it, so we will use that.
This will result in one lldb.SBBreakpoint object
- that contains many lldb.SBBreakpointLocation objects. As the breakpoint continually gets
- hit, we use the hit count on the main lldb.SBBreakpoint to tell us the breakpoint hit
- number, and we disable the location (not the main breakpoint) on the lldb.SBBreakpointLocation
- object. Then we log some info and continue the process.
+ that contains an lldb.SBBreakpointLocation object for each function. As the breakpoint gets
+ hit, we use a counter to track the order in which the function at this particular breakpoint location got hit.
+ Since our code is passed the location that was hit, we can get the name of the function from the location,
+ disable the location so we won't count this function again; then log some info and continue the process.
+ Note we also have to initialize our counter, which we do with the simple one-line version of the script
+ command.
+
Here is the code:
+
(lldb) breakpoint set --func-regex=. --shlib=libfoo.dylib
Breakpoint created: 1: regex = '.', module = libfoo.dylib, locations = 223
+(lldb) script counter = 0
(lldb) breakpoint command add --script-type python 1
Enter your Python command(s). Type 'DONE' to end.
-> # Get the hit count of the main breakpoint
-> hit_count = bp_loc.GetBreakpoint().GetHitCount()
+> # Increment our counter. Since we are in a function, this must be a global python variable
+> global counter
+> counter += 1
> # Get the name of the function
> name = frame.GetFunctionName()
> # Print the order and the function name
-> print '[%i] %s' % (hit_count, name)
+> print '[%i] %s' % (counter, name)
> # Disable the current breakpoint location so it doesn't get hit again
> bp_loc.SetEnabled(False)
> # How continue the process
@@ -225,13 +247,10 @@
-
Python functions can be used to create new commands that the LLDB command interpreter
- doesn't have. This provides a very flexible and easy way to extend LLDB to meet your
+
Python functions can be used to create new LLDB command interpreter commands, which will work
+ like all the natively defined lldb commands. This provides a very flexible and easy way to extend LLDB to meet your
debugging requirements.
-
A python function that implements a new LDB command has four arguments:
-
- def Symbolicate(debugger, command, result, dict):
- SymbolicateCrashLog (command.split())
+
To write a python function that implements a new LDB command define the function to take four arguments as follows:
def command_function(debugger , command , result , dict ):
# Your code goes here
@@ -277,7 +296,8 @@
A return object where you can indicate the success or failure of your command. You can also
provide information for the command result by printing data into it. You can also just print
- data as you normally would in a python script and the outout will show up.
+ data as you normally would in a python script and the output will show up; this is useful for
+ logging, but the real output for your command should go in the result object.
@@ -293,8 +313,19 @@
+ One other handy convenience when defining lldb command-line commands is the command
+ command script import which will import a module specified by file path - so you
+ don't have to change your PYTHONPATH for temporary scripts. It also has another convenience
+ that if your new script module has a function of the form:
+
+ def __lldb_module_init(debugger , dict ):
+ # Command Initialization code goes here
+
+
+ where debugger and dict are as above, that function will get run when the module is loaded
+ allowing you to add whatever commands you want into the current debugger.
Now we can create a module called ls.py that will implement a function that
- can be used by LLDB's python command code:
+ can be used by LLDB's python command code:
#!/usr/bin/python
@@ -304,18 +335,16 @@
import shlex
def ls(debugger, command, result, dict):
- print commands.getoutput('/bin/ls %s' % command)
+ result.PutCString(commands.getoutput('/bin/ls %s' % command))
-# Any code that isn't in a function in python gets run when the module is loaded
-if lldb.debugger:
- # This script is being run from LLDB in the emabedded command interpreter
- # lets register the 'ls' command with the command interpreter automatically!
- lldb.debugger.HandleCommand('command script add -f ls.ls ls')
+# And the initialization code to add your commands
+def __lldb_module_init(debugger, dict):
+ debugger.HandleCommand('command script add -f ls.ls ls')
print 'The "ls" python command has been installed and is ready for use.'
Now we can load the module into LLDB and use it
% lldb
-(lldb) script import ls
+(lldb) command script import ls
The "ls" python command has been installed and is ready for use.
(lldb) ls -l /tmp/
total 365848
@@ -333,17 +362,23 @@
LLDB has all of its core code build into a shared library which gets
used by the lldb command line application. On Mac OS X this
shared library is a framework: LLDB.framework and on other
- unix variants the program is a shared library lldb.so . The
- LLDB.framework contains the lldb.py module and you will
+ unix variants the program is a shared library: lldb.so . LLDB also
+ provides an lldb.py module that contains the bindings from LLDB into Python.
+ To use the
+ LLDB.framework to create your own stand-alone python programs, you will
need to tell python where to look in order to find this module. This
- is done by setting the PYTHONPATH environment variable contain
- a path to the directory that contains the lldb.py python module:
+ is done by setting the PYTHONPATH environment variable, adding
+ a path to the directory that contains the lldb.py python module. On
+ Mac OS X, this is contained inside the LLDB.framework, so you would do:
For csh and tcsh:
% setenv PYTHONPATH /Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python
For sh and bash:
% export PYTHONPATH=/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python
+ Alternately, you can append the LLDB Python directory to the sys.path list directly in
+ your Python code before importing the lldb module.
+
Now your python scripts are ready to import the lldb module. Below is a
python script that will launch a program from the current working directory
@@ -362,7 +397,8 @@
debugger = lldb.SBDebugger.Create()
# When we step or continue, don't return from the function until the process
-# stops. We do this by setting the async mode to false.
+# stops. Otherwise we would have to handle the process events ourselves which, while doable is
+#a little tricky. We do this by setting the async mode to false.
debugger.SetAsync (False)
# Create a target from a file and arch
From jingham at apple.com Mon Jan 23 20:44:08 2012
From: jingham at apple.com (Jim Ingham)
Date: Tue, 24 Jan 2012 02:44:08 -0000
Subject: [Lldb-commits] [lldb] r148769 - in /lldb/trunk/www: python-faq.html
python-reference.html sidebar.incl
Message-ID: <20120124024408.357012A6C12C@llvm.org>
Author: jingham
Date: Mon Jan 23 20:44:07 2012
New Revision: 148769
URL: http://llvm.org/viewvc/llvm-project?rev=148769&view=rev
Log:
Better name for the python reference.
Added:
lldb/trunk/www/python-reference.html
- copied unchanged from r148768, lldb/trunk/www/python-faq.html
Removed:
lldb/trunk/www/python-faq.html
Modified:
lldb/trunk/www/sidebar.incl
Removed: lldb/trunk/www/python-faq.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-faq.html?rev=148768&view=auto
==============================================================================
--- lldb/trunk/www/python-faq.html (original)
+++ lldb/trunk/www/python-faq.html (removed)
@@ -1,457 +0,0 @@
-
-
-
-
-
-LLDB Python FAQ
-
-
-
-
- LLDB Python FAQ
-
-
-
-
-
-
-
-
-
-
-
The entire LLDB API is available as Python functions through a script bridging interface.
- This means the LLDB API's can be used directly from python either interactively or to build python apps that
- provide debugger features.
-
Additionally, Python can be used as a programmatic interface within the
- lldb command interpreter (we refer to this for brevity as the embedded interpreter). Of course,
- in this context it has full access to the LLDB API - with some additional conveniences we will
- call out in the FAQ.
-
-
-
-
-
-
-
-
-
The embedded python interpreter can be accessed in a variety of ways from within LLDB. The
- easiest way is to use the lldb command script with no arguments at the lldb command prompt:
-
(lldb) script
-Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
->>> 2+3
-5
->>> hex(12345)
-'0x3039'
->>>
-
-
-
This drops you into the embedded python interpreter. When running under the script command,
- lldb sets some convenience variables that give you quick access to the currently selected entities that characterize
- the program and debugger state. In each case, if there is no currently selected entity of the appropriate
- type, the variable's IsValid method will return false.
-
Note also, these variables hold the values
- of the selected objects on entry to the embedded interpreter. They do not update as you use the LLDB
- API's to change, for example, the currently selected stack frame or thread.
- These are all global variables contained in the
lldb python namespace :
-
-
- Variable
- Type
- Description
-
-
-
-
- lldb.debugger
-
-
- lldb.SBDebugger
-
-
- Contains the debugger object whose script command was invoked.
- The lldb.SBDebugger object owns the command interpreter
- and all the targets in your debug session. There will always be a
- Debugger in the embedded interpreter.
-
-
-
-
- lldb.target
-
-
- lldb.SBTarget
-
-
- Contains the currently selected target - for instance the one made with the
- file or selected by the target select <target-index> command.
- The lldb.SBTarget manages one running process, and all the executable
- and debug files for the process.
-
-
-
-
- lldb.process
-
-
- lldb.SBProcess
-
-
- Contains the process of the currently selected target.
- The lldb.SBProcess object manages the threads and allows access to
- memory for the process.
-
-
-
-
- lldb.thread
-
-
- lldb.SBThread
-
-
- Contains the currently selected thread.
- The lldb.SBThread object manages the stack frames in that thread.
- A thread is always selected in the command interpreter when a target stops.
- The thread select <thread-index> commmand can be used to change the
- currently selected thread. So as long as you have a stopped process, there will be
- some selected thread.
-
-
-
-
- lldb.frame
-
-
- lldb.SBFrame
-
-
- Contains the currently selected stack frame.
- The lldb.SBFrame object manage the stack locals and the register set for
- that stack.
- A stack frame is always selected in the command interpreter when a target stops.
- The frame select <frame-index> commmand can be used to change the
- currently selected frame. So as long as you have a stopped process, there will
- be some selected frame.
-
-
-
-
-
Once in the embedded interpreter, these objects can be used. To get started, note that almost
- all of the lldb Python objects are able to briefly describe themselves when you pass them
- to the Python print function:
-(lldb) script
-Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
->>> print lldb.debugger
-Debugger (instance: "debugger_1", id: 1)
->>> print lldb.target
-a.out
->>> print lldb.process
-SBProcess: pid = 59289, state = stopped, threads = 1, executable = a.out
->>> print lldb.thread
-SBThread: tid = 0x1f03
->>> print lldb.frame
-frame #0: 0x0000000100000bb6 a.out main + 54 at main.c:16
-
-
-
-
-
-
-
-
-
-
-
One very powerful use of the lldb Python API is to have a python script run when a breakpoint gets hit. Adding python
- scripts to breakpoints provides a way to create complex breakpoint
- conditions and also allows for smart logging and data gathering.
-
When your process hits a breakpoint to which you have attached some python code, the code is executed as the
- body of a function which takes two arguments:
-
-def breakpoint_function_wrapper(frame , bp_loc ):
- # Your code goes here
-
-
-
- Argument
- Type
- Description
-
-
-
-
- frame
-
-
- lldb.SBFrame
-
-
- The current stack frame where the breakpoint got hit.
- The object will always be valid.
- This frame argument might not match the currently selected stack frame found in the lldb module global variable lldb.frame .
-
-
-
-
- bp_loc
-
-
- lldb.SBBreakpointLocation
-
-
- The breakpoint location that just got hit. Breakpoints are represented by lldb.SBBreakpoint
- objects. These breakpoint objects can have one or more locations. These locations
- are represented by lldb.SBBreakpointLocation objects.
-
-
-
-
An example will show how simple it is to write some python code and attach it to a breakpoint.
- The following example will allow you to track the order in which the functions in a given shared library
- are first executed during one run of your program. This is a simple method to gather an order file which
- can be used to optimize function placement within a binary for execution locality.
-
We do this by setting a regular expression breakpoint
- that will match every function in the shared library. The regular expression '.' will match
- any string that has at least one character in it, so we will use that.
- This will result in one lldb.SBBreakpoint object
- that contains an lldb.SBBreakpointLocation object for each function. As the breakpoint gets
- hit, we use a counter to track the order in which the function at this particular breakpoint location got hit.
- Since our code is passed the location that was hit, we can get the name of the function from the location,
- disable the location so we won't count this function again; then log some info and continue the process.
-
Note we also have to initialize our counter, which we do with the simple one-line version of the script
- command.
-
Here is the code:
-
-(lldb) breakpoint set --func-regex=. --shlib=libfoo.dylib
-Breakpoint created: 1: regex = '.', module = libfoo.dylib, locations = 223
-(lldb) script counter = 0
-(lldb) breakpoint command add --script-type python 1
-Enter your Python command(s). Type 'DONE' to end.
-> # Increment our counter. Since we are in a function, this must be a global python variable
-> global counter
-> counter += 1
-> # Get the name of the function
-> name = frame.GetFunctionName()
-> # Print the order and the function name
-> print '[%i] %s' % (counter, name)
-> # Disable the current breakpoint location so it doesn't get hit again
-> bp_loc.SetEnabled(False)
-> # How continue the process
-> frame.GetThread().GetProcess().Continue()
-> DONE
-
-
The breakpoint command add command above attaches a python script to breakpoint 1.
- To remove the breakpoint command:
-
(lldb) breakpoint command delete 1
-
-
-
-
-
-
-
Python functions can be used to create new LLDB command interpreter commands, which will work
- like all the natively defined lldb commands. This provides a very flexible and easy way to extend LLDB to meet your
- debugging requirements.
-
To write a python function that implements a new LDB command define the function to take four arguments as follows:
-
-
def command_function(debugger , command , result , dict ):
- # Your code goes here
-
-
-
- Argument
- Type
- Description
-
-
-
-
- debugger
-
-
- lldb.SBDebugger
-
-
- The current debugger object.
-
-
-
-
- command
-
-
- python string
-
-
- A python string containing all arguments for your command. If you need to chop up the arguments
- try using the shlex module's shlex.split(command) to properly extract the
- arguments.
-
-
-
-
- result
-
-
- lldb.SBCommandReturnObject
-
-
- A return object where you can indicate the success or failure of your command. You can also
- provide information for the command result by printing data into it. You can also just print
- data as you normally would in a python script and the output will show up; this is useful for
- logging, but the real output for your command should go in the result object.
-
-
-
-
- dict
-
-
- python dict object
-
-
- The dictionary for the current embedded script session which contains all variables
- and functions.
-
-
-
-
One other handy convenience when defining lldb command-line commands is the command
- command script import which will import a module specified by file path - so you
- don't have to change your PYTHONPATH for temporary scripts. It also has another convenience
- that if your new script module has a function of the form:
-
-
def __lldb_module_init(debugger , dict ):
- # Command Initialization code goes here
-
-
-
where debugger and dict are as above, that function will get run when the module is loaded
- allowing you to add whatever commands you want into the current debugger.
-
Now we can create a module called ls.py that will implement a function that
- can be used by LLDB's python command code:
-
-
#!/usr/bin/python
-
-import lldb
-import commands
-import optparse
-import shlex
-
-def ls(debugger, command, result, dict):
- result.PutCString(commands.getoutput('/bin/ls %s' % command))
-
-# And the initialization code to add your commands
-def __lldb_module_init(debugger, dict):
- debugger.HandleCommand('command script add -f ls.ls ls')
- print 'The "ls" python command has been installed and is ready for use.'
-
-
Now we can load the module into LLDB and use it
-
% lldb
-(lldb) command script import ls
-The "ls" python command has been installed and is ready for use.
-(lldb) ls -l /tmp/
-total 365848
--rw-r--r--@ 1 someuser wheel 6148 Jan 19 17:27 .DS_Store
--rw------- 1 someuser wheel 7331 Jan 19 15:37 crash.log
-
-
A template has been created in the source repository that can help you to create
- lldb command quickly:
-
cmdtemplate.py
-
-
-
-
-
-
LLDB has all of its core code build into a shared library which gets
- used by the lldb command line application. On Mac OS X this
- shared library is a framework: LLDB.framework and on other
- unix variants the program is a shared library: lldb.so . LLDB also
- provides an lldb.py module that contains the bindings from LLDB into Python.
- To use the
- LLDB.framework to create your own stand-alone python programs, you will
- need to tell python where to look in order to find this module. This
- is done by setting the PYTHONPATH environment variable, adding
- a path to the directory that contains the lldb.py python module. On
- Mac OS X, this is contained inside the LLDB.framework, so you would do:
-
-
For csh and tcsh:
-
% setenv PYTHONPATH /Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python
-
For sh and bash:
-
% export PYTHONPATH=/Developer/Library/PrivateFrameworks/LLDB.framework/Resources/Python
-
-
Alternately, you can append the LLDB Python directory to the sys.path list directly in
- your Python code before importing the lldb module.
-
-
- Now your python scripts are ready to import the lldb module. Below is a
- python script that will launch a program from the current working directory
- called "a.out", set a breakpoint at "main", and then run and hit the breakpoint,
- and print the process, thread and frame objects if the process stopped:
-
-
-
#!/usr/bin/python
-
-import lldb
-
-# Set the path to the executable to debug
-exe = "./a.out"
-
-# Create a new debugger instance
-debugger = lldb.SBDebugger.Create()
-
-# When we step or continue, don't return from the function until the process
-# stops. Otherwise we would have to handle the process events ourselves which, while doable is
-#a little tricky. We do this by setting the async mode to false.
-debugger.SetAsync (False)
-
-# Create a target from a file and arch
-print "Creating a target for '%s'" % exe
-
-target = debugger.CreateTargetWithFileAndArch (exe, lldb.LLDB_ARCH_DEFAULT)
-
-if target:
- # If the target is valid set a breakpoint at main
- main_bp = target.BreakpointCreateByName ("main", target.GetExecutable().GetFilename());
-
- print main_bp
-
- # Launch the process. Since we specified synchronous mode, we won't return
- # from this function until we hit the breakpoint at main
- process = target.LaunchSimple (None, None, os.getcwd())
-
- # Make sure the launch went ok
- if process:
- # Print some simple process info
- state = process.GetState ()
- print process
- if state == lldb.eStateStopped:
- # Get the first thread
- thread = process.GetThreadAtIndex (0)
- if thread:
- # Print some simple thread info
- print thread
- # Get the first frame
- frame = thread.GetFrameAtIndex (0)
- if frame:
- # Print some simple frame info
- print frame
- function = frame.GetFunction()
- # See if we have debug info (a function)
- if function:
- # We do have a function, print some info for the function
- print function
- # Now get all instructions for this function and print them
- insts = function.GetInstructions(target)
- disassemble_instructions (insts)
- else:
- # See if we have a symbol in the symbol table for where we stopped
- symbol = frame.GetSymbol();
- if symbol:
- # We do have a symbol, print some info for the symbol
- print symbol
-
-
-
-
-
-
-
-
-
Modified: lldb/trunk/www/sidebar.incl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/sidebar.incl?rev=148769&r1=148768&r2=148769&view=diff
==============================================================================
--- lldb/trunk/www/sidebar.incl (original)
+++ lldb/trunk/www/sidebar.incl Mon Jan 23 20:44:07 2012
@@ -20,7 +20,7 @@
FAQ
Frame and Thread Formatting
LLDB and GDB
-
Python FAQ
+
Python Reference
Python Scripting
Tutorial
Variable Formatting
From jingham at apple.com Mon Jan 23 20:44:55 2012
From: jingham at apple.com (Jim Ingham)
Date: Tue, 24 Jan 2012 02:44:55 -0000
Subject: [Lldb-commits] [lldb] r148770 - /lldb/trunk/www/sidebar.incl
Message-ID: <20120124024455.D96382A6C12C@llvm.org>
Author: jingham
Date: Mon Jan 23 20:44:55 2012
New Revision: 148770
URL: http://llvm.org/viewvc/llvm-project?rev=148770&view=rev
Log:
Better name for the Python Scripting.
Modified:
lldb/trunk/www/sidebar.incl
Modified: lldb/trunk/www/sidebar.incl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/sidebar.incl?rev=148770&r1=148769&r2=148770&view=diff
==============================================================================
--- lldb/trunk/www/sidebar.incl (original)
+++ lldb/trunk/www/sidebar.incl Mon Jan 23 20:44:55 2012
@@ -21,7 +21,7 @@
Frame and Thread Formatting
LLDB and GDB
Python Reference
-
Python Scripting
+
Python Example
Tutorial
Variable Formatting
From scallanan at apple.com Tue Jan 24 16:06:48 2012
From: scallanan at apple.com (Sean Callanan)
Date: Tue, 24 Jan 2012 22:06:48 -0000
Subject: [Lldb-commits] [lldb] r148870 - in /lldb/trunk:
include/lldb/Expression/ClangExpressionParser.h
include/lldb/Expression/IRForTarget.h
include/lldb/Expression/IRInterpreter.h
source/Expression/ClangExpressionParser.cpp
source/Expression/IRForTarget.cpp source/Expression/IRInterpreter.cpp
Message-ID: <20120124220648.EAA462A6C12C@llvm.org>
Author: spyffe
Date: Tue Jan 24 16:06:48 2012
New Revision: 148870
URL: http://llvm.org/viewvc/llvm-project?rev=148870&view=rev
Log:
Added a mechanism for the IR interpreter to return
an error along with its boolean result. The
expression parser reports this error if the
interpreter fails and the expression could not be
run in the target.
Modified:
lldb/trunk/include/lldb/Expression/ClangExpressionParser.h
lldb/trunk/include/lldb/Expression/IRForTarget.h
lldb/trunk/include/lldb/Expression/IRInterpreter.h
lldb/trunk/source/Expression/ClangExpressionParser.cpp
lldb/trunk/source/Expression/IRForTarget.cpp
lldb/trunk/source/Expression/IRInterpreter.cpp
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionParser.h?rev=148870&r1=148869&r2=148870&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionParser.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionParser.h Tue Jan 24 16:06:48 2012
@@ -189,7 +189,6 @@
std::auto_ptr
m_selector_table; ///< Selector table for Objective-C methods
std::auto_ptr m_ast_context; ///< The AST context used to hold types and names for the parser
std::auto_ptr m_code_generator; ///< [owned by the Execution Engine] The Clang object that generates IR
- std::auto_ptr m_execution_engine; ///< The LLVM JIT
std::vector m_jitted_functions; ///< A vector of all functions that have been JITted into machine code (just one, if ParseExpression() was called)
};
Modified: lldb/trunk/include/lldb/Expression/IRForTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRForTarget.h?rev=148870&r1=148869&r2=148870&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRForTarget.h (original)
+++ lldb/trunk/include/lldb/Expression/IRForTarget.h Tue Jan 24 16:06:48 2012
@@ -12,6 +12,7 @@
#include "lldb/lldb-public.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/TaggedASTType.h"
#include "llvm/Pass.h"
@@ -115,6 +116,10 @@
/// $__lldb_expr, and that function is passed to the passes one by
/// one.
///
+ /// @param[in] interpreter_error
+ /// An error. If the expression fails to be interpreted, this error
+ /// is set to a reason why.
+ ///
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
@@ -146,10 +151,10 @@
///
/// Returns true if it did; false otherwise.
//------------------------------------------------------------------
- bool
- interpretSuccess ()
+ lldb_private::Error &
+ getInterpreterError ()
{
- return m_interpret_success;
+ return m_interpreter_error;
}
private:
@@ -632,6 +637,7 @@
llvm::Constant *m_sel_registerName; ///< The address of the function sel_registerName, cast to the appropriate function pointer type
lldb::ClangExpressionVariableSP &m_const_result; ///< This value should be set to the return value of the expression if it is constant and the expression has no side effects
lldb_private::Stream *m_error_stream; ///< If non-NULL, the stream on which errors should be printed
+ lldb_private::Error m_interpreter_error; ///< The error result from the IR interpreter
bool m_has_side_effects; ///< True if the function's result cannot be simply determined statically
llvm::StoreInst *m_result_store; ///< If non-NULL, the store instruction that writes to the result variable. If m_has_side_effects is true, this is NULL.
Modified: lldb/trunk/include/lldb/Expression/IRInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/IRInterpreter.h?rev=148870&r1=148869&r2=148870&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/IRInterpreter.h (original)
+++ lldb/trunk/include/lldb/Expression/IRInterpreter.h Tue Jan 24 16:06:48 2012
@@ -79,6 +79,9 @@
/// @param[in] llvm_module
/// The module containing the function.
///
+ /// @param[in] error
+ /// If the expression fails to interpret, a reason why.
+ ///
/// @return
/// True on success; false otherwise
//------------------------------------------------------------------
@@ -87,21 +90,24 @@
const lldb_private::ConstString &result_name,
lldb_private::TypeFromParser result_type,
llvm::Function &llvm_function,
- llvm::Module &llvm_module);
+ llvm::Module &llvm_module,
+ lldb_private::Error &err);
private:
/// Flags
lldb_private::ClangExpressionDeclMap &m_decl_map; ///< The DeclMap containing the Decls
lldb_private::Stream *m_error_stream;
bool
- supportsFunction (llvm::Function &llvm_function);
+ supportsFunction (llvm::Function &llvm_function,
+ lldb_private::Error &err);
bool
runOnFunction (lldb::ClangExpressionVariableSP &result,
const lldb_private::ConstString &result_name,
lldb_private::TypeFromParser result_type,
llvm::Function &llvm_function,
- llvm::Module &llvm_module);
+ llvm::Module &llvm_module,
+ lldb_private::Error &err);
};
#endif
Modified: lldb/trunk/source/Expression/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionParser.cpp?rev=148870&r1=148869&r2=148870&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionParser.cpp Tue Jan 24 16:06:48 2012
@@ -187,7 +187,6 @@
m_expr (expr),
m_compiler (),
m_code_generator (NULL),
- m_execution_engine (),
m_jitted_functions ()
{
// Initialize targets first, so that --version shows registered targets.
@@ -447,6 +446,8 @@
func_end = LLDB_INVALID_ADDRESS;
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+ std::auto_ptr execution_engine;
+
Error err;
llvm::Module *module = m_code_generator->ReleaseModule();
@@ -498,7 +499,9 @@
return err;
}
- if (execution_policy != eExecutionPolicyAlways && ir_for_target.interpretSuccess())
+ Error &interpreter_error(ir_for_target.getInterpreterError());
+
+ if (execution_policy != eExecutionPolicyAlways && interpreter_error.Success())
{
if (const_result)
const_result->TransferAddress();
@@ -512,7 +515,10 @@
if (!process || execution_policy == eExecutionPolicyNever)
{
err.SetErrorToGenericError();
- err.SetErrorString("Execution needed to run in the target, but the target can't be run");
+ if (execution_policy == eExecutionPolicyAlways)
+ err.SetErrorString("Execution needed to run in the target, but the target can't be run");
+ else
+ err.SetErrorStringWithFormat("Interpreting the expression locally failed: %s", interpreter_error.AsCString());
return err;
}
@@ -571,15 +577,6 @@
log->Printf ("Module being sent to JIT: \n%s", s.c_str());
}
-#if defined (USE_STANDARD_JIT)
- m_execution_engine.reset(llvm::ExecutionEngine::createJIT (module,
- &error_string,
- jit_memory_manager,
- CodeGenOpt::Less,
- true,
- Reloc::Default,
- CodeModel::Small));
-#else
EngineBuilder builder(module);
builder.setEngineKind(EngineKind::JIT)
.setErrorStr(&error_string)
@@ -589,24 +586,23 @@
.setAllocateGVsWithCode(true)
.setCodeModel(CodeModel::Small)
.setUseMCJIT(true);
- m_execution_engine.reset(builder.create());
-#endif
+ execution_engine.reset(builder.create());
- if (!m_execution_engine.get())
+ if (!execution_engine.get())
{
err.SetErrorToGenericError();
err.SetErrorStringWithFormat("Couldn't JIT the function: %s", error_string.c_str());
return err;
}
- m_execution_engine->DisableLazyCompilation();
+ execution_engine->DisableLazyCompilation();
llvm::Function *function = module->getFunction (function_name.c_str());
// We don't actually need the function pointer here, this just forces it to get resolved.
- void *fun_ptr = m_execution_engine->getPointerToFunction(function);
-
+ void *fun_ptr = execution_engine->getPointerToFunction(function);
+
// Errors usually cause failures in the JIT, but if we're lucky we get here.
if (!function)
@@ -717,6 +713,8 @@
}
}
+ execution_engine.reset();
+
err.Clear();
return err;
}
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=148870&r1=148869&r2=148870&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Jan 24 16:06:48 2012
@@ -2663,11 +2663,10 @@
IRInterpreter interpreter (*m_decl_map,
m_error_stream);
- if (interpreter.maybeRunOnFunction(m_const_result, m_result_name, m_result_type, *function, llvm_module))
- {
- m_interpret_success = true;
+ interpreter.maybeRunOnFunction(m_const_result, m_result_name, m_result_type, *function, llvm_module, m_interpreter_error);
+
+ if (m_interpreter_error.Success())
return true;
- }
}
if (log && log->GetVerbose())
Modified: lldb/trunk/source/Expression/IRInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRInterpreter.cpp?rev=148870&r1=148869&r2=148870&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRInterpreter.cpp (original)
+++ lldb/trunk/source/Expression/IRInterpreter.cpp Tue Jan 24 16:06:48 2012
@@ -851,20 +851,32 @@
const lldb_private::ConstString &result_name,
lldb_private::TypeFromParser result_type,
Function &llvm_function,
- Module &llvm_module)
+ Module &llvm_module,
+ lldb_private::Error &err)
{
- if (supportsFunction (llvm_function))
+ if (supportsFunction (llvm_function, err))
return runOnFunction(result,
result_name,
result_type,
llvm_function,
- llvm_module);
+ llvm_module,
+ err);
else
return false;
}
+static const char *unsupported_opcode_error = "Interpreter doesn't handle one of the expression's opcodes";
+static const char *interpreter_initialization_error = "Interpreter couldn't be initialized";
+static const char *interpreter_internal_error = "Interpreter encountered an internal error";
+static const char *bad_value_error = "Interpreter couldn't resolve a value during execution";
+static const char *memory_allocation_error = "Interpreter couldn't allocate memory";
+static const char *memory_write_error = "Interpreter couldn't write to memory";
+static const char *memory_read_error = "Interpreter couldn't read from memory";
+static const char *infinite_loop_error = "Interpreter ran for too many cycles";
+
bool
-IRInterpreter::supportsFunction (Function &llvm_function)
+IRInterpreter::supportsFunction (Function &llvm_function,
+ lldb_private::Error &err)
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
@@ -882,6 +894,8 @@
{
if (log)
log->Printf("Unsupported instruction: %s", PrintValue(ii).c_str());
+ err.SetErrorToGenericError();
+ err.SetErrorString(unsupported_opcode_error);
return false;
}
case Instruction::Add:
@@ -895,7 +909,11 @@
ICmpInst *icmp_inst = dyn_cast(ii);
if (!icmp_inst)
+ {
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
+ }
switch (icmp_inst->getPredicate())
{
@@ -903,6 +921,9 @@
{
if (log)
log->Printf("Unsupported ICmp predicate: %s", PrintValue(ii).c_str());
+
+ err.SetErrorToGenericError();
+ err.SetErrorString(unsupported_opcode_error);
return false;
}
case CmpInst::ICMP_EQ:
@@ -940,14 +961,19 @@
const lldb_private::ConstString &result_name,
lldb_private::TypeFromParser result_type,
Function &llvm_function,
- Module &llvm_module)
+ Module &llvm_module,
+ lldb_private::Error &err)
{
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
lldb_private::ClangExpressionDeclMap::TargetInfo target_info = m_decl_map.GetTargetInfo();
if (!target_info.IsValid())
+ {
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_initialization_error);
return false;
+ }
lldb::addr_t alloc_min;
lldb::addr_t alloc_max;
@@ -955,7 +981,9 @@
switch (target_info.address_byte_size)
{
default:
- return false;
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_initialization_error);
+ return false;
case 4:
alloc_min = 0x00001000llu;
alloc_max = 0x0000ffffllu;
@@ -968,9 +996,17 @@
TargetData target_data(&llvm_module);
if (target_data.getPointerSize() != target_info.address_byte_size)
+ {
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_initialization_error);
return false;
+ }
if (target_data.isLittleEndian() != (target_info.byte_order == lldb::eByteOrderLittle))
+ {
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_initialization_error);
return false;
+ }
Memory memory(target_data, m_decl_map, alloc_min, alloc_max);
InterpreterStackFrame frame(target_data, memory, m_decl_map);
@@ -1002,8 +1038,9 @@
{
if (log)
log->Printf("getOpcode() returns %s, but instruction is not a BinaryOperator", inst->getOpcodeName());
-
- return false;
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
+ return false;
}
Value *lhs = inst->getOperand(0);
@@ -1016,7 +1053,8 @@
{
if (log)
log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1024,7 +1062,8 @@
{
if (log)
log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1070,7 +1109,8 @@
{
if (log)
log->Printf("getOpcode() returns Alloca, but instruction is not an AllocaInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1078,7 +1118,8 @@
{
if (log)
log->Printf("AllocaInsts are not handled if isArrayAllocation() is true");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(unsupported_opcode_error);
return false;
}
@@ -1096,7 +1137,8 @@
{
if (log)
log->Printf("Couldn't allocate memory for an AllocaInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_allocation_error);
return false;
}
@@ -1106,7 +1148,8 @@
{
if (log)
log->Printf("Couldn't allocate the result pointer for an AllocaInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_allocation_error);
return false;
}
@@ -1115,8 +1158,9 @@
if (P_encoder->PutAddress(0, R.m_base) == UINT32_MAX)
{
if (log)
- log->Printf("Couldn't write the reseult pointer for an AllocaInst");
-
+ log->Printf("Couldn't write the result pointer for an AllocaInst");
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_write_error);
return false;
}
@@ -1138,7 +1182,8 @@
{
if (log)
log->Printf("getOpcode() returns BitCast, but instruction is not a BitCastInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1150,7 +1195,8 @@
{
if (log)
log->Printf("Couldn't evaluate %s", PrintValue(source).c_str());
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1165,7 +1211,8 @@
{
if (log)
log->Printf("getOpcode() returns Br, but instruction is not a BranchInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1179,7 +1226,8 @@
{
if (log)
log->Printf("Couldn't evaluate %s", PrintValue(condition).c_str());
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1213,7 +1261,8 @@
{
if (log)
log->Printf("getOpcode() returns GetElementPtr, but instruction is not a GetElementPtrInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1223,8 +1272,14 @@
lldb_private::Scalar P;
if (!frame.EvaluateValue(P, pointer_operand, llvm_module))
+ {
+ if (log)
+ log->Printf("Couldn't evaluate %s", PrintValue(pointer_operand).c_str());
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
-
+ }
+
SmallVector indices (gep_inst->idx_begin(),
gep_inst->idx_end());
@@ -1250,7 +1305,8 @@
{
if (log)
log->Printf("getOpcode() returns ICmp, but instruction is not an ICmpInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1266,7 +1322,8 @@
{
if (log)
log->Printf("Couldn't evaluate %s", PrintValue(lhs).c_str());
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1274,7 +1331,8 @@
{
if (log)
log->Printf("Couldn't evaluate %s", PrintValue(rhs).c_str());
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1335,7 +1393,8 @@
{
if (log)
log->Printf("getOpcode() returns IntToPtr, but instruction is not an IntToPtrInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1344,7 +1403,13 @@
lldb_private::Scalar I;
if (!frame.EvaluateValue(I, src_operand, llvm_module))
+ {
+ if (log)
+ log->Printf("Couldn't evaluate %s", PrintValue(src_operand).c_str());
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
+ }
frame.AssignValue(inst, I, llvm_module);
@@ -1364,7 +1429,8 @@
{
if (log)
log->Printf("getOpcode() returns Load, but instruction is not a LoadInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1379,7 +1445,13 @@
Type *pointer_ty = pointer_operand->getType();
PointerType *pointer_ptr_ty = dyn_cast(pointer_ty);
if (!pointer_ptr_ty)
+ {
+ if (log)
+ log->Printf("getPointerOperand()->getType() is not a PointerType");
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
+ }
Type *target_ty = pointer_ptr_ty->getElementType();
Memory::Region D = frame.ResolveValue(load_inst, llvm_module);
@@ -1389,7 +1461,8 @@
{
if (log)
log->Printf("LoadInst's value doesn't resolve to anything");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1397,7 +1470,8 @@
{
if (log)
log->Printf("LoadInst's pointer doesn't resolve to anything");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1415,7 +1489,8 @@
{
if (log)
log->Printf("Couldn't read from a region on behalf of a LoadInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_read_error);
return false;
}
}
@@ -1425,7 +1500,8 @@
{
if (log)
log->Printf("Couldn't read from a raw pointer on behalf of a LoadInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_read_error);
return false;
}
}
@@ -1458,7 +1534,8 @@
{
if (log)
log->Printf("getOpcode() returns Store, but instruction is not a StoreInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(interpreter_internal_error);
return false;
}
@@ -1484,7 +1561,8 @@
{
if (log)
log->Printf("StoreInst's value doesn't resolve to anything");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1492,7 +1570,8 @@
{
if (log)
log->Printf("StoreInst's pointer doesn't resolve to anything");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(bad_value_error);
return false;
}
@@ -1513,7 +1592,8 @@
{
if (log)
log->Printf("Couldn't write to a region on behalf of a LoadInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_write_error);
return false;
}
}
@@ -1523,7 +1603,8 @@
{
if (log)
log->Printf("Couldn't write to a raw pointer on behalf of a LoadInst");
-
+ err.SetErrorToGenericError();
+ err.SetErrorString(memory_write_error);
return false;
}
}
@@ -1544,7 +1625,11 @@
}
if (num_insts >= 4096)
+ {
+ err.SetErrorToGenericError();
+ err.SetErrorString(infinite_loop_error);
return false;
-
+ }
+
return false;
}
From johnny.chen at apple.com Tue Jan 24 17:19:26 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Tue, 24 Jan 2012 23:19:26 -0000
Subject: [Lldb-commits] [lldb] r148876 -
/lldb/trunk/source/Target/StopInfo.cpp
Message-ID: <20120124231926.2F5712A6C12C@llvm.org>
Author: johnny
Date: Tue Jan 24 17:19:25 2012
New Revision: 148876
URL: http://llvm.org/viewvc/llvm-project?rev=148876&view=rev
Log:
Fix a typo in the error message of the StopInfoWatchpoint class.
Modified:
lldb/trunk/source/Target/StopInfo.cpp
Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=148876&r1=148875&r2=148876&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Tue Jan 24 17:19:25 2012
@@ -534,7 +534,7 @@
{
Debugger &debugger = context.exe_ctx.GetTargetRef().GetDebugger();
StreamSP error_sp = debugger.GetAsyncErrorStream ();
- error_sp->Printf ("Stopped due to an error evaluating condition of breakpoint ");
+ error_sp->Printf ("Stopped due to an error evaluating condition of watchpoint ");
wp_sp->GetDescription (error_sp.get(), eDescriptionLevelBrief);
error_sp->Printf (": \"%s\"",
wp_sp->GetConditionText());
From johnny.chen at apple.com Tue Jan 24 19:37:36 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 25 Jan 2012 01:37:36 -0000
Subject: [Lldb-commits] [lldb] r148899 -
/lldb/trunk/test/functionalities/completion/TestCompletion.py
Message-ID: <20120125013736.4B1822A6C12C@llvm.org>
Author: johnny
Date: Tue Jan 24 19:37:36 2012
New Revision: 148899
URL: http://llvm.org/viewvc/llvm-project?rev=148899&view=rev
Log:
Add some more test cases for command completion:
o complete an unambiguous option
o complete/list the available option values
o complete/list the candidate command names
Modified:
lldb/trunk/test/functionalities/completion/TestCompletion.py
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148899&r1=148898&r2=148899&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Tue Jan 24 19:37:36 2012
@@ -18,6 +18,18 @@
system(["/bin/sh", "-c", "rm -f child_send.txt"])
system(["/bin/sh", "-c", "rm -f child_read.txt"])
+ def test_frame_variable_dash_w(self):
+ """Test that 'frame variable -w' completes to 'frame variable -w '."""
+ self.complete_from_to('frame variable -w', 'frame variable -w ')
+
+ def test_frame_variable_dash_w_space(self):
+ """Test that 'frame variable -w ' completes to ['Available completions:', 'read', 'write', 'read_write']."""
+ self.complete_from_to('frame variable -w ', ['Available completions:', 'read', 'write', 'read_write'])
+
+ def test_help_fi(self):
+ """Test that 'help fi' completes to ['Available completions:', 'file', 'finish']."""
+ self.complete_from_to('help fi', ['Available completions:', 'file', 'finish'])
+
def test_settings_append_target_er(self):
"""Test that 'settings append target.er' completes to 'settings append target.error-path'."""
self.complete_from_to('settings append target.er', 'settings append target.error-path')
From gclayton at apple.com Tue Jan 24 21:20:34 2012
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 25 Jan 2012 03:20:34 -0000
Subject: [Lldb-commits] [lldb] r148911 -
/lldb/trunk/scripts/disasm-gdb-remote.pl
Message-ID: <20120125032035.063EE2A6C12C@llvm.org>
Author: gclayton
Date: Tue Jan 24 21:20:34 2012
New Revision: 148911
URL: http://llvm.org/viewvc/llvm-project?rev=148911&view=rev
Log:
Handle 's' packets correctly when disassembling GDB packet output.
Modified:
lldb/trunk/scripts/disasm-gdb-remote.pl
Modified: lldb/trunk/scripts/disasm-gdb-remote.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/disasm-gdb-remote.pl?rev=148911&r1=148910&r2=148911&view=diff
==============================================================================
--- lldb/trunk/scripts/disasm-gdb-remote.pl (original)
+++ lldb/trunk/scripts/disasm-gdb-remote.pl Tue Jan 24 21:20:34 2012
@@ -506,7 +506,9 @@
'k' => \&dump_kill_cmd,
'A' => \&dump_A_command,
'c' => \&dump_continue_cmd,
+ 's' => \&dump_continue_cmd,
'C' => \&dump_continue_with_signal_cmd,
+ 'S' => \&dump_continue_with_signal_cmd,
'_M' => \&dump_allocate_memory_cmd,
'_m' => \&dump_deallocate_memory_cmd,
# extended commands
@@ -521,6 +523,7 @@
our %rsp_callbacks =
(
'c' => \&dump_stop_reply_packet,
+ 's' => \&dump_stop_reply_packet,
'C' => \&dump_stop_reply_packet,
'?' => \&dump_stop_reply_packet,
'T' => \&dump_thread_is_alive_rsp,
@@ -1060,30 +1063,37 @@
}
#----------------------------------------------------------------------
-# 'c' command
+# 'c' or 's' command
#----------------------------------------------------------------------
sub dump_continue_cmd
{
my $cmd = shift;
+ my $cmd_str;
+ $cmd eq 'c' and $cmd_str = 'continue';
+ $cmd eq 's' and $cmd_str = 'step';
my $address = -1;
if (@_)
{
my $address = get_addr(\@_);
- printf("continue ($addr_format)\n", $address);
+ printf("%s ($addr_format)\n", $cmd_str, $address);
}
else
{
- printf("continue ()\n");
+ printf("%s ()\n", $cmd_str);
}
}
#----------------------------------------------------------------------
# 'Css' continue (C) with signal (ss where 'ss' is two hex digits)
+# 'Sss' step (S) with signal (ss where 'ss' is two hex digits)
#----------------------------------------------------------------------
sub dump_continue_with_signal_cmd
{
my $cmd = shift;
my $address = -1;
+ my $cmd_str;
+ $cmd eq 'c' and $cmd_str = 'continue';
+ $cmd eq 's' and $cmd_str = 'step';
my $signal = get_hex(\@_);
if (@_)
{
@@ -1097,11 +1107,11 @@
if ($address != -1)
{
- printf("continue_with_signal (signal = 0x%2.2x, address = $addr_format)\n", $signal, $address);
+ printf("%s_with_signal (signal = 0x%2.2x, address = $addr_format)\n", $cmd_str, $signal, $address);
}
else
{
- printf("continue_with_signal (signal = 0x%2.2x)\n", $signal);
+ printf("%s_with_signal (signal = 0x%2.2x)\n", $cmd_str, $signal);
}
}
From johnny.chen at apple.com Wed Jan 25 14:25:39 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 25 Jan 2012 20:25:39 -0000
Subject: [Lldb-commits] [lldb] r148971 -
/lldb/trunk/test/functionalities/completion/TestCompletion.py
Message-ID: <20120125202539.2989D2A6C12C@llvm.org>
Author: johnny
Date: Wed Jan 25 14:25:38 2012
New Revision: 148971
URL: http://llvm.org/viewvc/llvm-project?rev=148971&view=rev
Log:
Cleanup docstring and remove dead code.
Modified:
lldb/trunk/test/functionalities/completion/TestCompletion.py
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148971&r1=148970&r2=148971&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:25:38 2012
@@ -91,11 +91,10 @@
'target.process.thread.trace-thread'])
def complete_from_to(self, str_input, patterns):
- """Test the completion mechanism completes str_input to pattern, where
- patterns could be a pattern-string or a list of pattern-strings"""
+ """Test that the completion mechanism completes str_input to patterns,
+ where patterns could be a pattern-string or a list of pattern-strings"""
+ # The default lldb prompt.
prompt = "(lldb) "
- add_prompt = "Enter your stop hook command(s). Type 'DONE' to end.\r\n> "
- add_prompt1 = "\r\n> "
# So that the child gets torn down after the test.
self.child = pexpect.spawn('%s %s' % (self.lldbHere, self.lldbOption))
From johnny.chen at apple.com Wed Jan 25 14:29:26 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 25 Jan 2012 20:29:26 -0000
Subject: [Lldb-commits] [lldb] r148972 -
/lldb/trunk/test/functionalities/completion/TestCompletion.py
Message-ID: <20120125202926.F14D62A6C12C@llvm.org>
Author: johnny
Date: Wed Jan 25 14:29:26 2012
New Revision: 148972
URL: http://llvm.org/viewvc/llvm-project?rev=148972&view=rev
Log:
Clearify some comment.
Modified:
lldb/trunk/test/functionalities/completion/TestCompletion.py
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148972&r1=148971&r2=148972&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:29:26 2012
@@ -112,7 +112,8 @@
child.sendline('')
child.expect_exact(prompt)
- # Set logfile to None to stop logging.
+ # Now that the necessary logging is done, restore logfile to None to
+ # stop further logging.
child.logfile_send = None
child.logfile_read = None
From johnny.chen at apple.com Wed Jan 25 14:50:22 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 25 Jan 2012 20:50:22 -0000
Subject: [Lldb-commits] [lldb] r148974 -
/lldb/trunk/test/functionalities/completion/TestCompletion.py
Message-ID: <20120125205022.320B72A6C12C@llvm.org>
Author: johnny
Date: Wed Jan 25 14:50:21 2012
New Revision: 148974
URL: http://llvm.org/viewvc/llvm-project?rev=148974&view=rev
Log:
Move argument checking/manipulation into the front of the function.
Modified:
lldb/trunk/test/functionalities/completion/TestCompletion.py
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148974&r1=148973&r2=148974&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:50:21 2012
@@ -93,6 +93,15 @@
def complete_from_to(self, str_input, patterns):
"""Test that the completion mechanism completes str_input to patterns,
where patterns could be a pattern-string or a list of pattern-strings"""
+ # Patterns should not be None in order to proceed.
+ self.assertFalse(patterns is None)
+ # And should be either a string or list of strings. Check for list type
+ # below, if not, make a list out of the singleton string. If patterns
+ # is not a string or not a list of strings, there'll be runtime errors
+ # later on.
+ if not isinstance(patterns, list):
+ patterns = [patterns]
+
# The default lldb prompt.
prompt = "(lldb) "
@@ -127,10 +136,6 @@
print "\n\nContents of child_read.txt:"
print from_child
- self.assertFalse(patterns is None)
- if type(patterns) is not types.ListType:
- patterns = [patterns]
-
# Test that str_input completes to our patterns.
# If each pattern matches from_child, the completion mechanism works!
for p in patterns:
From gclayton at apple.com Wed Jan 25 15:52:15 2012
From: gclayton at apple.com (Greg Clayton)
Date: Wed, 25 Jan 2012 21:52:15 -0000
Subject: [Lldb-commits] [lldb] r148983 -
/lldb/trunk/scripts/disasm-gdb-remote.pl
Message-ID: <20120125215215.661DE2A6C12C@llvm.org>
Author: gclayton
Date: Wed Jan 25 15:52:15 2012
New Revision: 148983
URL: http://llvm.org/viewvc/llvm-project?rev=148983&view=rev
Log:
If timestamps are enabled when logging GDB remote packets ("log enable -T -f /tmp/packets.log gdb-remote logs") then get the amount of time spent executing each packet and summarize at the end of a dump. Sample timing output looks like:
----------------------------------------------------------------------
Packet timing summary:
----------------------------------------------------------------------
Packet Time %
---------------------- -------- ------
qThreadStopInfo 0.363844 35.35
m 0.281967 27.39
s 0.147160 14.30
qfThreadInfo 0.070865 6.88
qsThreadInfo 0.061608 5.99
z 0.036796 3.57
Z 0.036271 3.52
c 0.018410 1.79
H 0.012418 1.21
---------------------- -------- ------
Total 1.029339 100.00
Modified:
lldb/trunk/scripts/disasm-gdb-remote.pl
Modified: lldb/trunk/scripts/disasm-gdb-remote.pl
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/disasm-gdb-remote.pl?rev=148983&r1=148982&r2=148983&view=diff
==============================================================================
--- lldb/trunk/scripts/disasm-gdb-remote.pl (original)
+++ lldb/trunk/scripts/disasm-gdb-remote.pl Wed Jan 25 15:52:15 2012
@@ -25,6 +25,12 @@
our $float64_href = { extract => \&get64, format => "0x%s" };
our $float96_href = { extract => \&get96, format => "0x%s" };
our $curr_cmd = undef;
+our $curr_full_cmd = undef;
+our %packet_times;
+our $curr_time = 0.0;
+our $last_time = 0.0;
+our $base_time = 0.0;
+our $packet_start_time = 0.0;
our $reg_cmd_reg;
our %reg_map = (
'i386-gdb' => [
@@ -1829,8 +1835,22 @@
my $cmd_aref = shift;
my $callback_ref;
$curr_cmd = $$cmd_aref[0];
- $curr_cmd eq '_' and $curr_cmd .= $$cmd_aref[1];
-
+
+ if ($curr_cmd eq 'q' or $curr_cmd eq 'Q' or $curr_cmd eq '_')
+ {
+ $curr_full_cmd = '';
+ foreach my $ch (@$cmd_aref)
+ {
+ $ch !~ /[A-Za-z_]/ and last;
+ $curr_full_cmd .= $ch;
+ }
+ }
+ else
+ {
+ $curr_full_cmd = $curr_cmd;
+ }
+
+ $curr_cmd eq '_' and $curr_cmd .= $$cmd_aref[1];
$callback_ref = $cmd_callbacks{$curr_cmd};
if ($callback_ref)
{
@@ -1874,6 +1894,19 @@
my $cmd_aref = shift;
my $callback_ref;
+ if ($packet_start_time != 0.0)
+ {
+ if (length($curr_full_cmd) > 0)
+ {
+ $packet_times{$curr_full_cmd} += $curr_time - $packet_start_time;
+ }
+ else
+ {
+ $packet_times{$curr_cmd} += $curr_time - $packet_start_time;
+ }
+ $packet_start_time = 0.0;
+ }
+
$callback_ref = $rsp_callbacks{$curr_cmd};
if ($callback_ref)
@@ -1956,16 +1989,41 @@
#----------------------------------------------------------------------
# Process a gdbserver log line by looking for getpkt and putkpt and
# tossing any other lines.
+
#----------------------------------------------------------------------
sub process_log_line
{
my $line = shift;
#($opt_v and $opt_g) and print "# $line";
+
my $extract_cmd = 0;
+ my $delta_time = 0.0;
+ if ($line =~ /^(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$/)
+ {
+ my $leading_space = $1;
+ $curr_time = $2;
+ $line = $3;
+ if ($base_time == 0.0)
+ {
+ $base_time = $curr_time;
+ }
+ else
+ {
+ $delta_time = $curr_time - $last_time;
+ }
+ printf ("(%.6f, %+.6f): ", $curr_time - $base_time, $delta_time);
+ $last_time = $curr_time;
+ }
+ else
+ {
+ $curr_time = 0.0
+ }
+
if ($line =~ /getpkt /)
{
$extract_cmd = 1;
print "\n--> ";
+ $packet_start_time = $curr_time;
}
elsif ($line =~ /putpkt /)
{
@@ -1976,6 +2034,7 @@
{
$opt_g and print "maintenance dump-packets command: $1\n";
my @raw_cmd_bytes = split(/ */, $1);
+ $packet_start_time = $curr_time;
print "\n--> ";
dump_raw_command(\@raw_cmd_bytes);
process_log_line($2);
@@ -1995,6 +2054,7 @@
$opt_g and print "command: $1\n";
my @raw_cmd_bytes = split(/ */, $1);
print "--> ";
+ $packet_start_time = $curr_time;
dump_raw_command(\@raw_cmd_bytes);
}
elsif ($1 =~ /\+/)
@@ -2032,6 +2092,7 @@
$opt_g and print "command: $1\n";
my @raw_cmd_bytes = split(/ */, $1);
print "--> ";
+ $packet_start_time = $curr_time;
dump_raw_command(\@raw_cmd_bytes);
}
elsif ($1 =~ /\+/)
@@ -2067,6 +2128,7 @@
$opt_g and print "command: $1\n";
my @raw_cmd_bytes = split(/ */, $1);
print "\n--> ";
+ $packet_start_time = $curr_time;
dump_raw_command(\@raw_cmd_bytes);
process_log_line($2);
}
@@ -2083,6 +2145,7 @@
{
my $beg = index($line, '("') + 2;
my $end = rindex($line, '");');
+ $packet_start_time = $curr_time;
dump_command(substr($line, $beg, $end - $beg));
}
}
@@ -2096,6 +2159,38 @@
process_log_line($_);
}
+if (%packet_times)
+{
+ print "----------------------------------------------------------------------\n";
+ print "Packet timing summary:\n";
+ print "----------------------------------------------------------------------\n";
+ print "Packet Time %\n";
+ print "---------------------- -------- ------\n";
+ my @packet_names = keys %packet_times;
+ my $total_packet_times = 0.0;
+ foreach my $key (@packet_names)
+ {
+ $total_packet_times += $packet_times{$key};
+ }
+
+ foreach my $value (sort {$packet_times{$b} cmp $packet_times{$a}} @packet_names)
+ {
+ my $percent = ($packet_times{$value} / $total_packet_times) * 100.0;
+ if ($percent < 10.0)
+ {
+ printf("%22s %1.6f %2.2f\n", $value, $packet_times{$value}, $percent);
+
+ }
+ else
+ {
+ printf("%22s %1.6f %2.2f\n", $value, $packet_times{$value}, $percent);
+ }
+ }
+ print "---------------------- -------- ------\n";
+ printf (" Total %1.6f 100.00\n", $total_packet_times);
+}
+
+
From johnny.chen at apple.com Wed Jan 25 17:08:23 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Wed, 25 Jan 2012 23:08:23 -0000
Subject: [Lldb-commits] [lldb] r148994 -
/lldb/trunk/source/Breakpoint/Breakpoint.cpp
Message-ID: <20120125230823.97A5E2A6C12C@llvm.org>
Author: johnny
Date: Wed Jan 25 17:08:23 2012
New Revision: 148994
URL: http://llvm.org/viewvc/llvm-project?rev=148994&view=rev
Log:
Typo.
Modified:
lldb/trunk/source/Breakpoint/Breakpoint.cpp
Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=148994&r1=148993&r2=148994&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Wed Jan 25 17:08:23 2012
@@ -126,7 +126,7 @@
// For each of the overall options we need to decide how they propagate to
// the location options. This will determine the precedence of options on
-// the breakpoint vrs. its locations.
+// the breakpoint vs. its locations.
// Disable at the breakpoint level should override the location settings.
// That way you can conveniently turn off a whole breakpoint without messing
From johnny.chen at apple.com Wed Jan 25 18:08:14 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Thu, 26 Jan 2012 00:08:14 -0000
Subject: [Lldb-commits] [lldb] r149002 -
/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
Message-ID: <20120126000814.42C4C2A6C12C@llvm.org>
Author: johnny
Date: Wed Jan 25 18:08:14 2012
New Revision: 149002
URL: http://llvm.org/viewvc/llvm-project?rev=149002&view=rev
Log:
For Dump(Stream *s), use GetOptionsNoCreate()->GetIgnoreCount() and fix the indentation.
Modified:
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=149002&r1=149001&r2=149002&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Wed Jan 25 18:08:14 2012
@@ -414,12 +414,12 @@
s->Printf("BreakpointLocation %u: tid = %4.4llx load addr = 0x%8.8llx state = %s type = %s breakpoint "
"hw_index = %i hit_count = %-4u ignore_count = %-4u",
- GetID(),
- GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),
- (uint64_t) m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()),
- (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled",
- IsHardware() ? "hardware" : "software",
- GetHardwareIndex(),
- GetHitCount(),
- m_options_ap.get() ? m_options_ap->GetIgnoreCount() : m_owner.GetIgnoreCount());
+ GetID(),
+ GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),
+ (uint64_t) m_address.GetOpcodeLoadAddress (&m_owner.GetTarget()),
+ (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled",
+ IsHardware() ? "hardware" : "software",
+ GetHardwareIndex(),
+ GetHitCount(),
+ GetOptionsNoCreate()->GetIgnoreCount());
}
From gclayton at apple.com Wed Jan 25 18:32:22 2012
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 26 Jan 2012 00:32:22 -0000
Subject: [Lldb-commits] [lldb] r149004 -
/lldb/trunk/www/python-reference.html
Message-ID: <20120126003222.BAF802A6C12C@llvm.org>
Author: gclayton
Date: Wed Jan 25 18:32:22 2012
New Revision: 149004
URL: http://llvm.org/viewvc/llvm-project?rev=149004&view=rev
Log:
Fix page title.
Modified:
lldb/trunk/www/python-reference.html
Modified: lldb/trunk/www/python-reference.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-reference.html?rev=149004&r1=149003&r2=149004&view=diff
==============================================================================
--- lldb/trunk/www/python-reference.html (original)
+++ lldb/trunk/www/python-reference.html Wed Jan 25 18:32:22 2012
@@ -3,12 +3,12 @@
-LLDB Python FAQ
+LLDB Python Reference
- LLDB Python FAQ
+ LLDB Python Reference
From gclayton at apple.com Wed Jan 25 20:56:25 2012
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 26 Jan 2012 02:56:25 -0000
Subject: [Lldb-commits] [lldb] r149030 - in /lldb/trunk/examples/python:
cmdtemplate.py gdbremote.py
Message-ID: <20120126025625.1B5442A6C12C@llvm.org>
Author: gclayton
Date: Wed Jan 25 20:56:24 2012
New Revision: 149030
URL: http://llvm.org/viewvc/llvm-project?rev=149030&view=rev
Log:
Added a 'gdbremote' python module that adds two commands: start_gdb_log and end_gdb_log.
When this is imported into your lldb using the "command script import /path/to/gdbremote.py"
these new commands are available within LLDB. 'start_gdb_log' will enable logging with
timestamps for GDB remote packets, and 'stop_gdb_log' will then dump the details and
also a lot of packet timing data. This allows us to accurately track what packets are
taking up the most time when debugging (when using the ProcessGDBRemote debugging plug-in).
Also udpated the comments at the top of the cmdtemplate.py to show how to correctly import
the module from within LLDB.
Added:
lldb/trunk/examples/python/gdbremote.py (with props)
Modified:
lldb/trunk/examples/python/cmdtemplate.py
Modified: lldb/trunk/examples/python/cmdtemplate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/cmdtemplate.py?rev=149030&r1=149029&r2=149030&view=diff
==============================================================================
--- lldb/trunk/examples/python/cmdtemplate.py (original)
+++ lldb/trunk/examples/python/cmdtemplate.py Wed Jan 25 20:56:24 2012
@@ -3,10 +3,10 @@
#----------------------------------------------------------------------
# Be sure to add the python path that points to the LLDB shared library.
#
-# To use this in the embedded python interpreter using "lldb":
-# % cd /path/containing/cmdtemplate.py
-# % lldb
-# (lldb) script import cmdtemplate
+# # To use this in the embedded python interpreter using "lldb" just
+# import it with the full path using the "command script import"
+# command
+# (lldb) command script import /path/to/cmdtemplate.py
#
# For the shells csh, tcsh:
# ( setenv PYTHONPATH /path/to/LLDB.framework/Resources/Python ; ./cmdtemplate.py )
Added: lldb/trunk/examples/python/gdbremote.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=149030&view=auto
==============================================================================
--- lldb/trunk/examples/python/gdbremote.py (added)
+++ lldb/trunk/examples/python/gdbremote.py Wed Jan 25 20:56:24 2012
@@ -0,0 +1,184 @@
+#!/usr/bin/python
+
+#----------------------------------------------------------------------
+# This module will enable GDB remote packet logging when the
+# 'start_gdb_log' command is called with a filename to log to. When the
+# 'stop_gdb_log' command is called, it will disable the logging and
+# print out statistics about how long commands took to execute and also
+# will primnt ou
+# Be sure to add the python path that points to the LLDB shared library.
+#
+# To use this in the embedded python interpreter using "lldb" just
+# import it with the full path using the "command script import"
+# command. This can be done from the LLDB command line:
+# (lldb) command script import /path/to/gdbremote.py
+# Or it can be added to your ~/.lldbinit file so this module is always
+# available.
+#----------------------------------------------------------------------
+
+import commands
+import optparse
+import os
+import shlex
+import re
+import tempfile
+
+log_file = ''
+
+def start_gdb_log(debugger, command, result, dict):
+ '''Start logging GDB remote packets by enabling logging with timestamps and
+ thread safe logging. Follow a call to this function with a call to "stop_gdb_log"
+ in order to dump out the commands.'''
+ global log_file
+ command_args = shlex.split(command)
+ usage = "usage: start_gdb_log [options] [
]"
+ description='''The command enables GDB remote packet logging with timestamps. The packets will be logged to if supplied, or a temporary file will be used. Logging stops when stop_gdb_log is called and the packet times will
+ be aggregated and displayed.'''
+ parser = optparse.OptionParser(description=description, prog='start_gdb_log',usage=usage)
+ parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+ try:
+ (options, args) = parser.parse_args(command_args)
+ except:
+ return
+
+ if log_file:
+ result.PutCString ('error: logging is already in progress with file "%s"', log_file)
+ else:
+ args_len = len(args)
+ if args_len == 0:
+ log_file = tempfile.mktemp()
+ elif len(args) == 1:
+ log_file = args[0]
+
+ if log_file:
+ debugger.HandleCommand('log enable --threadsafe --timestamp --file "%s" gdb-remote packets' % log_file);
+ result.PutCString ("GDB packet logging enable with log file '%s'\nUse the 'stop_gdb_log' command to stop logging and show packet statistics." % log_file)
+ return
+
+ result.PutCString ('error: invalid log file path')
+ result.PutCString (usage)
+
+def stop_gdb_log(debugger, command, result, dict):
+ '''Stop logging GDB remote packets to the file that was specified in a call
+ to "start_gdb_log" and normalize the timestamps to be relative to the first
+ timestamp in the log file. Also print out statistics for how long each
+ command took to allow performance bottlenecks to be determined.'''
+ global log_file
+ # Any commands whose names might be followed by more valid C identifier
+ # characters must be listed here
+ command_args = shlex.split(command)
+ usage = "usage: stop_gdb_log [options]"
+ description='''The command stops a previously enabled GDB remote packet logging command. Packet logging must have been previously enabled with a call to start_gdb_log.'''
+ parser = optparse.OptionParser(description=description, prog='stop_gdb_log',usage=usage)
+ parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='display verbose debug info', default=False)
+ parser.add_option('-q', '--quiet', action='store_true', dest='quiet', help='display verbose debug info', default=False)
+ try:
+ (options, args) = parser.parse_args(command_args)
+ except:
+ return
+
+ if not log_file:
+ result.PutCString ('error: logging must have been previously enabled with a call to "stop_gdb_log"')
+ elif os.path.exists (log_file):
+ if len(args) == 0:
+ debugger.HandleCommand('log disable gdb-remote packets');
+ result.PutCString ("GDB packet logging disabled. Logged packets are in '%s'" % log_file)
+ parse_gdb_log_file (log_file, options)
+ log_file = None
+ else:
+ result.PutCString (usage)
+ else:
+ print 'error: the GDB packet log file "%s" does not exist' % log_file
+
+def parse_gdb_log_file(file, options):
+ '''Parse a GDB log file that was generated by enabling logging with:
+ (lldb) log enable --threadsafe --timestamp --file gdb-remote packets
+ This log file will contain timestamps and this fucntion will then normalize
+ those packets to be relative to the first value timestamp that is found and
+ show delta times between log lines and also keep track of how long it takes
+ for GDB remote commands to make a send/receive round trip. This can be
+ handy when trying to figure out why some operation in the debugger is taking
+ a long time during a preset set of debugger commands.'''
+
+ tricky_commands = [ 'qRegisterInfo' ]
+ timestamp_regex = re.compile('(\s*)([1-9][0-9]+\.[0-9]+)([^0-9].*)$')
+ packet_name_regex = re.compile('([A-Za-z_]+)[^a-z]')
+ base_time = 0.0
+ last_time = 0.0
+ packet_send_time = 0.0
+ packet_name = None
+ packet_total_times = {}
+ file = open(file)
+ lines = file.read().splitlines()
+ for line in lines:
+ match = timestamp_regex.match (line)
+ if match:
+ curr_time = float (match.group(2))
+ delta = 0.0
+ if base_time:
+ delta = curr_time - last_time
+ else:
+ base_time = curr_time
+ idx = line.find('send packet: $')
+ if idx >= 0:
+ packet_send_time = curr_time
+ packet_match = packet_name_regex.match (line[idx+14:])
+ if packet_match:
+ packet_name = packet_match.group(1)
+ for tricky_cmd in tricky_commands:
+ if packet_name.find (tricky_cmd) == 0:
+ packet_name = tricky_cmd
+ elif line.find('read packet: $') >= 0 and packet_name:
+ if packet_name in packet_total_times:
+ packet_total_times[packet_name] += delta
+ else:
+ packet_total_times[packet_name] = delta
+ packet_name = None
+
+ if not options or not options.quiet:
+ print '%s%.6f %+.6f%s' % (match.group(1), curr_time - base_time, delta, match.group(3))
+ last_time = curr_time
+ else:
+ print line
+ if packet_total_times:
+ total_packet_time = 0.0
+ for key, vvv in packet_total_times.items():
+ # print ' key = (%s) "%s"' % (type(key), key)
+ # print 'value = (%s) %s' % (type(vvv), vvv)
+ # if type(vvv) == 'float':
+ total_packet_time += vvv
+ print '#--------------------------------------------'
+ print '# Packet timing summary:'
+ print '#--------------------------------------------'
+ print '# Packet Time (sec) Percent'
+ print '#------------------------- ---------- -------'
+ res = sorted(packet_total_times, key=packet_total_times.__getitem__, reverse=True)
+ if last_time > 0.0:
+ for item in res:
+ packet_total_time = packet_total_times[item]
+ packet_percent = (packet_total_time / total_packet_time)*100.0
+ if packet_percent >= 10.0:
+ print " %24s %.6f %.2f%%" % (item, packet_total_time, packet_percent)
+ else:
+ print " %24s %.6f %.2f%%" % (item, packet_total_time, packet_percent)
+
+
+
+if __name__ == '__main__':
+ import sys
+ # This script is being run from the command line, create a debugger in case we are
+ # going to use any debugger functions in our function.
+ for file in sys.argv:
+ print '#----------------------------------------------------------------------'
+ print "# GDB remote log file: '%s'" % file
+ print '#----------------------------------------------------------------------'
+ parse_gdb_log_file (file, None)
+
+else:
+ import lldb
+ if lldb.debugger:
+ # This initializer is being run from LLDB in the embedded command interpreter
+ # Add any commands contained in this module to LLDB
+ lldb.debugger.HandleCommand('command script add -f gdbremote.start_gdb_log start_gdb_log')
+ lldb.debugger.HandleCommand('command script add -f gdbremote.stop_gdb_log stop_gdb_log')
+ print 'The "start_gdb_log" and "stop_gdb_log" commands are now installed and ready for use, type "start_gdb_log --help" or "stop_gdb_log --help" for more information'
Propchange: lldb/trunk/examples/python/gdbremote.py
------------------------------------------------------------------------------
svn:executable = *
From gclayton at apple.com Wed Jan 25 23:36:07 2012
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 26 Jan 2012 05:36:07 -0000
Subject: [Lldb-commits] [lldb] r149046 -
/lldb/trunk/www/python-reference.html
Message-ID: <20120126053607.D90092A6C12C@llvm.org>
Author: gclayton
Date: Wed Jan 25 23:36:07 2012
New Revision: 149046
URL: http://llvm.org/viewvc/llvm-project?rev=149046&view=rev
Log:
Added some clarifications about when the __lldb_init_module would be called
and showed a work around for when this won't.
Modified:
lldb/trunk/www/python-reference.html
Modified: lldb/trunk/www/python-reference.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/python-reference.html?rev=149046&r1=149045&r2=149046&view=diff
==============================================================================
--- lldb/trunk/www/python-reference.html (original)
+++ lldb/trunk/www/python-reference.html Wed Jan 25 23:36:07 2012
@@ -318,13 +318,34 @@
don't have to change your PYTHONPATH for temporary scripts. It also has another convenience
that if your new script module has a function of the form:
- def __lldb_module_init(debugger , dict ):
- # Command Initialization code goes here
-
+def __lldb_module_init(debugger , dict ):
+ # Command Initialization code goes here
+
where debugger and dict are as above, that function will get run when the module is loaded
- allowing you to add whatever commands you want into the current debugger.
- Now we can create a module called ls.py that will implement a function that
+ allowing you to add whatever commands you want into the current debugger. Note that
+ this function will only be run when using the LLDB comand command script import ,
+ it will not get run if anyone imports your module from another module.
+ If you want to always run code when your module is loaded from LLDB
+ or when loaded via an import statement in python code
+ you can test the lldb.debugger object, since you imported the
+ module at the top of the python ls.py module. This test
+ must be in code that isn't contained inside of any function or class,
+ just like the standard test for __main__ like all python modules
+ usally do. Sample code would look like:
+
+if __name__ == '__main__':
+ # Create a new debugger instance in your module if your module
+ # can be run from the command line. When we run a script from
+ # the command line, we won't have any debugger object in
+ # lldb.debugger, so we can just create it if it will be needed
+ lldb.debugger = lldb.SBDebugger.Create()
+elif lldb.debugger:
+ # Module is being run inside the LLDB interpreter
+ lldb.debugger.HandleCommand('command script add -f ls.ls ls')
+ print 'The "ls" python command has been installed and is ready for use.'
+
+ Now we can create a module called ls.py in the file ~/ls.py that will implement a function that
can be used by LLDB's python command code:
#!/usr/bin/python
@@ -344,7 +365,7 @@
Now we can load the module into LLDB and use it
% lldb
-(lldb) command script import ls
+(lldb) command script import ~/ls.py
The "ls" python command has been installed and is ready for use.
(lldb) ls -l /tmp/
total 365848
From gclayton at apple.com Thu Jan 26 15:08:31 2012
From: gclayton at apple.com (Greg Clayton)
Date: Thu, 26 Jan 2012 21:08:31 -0000
Subject: [Lldb-commits] [lldb] r149080 - in /lldb/trunk:
include/lldb/Core/ValueObject.h source/Commands/CommandObjectExpression.cpp
source/Commands/CommandObjectFrame.cpp
source/Commands/CommandObjectMemory.cpp
source/Commands/CommandObjectTarget.cpp source/Core/ValueObject.cpp
Message-ID: <20120126210831.33D6C2A6C12C@llvm.org>
Author: gclayton
Date: Thu Jan 26 15:08:30 2012
New Revision: 149080
URL: http://llvm.org/viewvc/llvm-project?rev=149080&view=rev
Log:
Fixed formats being able to be applied recursively when using:
target variable -f [args]
frame variable -f [args]
expression -f -- expr
Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/ValueObject.cpp
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=149080&r1=149079&r2=149080&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Jan 26 15:08:30 2012
@@ -216,19 +216,21 @@
bool m_flat_output;
uint32_t m_omit_summary_depth;
bool m_ignore_cap;
+ lldb::Format m_override_format;
DumpValueObjectOptions() :
- m_ptr_depth(0),
- m_max_depth(UINT32_MAX),
- m_show_types(false),
- m_show_location(false),
- m_use_objc(false),
- m_use_dynamic(lldb::eNoDynamicValues),
- m_use_synthetic(lldb::eUseSyntheticFilter),
- m_scope_already_checked(false),
- m_flat_output(false),
- m_omit_summary_depth(0),
- m_ignore_cap(false)
+ m_ptr_depth(0),
+ m_max_depth(UINT32_MAX),
+ m_show_types(false),
+ m_show_location(false),
+ m_use_objc(false),
+ m_use_dynamic(lldb::eNoDynamicValues),
+ m_use_synthetic(lldb::eUseSyntheticFilter),
+ m_scope_already_checked(false),
+ m_flat_output(false),
+ m_omit_summary_depth(0),
+ m_ignore_cap(false),
+ m_override_format (lldb::eFormatDefault)
{}
static const DumpValueObjectOptions
@@ -829,7 +831,8 @@
static void
DumpValueObject (Stream &s,
ValueObject *valobj,
- const DumpValueObjectOptions& options)
+ const DumpValueObjectOptions& options,
+ lldb::Format format = lldb::eFormatDefault)
{
if (!valobj)
@@ -849,14 +852,16 @@
options.m_scope_already_checked,
options.m_flat_output,
options.m_omit_summary_depth,
- options.m_ignore_cap);
+ options.m_ignore_cap,
+ format);
}
static void
DumpValueObject (Stream &s,
ValueObject *valobj,
const char *root_valobj_name,
- const DumpValueObjectOptions& options)
+ const DumpValueObjectOptions& options,
+ lldb::Format format = lldb::eFormatDefault)
{
if (!valobj)
@@ -876,7 +881,8 @@
options.m_scope_already_checked,
options.m_flat_output,
options.m_omit_summary_depth,
- options.m_ignore_cap);
+ options.m_ignore_cap,
+ format);
}
static void
@@ -894,7 +900,8 @@
bool scope_already_checked,
bool flat_output,
uint32_t omit_summary_depth,
- bool ignore_cap);
+ bool ignore_cap,
+ lldb::Format format = lldb::eFormatDefault);
// returns true if this is a char* or a char[]
// if it is a char* and check_pointer is true,
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=149080&r1=149079&r2=149080&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Thu Jan 26 15:08:30 2012
@@ -368,7 +368,8 @@
true, // Scope is already checked. Const results are always in scope.
false, // Don't flatten output
0, // Always use summaries (you might want an option --no-summary like there is for frame variable)
- false); // Do not show more children than settings allow
+ false, // Do not show more children than settings allow
+ format); // Format override
if (result)
result->SetStatus (eReturnStatusSuccessFinishResult);
}
Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=149080&r1=149079&r2=149080&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Thu Jan 26 15:08:30 2012
@@ -476,8 +476,8 @@
valobj_sp = frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
if (valobj_sp)
{
- if (format != eFormatDefault)
- valobj_sp->SetFormat (format);
+// if (format != eFormatDefault)
+// valobj_sp->SetFormat (format);
if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
{
@@ -490,7 +490,8 @@
valobj_sp->SetCustomSummaryFormat(summary_format_sp);
ValueObject::DumpValueObject (result.GetOutputStream(),
valobj_sp.get(),
- options);
+ options,
+ format);
}
}
}
@@ -521,8 +522,8 @@
error);
if (valobj_sp)
{
- if (format != eFormatDefault)
- valobj_sp->SetFormat (format);
+// if (format != eFormatDefault)
+// valobj_sp->SetFormat (format);
if (m_option_variable.show_decl && var_sp && var_sp->GetDeclaration ().GetFile())
{
var_sp->GetDeclaration ().DumpStopContext (&s, false);
@@ -535,7 +536,8 @@
ValueObject::DumpValueObject (output_stream,
valobj_sp.get(),
valobj_sp->GetParent() ? name_cstr : NULL,
- options);
+ options,
+ format);
// Process watchpoint if necessary.
if (m_option_watchpoint.watch_variable)
{
@@ -639,8 +641,8 @@
m_varobj_options.use_dynamic);
if (valobj_sp)
{
- if (format != eFormatDefault)
- valobj_sp->SetFormat (format);
+// if (format != eFormatDefault)
+// valobj_sp->SetFormat (format);
// When dumping all variables, don't print any variables
// that are not in scope to avoid extra unneeded output
@@ -656,7 +658,8 @@
ValueObject::DumpValueObject (result.GetOutputStream(),
valobj_sp.get(),
name_cstr,
- options);
+ options,
+ format);
}
}
}
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=149080&r1=149079&r2=149080&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Thu Jan 26 15:08:30 2012
@@ -705,7 +705,8 @@
scope_already_checked,
m_varobj_options.flat_output,
m_varobj_options.be_raw ? UINT32_MAX : m_varobj_options.no_summary_depth,
- m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap);
+ m_varobj_options.be_raw ? true : m_varobj_options.ignore_cap,
+ format);
}
else
{
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=149080&r1=149079&r2=149080&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Jan 26 15:08:30 2012
@@ -593,7 +593,8 @@
ValueObject::DumpValueObject (s,
valobj_sp.get(),
root_name,
- options);
+ options,
+ format);
}
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=149080&r1=149079&r2=149080&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Thu Jan 26 15:08:30 2012
@@ -2979,7 +2979,8 @@
bool scope_already_checked,
bool flat_output,
uint32_t omit_summary_depth,
- bool ignore_cap
+ bool ignore_cap,
+ Format format_override // Normally the format is in the valobj, but we might want to override this
)
{
if (valobj)
@@ -3064,6 +3065,7 @@
}
}
+ std::string value_str;
const char *val_cstr = NULL;
const char *sum_cstr = NULL;
SummaryFormat* entry = valobj->GetSummaryFormat().get();
@@ -3071,9 +3073,26 @@
if (omit_summary_depth > 0)
entry = NULL;
+ Format orig_format = kNumFormats;
if (err_cstr == NULL)
{
+ if (format_override != eFormatDefault)
+ {
+ orig_format = valobj->GetFormat();
+ valobj->SetFormat (format_override);
+ }
val_cstr = valobj->GetValueAsCString();
+ if (val_cstr)
+ {
+ // Cache the value in our own storage as running summaries might
+ // change our value from underneath us
+ value_str = val_cstr;
+ }
+ if (orig_format != kNumFormats && orig_format != format_override)
+ {
+ valobj->SetFormat (orig_format);
+ orig_format = kNumFormats;
+ }
err_cstr = valobj->GetError().AsCString();
}
@@ -3086,13 +3105,13 @@
const bool is_ref = type_flags.Test (ClangASTContext::eTypeIsReference);
if (print_valobj)
{
-
- sum_cstr = (omit_summary_depth == 0) ? valobj->GetSummaryAsCString() : NULL;
+ if (omit_summary_depth == 0)
+ sum_cstr = valobj->GetSummaryAsCString();
- // We must calculate this value in realtime because entry might alter this variable's value
- // (e.g. by saying ${var%fmt}) and render precached values useless
- if (val_cstr && (!entry || entry->DoesPrintValue() || !sum_cstr))
- s.Printf(" %s", valobj->GetValueAsCString());
+ // Make sure we have a value and make sure the summary didn't
+ // specify that the value should not be printed
+ if (!value_str.empty() && (entry == NULL || entry->DoesPrintValue() || sum_cstr == NULL))
+ s.Printf(" %s", value_str.c_str());
if (sum_cstr)
{
@@ -3199,7 +3218,8 @@
true,
flat_output,
omit_summary_depth > 1 ? omit_summary_depth - 1 : 0,
- ignore_cap);
+ ignore_cap,
+ format_override);
}
}
From gclayton at apple.com Thu Jan 26 18:13:27 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 00:13:27 -0000
Subject: [Lldb-commits] [lldb] r149098 - in /lldb/trunk:
include/lldb/API/SBCommandInterpreter.h
include/lldb/Interpreter/ScriptInterpreter.h
scripts/Python/interface/SBCommandInterpreter.i
source/API/SBCommandInterpreter.cpp
source/Interpreter/ScriptInterpreter.cpp
source/Interpreter/ScriptInterpreterPython.cpp
Message-ID: <20120127001327.D3CA12A6C12C@llvm.org>
Author: gclayton
Date: Thu Jan 26 18:13:27 2012
New Revision: 149098
URL: http://llvm.org/viewvc/llvm-project?rev=149098&view=rev
Log:
Remove a pseudo terminal master open and slave file descriptor that was being
used for pythong stdin. It was not hooked up correctly and was causing file
descriptor leaks.
Modified:
lldb/trunk/include/lldb/API/SBCommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
Modified: lldb/trunk/include/lldb/API/SBCommandInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCommandInterpreter.h?rev=149098&r1=149097&r2=149098&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h Thu Jan 26 18:13:27 2012
@@ -65,12 +65,6 @@
lldb::SBProcess
GetProcess ();
- ssize_t
- WriteToScriptInterpreter (const char *src);
-
- ssize_t
- WriteToScriptInterpreter (const char *src, size_t src_len);
-
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=149098&r1=149097&r2=149098&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Thu Jan 26 18:13:27 2012
@@ -240,18 +240,6 @@
protected:
CommandInterpreter &m_interpreter;
lldb::ScriptLanguage m_script_lang;
-
- // Scripting languages may need to use stdin for their interactive loops;
- // however we don't want them to grab the real system stdin because that
- // resource needs to be shared among the debugger UI, the inferior process and these
- // embedded scripting loops. Therefore we need to set up a pseudoterminal and use that
- // as stdin for the script interpreter interactive loops/prompts.
-
- lldb_utility::PseudoTerminal m_interpreter_pty; // m_session_pty
- std::string m_pty_slave_name; //m_session_pty_slave_name
-
-private:
-
};
} // namespace lldb_private
Modified: lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i?rev=149098&r1=149097&r2=149098&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i (original)
+++ lldb/trunk/scripts/Python/interface/SBCommandInterpreter.i Thu Jan 26 18:13:27 2012
@@ -99,14 +99,6 @@
lldb::SBProcess
GetProcess ();
-#if 0
- ssize_t
- WriteToScriptInterpreter (const char *src);
-#endif
-
- ssize_t
- WriteToScriptInterpreter (const char *src, size_t src_len);
-
void
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=149098&r1=149097&r2=149098&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Thu Jan 26 18:13:27 2012
@@ -208,32 +208,6 @@
return process;
}
-ssize_t
-SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
-{
- return WriteToScriptInterpreter (src, strlen(src));
-}
-
-ssize_t
-SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
-{
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
- ssize_t bytes_written = 0;
- if (m_opaque_ptr && src && src[0])
- {
- ScriptInterpreter *script_interpreter = m_opaque_ptr->GetScriptInterpreter();
- if (script_interpreter)
- bytes_written = ::write (script_interpreter->GetMasterFileDescriptor(), src, src_len);
- }
- if (log)
- log->Printf ("SBCommandInterpreter(%p)::WriteToScriptInterpreter (src=\"%s\", src_len=%zu) => %zi",
- m_opaque_ptr, src, src_len, bytes_written);
-
- return bytes_written;
-}
-
-
CommandInterpreter *
SBCommandInterpreter::get ()
{
Modified: lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreter.cpp?rev=149098&r1=149097&r2=149098&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreter.cpp Thu Jan 26 18:13:27 2012
@@ -25,21 +25,12 @@
ScriptInterpreter::ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang) :
m_interpreter (interpreter),
- m_script_lang (script_lang),
- m_interpreter_pty (),
- m_pty_slave_name ()
+ m_script_lang (script_lang)
{
- if (m_interpreter_pty.OpenFirstAvailableMaster (O_RDWR|O_NOCTTY, NULL, 0))
- {
- const char *slave_name = m_interpreter_pty.GetSlaveName(NULL, 0);
- if (slave_name)
- m_pty_slave_name.assign(slave_name);
- }
}
ScriptInterpreter::~ScriptInterpreter ()
{
- m_interpreter_pty.CloseMasterFileDescriptor();
}
CommandInterpreter &
@@ -48,18 +39,6 @@
return m_interpreter;
}
-const char *
-ScriptInterpreter::GetScriptInterpreterPtyName ()
-{
- return m_pty_slave_name.c_str();
-}
-
-int
-ScriptInterpreter::GetMasterFileDescriptor ()
-{
- return m_interpreter_pty.GetMasterFileDescriptor();
-}
-
void
ScriptInterpreter::CollectDataForBreakpointCommandCallback
(
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=149098&r1=149097&r2=149098&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Thu Jan 26 18:13:27 2012
@@ -187,7 +187,6 @@
m_dictionary_name (interpreter.GetDebugger().GetInstanceName().AsCString()),
m_terminal_state (),
m_session_is_active (false),
- m_pty_slave_is_open (false),
m_valid_session (true)
{
@@ -262,7 +261,6 @@
{
m_embedded_thread_input_reader_sp->SetIsDone (true);
m_embedded_python_pty.CloseSlaveFileDescriptor();
- m_pty_slave_is_open = false;
const InputReaderSP reader_sp = m_embedded_thread_input_reader_sp;
m_embedded_thread_input_reader_sp.reset();
debugger.PopInputReader (reader_sp);
@@ -348,14 +346,14 @@
run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.debugger.GetSelectedTarget()')",
m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.target = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.SBTarget()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
if (exe_ctx.GetProcessPtr())
run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.target.GetProcess()')", m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.process = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.SBProcess()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
@@ -363,7 +361,7 @@
run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.process.GetSelectedThread ()')",
m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.thread = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.SBThread()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
@@ -371,7 +369,7 @@
run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.thread.GetSelectedFrame ()')",
m_dictionary_name.c_str());
else
- run_string.Printf ("run_one_line (%s, 'lldb.frame = None')", m_dictionary_name.c_str());
+ run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.SBFrame()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
@@ -385,19 +383,6 @@
if (PyErr_Occurred())
PyErr_Clear ();
-
- if (!m_pty_slave_is_open)
- {
- run_string.Clear();
- run_string.Printf ("run_one_line (%s, \"new_stdin = open('%s', 'r')\")", m_dictionary_name.c_str(),
- m_pty_slave_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- m_pty_slave_is_open = true;
-
- run_string.Clear();
- run_string.Printf ("run_one_line (%s, 'sys.stdin = new_stdin')", m_dictionary_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- }
}
@@ -1651,8 +1636,6 @@
script_interpreter->m_embedded_python_pty.CloseSlaveFileDescriptor();
- script_interpreter->m_pty_slave_is_open = false;
-
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SCRIPT);
if (log)
log->Printf ("%p ScriptInterpreterPython::RunEmbeddedPythonInterpreter () thread exiting...", baton);
From gclayton at apple.com Thu Jan 26 18:46:15 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 00:46:15 -0000
Subject: [Lldb-commits] [lldb] r149103 - in /lldb/trunk:
include/lldb/Core/ConnectionFileDescriptor.h
source/Core/ConnectionFileDescriptor.cpp
Message-ID: <20120127004615.8311B2A6C12C@llvm.org>
Author: gclayton
Date: Thu Jan 26 18:46:15 2012
New Revision: 149103
URL: http://llvm.org/viewvc/llvm-project?rev=149103&view=rev
Log:
Fixed another double file descriptor close issue that could occur when destroying a ProcessGDBRemote() object. There was a race which was detected by our fd_interposing library:
error: /Applications/Xcode.app/Contents/MacOS/Xcode (pid=55222): close (fd=60) resulted in EBADF:
0 libFDInterposing.dylib 0x00000001082be8ca close$__interposed__ + 666
1 LLDB 0x00000001194fde91 lldb_private::ConnectionFileDescriptor::Close(int&, lldb_private::Error*) + 97
2 LLDB 0x00000001194fddcd lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Error*) + 143
3 LLDB 0x00000001194fe249 lldb_private::ConnectionFileDescriptor::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 835
4 LLDB 0x00000001194fc320 lldb_private::Communication::Read(void*, unsigned long, unsigned int, lldb::ConnectionStatus&, lldb_private::Error*) + 634
5 LLDB 0x000000011959c7f4 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSecondsNoLock(StringExtractorGDBRemote&, unsigned int) + 228
6 LLDB 0x000000011959c6b5 GDBRemoteCommunication::WaitForPacketWithTimeoutMicroSeconds(StringExtractorGDBRemote&, unsigned int) + 49
7 LLDB 0x0000000119629a71 GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse(ProcessGDBRemote*, char const*, unsigned long, StringExtractorGDBRemote&) + 509
8 LLDB 0x00000001195a4076 ProcessGDBRemote::AsyncThread(void*) + 514
9 LLDB 0x0000000119568094 ThreadCreateTrampoline(void*) + 91
10 libsystem_c.dylib 0x00007fff8ca028bf _pthread_start + 335
11 libsystem_c.dylib 0x00007fff8ca05b75 thread_start + 13
fd=60 was previously closed with this event:
pid=55222: close (fd=60) => 0
0 libFDInterposing.dylib 0x00000001082be870 close$__interposed__ + 576
1 LLDB 0x00000001194fde91 lldb_private::ConnectionFileDescriptor::Close(int&, lldb_private::Error*) + 97
2 LLDB 0x00000001194fddcd lldb_private::ConnectionFileDescriptor::Disconnect(lldb_private::Error*) + 143
3 LLDB 0x00000001194fbf00 lldb_private::Communication::Disconnect(lldb_private::Error*) + 92
4 LLDB 0x00000001195a2a77 ProcessGDBRemote::StopAsyncThread() + 89
5 LLDB 0x00000001195a2bf6 ProcessGDBRemote::DoDestroy() + 310
6 LLDB 0x00000001195f938d lldb_private::Process::Destroy() + 85
7 LLDB 0x0000000118819b48 lldb::SBProcess::Kill() + 72
8 DebuggerLLDB 0x0000000117264358 DBGLLDBSessionThread(void*) + 4450
9 LLDB 0x0000000119568094 ThreadCreateTrampoline(void*) + 91
10 libsystem_c.dylib 0x00007fff8ca028bf _pthread_start + 335
11 libsystem_c.dylib 0x00007fff8ca05b75 thread_start + 13
fd=60 was created with this event:
pid=55222: socket (domain = 2, type = 1, protocol = 6) => fd=60
0 libFDInterposing.dylib 0x00000001082bc968 socket$__interposed__ + 600
1 LLDB 0x00000001194fd75f lldb_private::ConnectionFileDescriptor::ConnectTCP(char const*, lldb_private::Error*) + 179
.....
Modified:
lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
Modified: lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h?rev=149103&r1=149102&r2=149103&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h (original)
+++ lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h Thu Jan 26 18:46:15 2012
@@ -19,6 +19,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Connection.h"
+#include "lldb/Host/Mutex.h"
#include "lldb/Host/SocketAddress.h"
namespace lldb_private {
@@ -104,6 +105,7 @@
SocketAddress m_udp_send_sockaddr;
bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
uint32_t m_socket_timeout_usec;
+ Mutex m_mutex;
static in_port_t
GetSocketPort (int fd);
Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=149103&r1=149102&r2=149103&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Thu Jan 26 18:46:15 2012
@@ -73,7 +73,8 @@
m_fd_recv_type (eFDTypeFile),
m_udp_send_sockaddr (),
m_should_close_fd (false),
- m_socket_timeout_usec(0)
+ m_socket_timeout_usec(0),
+ m_mutex (Mutex::eMutexTypeRecursive)
{
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
if (log)
@@ -113,6 +114,7 @@
ConnectionStatus
ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
{
+ Mutex::Locker locker (m_mutex);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", this, s);
@@ -232,6 +234,7 @@
ConnectionStatus
ConnectionFileDescriptor::Disconnect (Error *error_ptr)
{
+ Mutex::Locker locker (m_mutex);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", this);
@@ -599,6 +602,7 @@
ConnectionStatus
ConnectionFileDescriptor::Close (int& fd, Error *error_ptr)
{
+ Mutex::Locker locker (m_mutex);
if (error_ptr)
error_ptr->Clear();
bool success = true;
From gclayton at apple.com Fri Jan 27 12:08:35 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:08:35 -0000
Subject: [Lldb-commits] [lldb] r149131 - in /lldb/trunk:
include/lldb/Core/Module.h source/Commands/CommandObjectTarget.cpp
source/Core/Module.cpp
Message-ID: <20120127180835.77B022A6C12C@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:08:35 2012
New Revision: 149131
URL: http://llvm.org/viewvc/llvm-project?rev=149131&view=rev
Log:
Fixed an issue that could happen during global object destruction in our
map that tracks all live Module classes. We must leak our mutex for our
collection class as it might be destroyed in an order we can't control.
Modified:
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/Module.cpp
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=149131&r1=149130&r2=149131&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Fri Jan 27 12:08:35 2012
@@ -64,7 +64,7 @@
static Module *
GetAllocatedModuleAtIndex (size_t idx);
- static Mutex &
+ static Mutex *
GetAllocationModuleCollectionMutex();
//------------------------------------------------------------------
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=149131&r1=149130&r2=149131&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Jan 27 12:08:35 2012
@@ -1632,7 +1632,7 @@
if (check_global_list && num_matches == 0)
{
// Check the global list
- Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex().GetMutex());
+ Mutex::Locker locker(Module::GetAllocationModuleCollectionMutex());
const uint32_t num_modules = Module::GetNumberAllocatedModules();
ModuleSP module_sp;
for (uint32_t image_idx = 0; image_idxGetMutex());
num_modules = Module::GetNumberAllocatedModules();
}
else
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=149131&r1=149130&r2=149131&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Jan 27 12:08:35 2012
@@ -43,11 +43,18 @@
return *g_module_collection;
}
-Mutex &
+Mutex *
Module::GetAllocationModuleCollectionMutex()
{
- static Mutex g_module_collection_mutex(Mutex::eMutexTypeRecursive);
- return g_module_collection_mutex;
+ // NOTE: The mutex below must be leaked since the global module list in
+ // the ModuleList class will get torn at some point, and we can't know
+ // if it will tear itself down before the "g_module_collection_mutex" below
+ // will. So we leak a Mutex object below to safeguard against that
+
+ static Mutex *g_module_collection_mutex = NULL;
+ if (g_module_collection_mutex == NULL)
+ g_module_collection_mutex = new Mutex (Mutex::eMutexTypeRecursive); // NOTE: known leak
+ return g_module_collection_mutex;
}
size_t
From gclayton at apple.com Fri Jan 27 12:14:52 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:14:52 -0000
Subject: [Lldb-commits] [lldb] r149132 -
/lldb/trunk/include/lldb/Utility/SharedCluster.h
Message-ID: <20120127181452.282E72A6C12C@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:14:51 2012
New Revision: 149132
URL: http://llvm.org/viewvc/llvm-project?rev=149132&view=rev
Log:
Fixed a location where we would never end up unlocking our mutex in
the ClusterManager. Also switched to using Mutex::Locker where we can.
Modified:
lldb/trunk/include/lldb/Utility/SharedCluster.h
Modified: lldb/trunk/include/lldb/Utility/SharedCluster.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharedCluster.h?rev=149132&r1=149131&r2=149132&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharedCluster.h (original)
+++ lldb/trunk/include/lldb/Utility/SharedCluster.h Fri Jan 27 12:14:51 2012
@@ -55,23 +55,26 @@
{
delete m_objects[i];
}
+ // Decrement refcount should have been called on this ClusterManager,
+ // and it should have locked the mutex, now we will unlock it before
+ // we destroy it...
+ m_mutex.Unlock();
}
void ManageObject (T *new_object)
{
- m_mutex.Lock();
+ Mutex::Locker locker (m_mutex);
if (!ContainsObject(new_object))
m_objects.push_back (new_object);
- m_mutex.Unlock();
}
typename lldb_private::SharingPtr GetSharedPointer(T *desired_object)
{
- m_mutex.Lock();
- m_external_ref++;
- assert (ContainsObject(desired_object));
- m_mutex.Unlock();
-
+ {
+ Mutex::Locker locker (m_mutex);
+ m_external_ref++;
+ assert (ContainsObject(desired_object));
+ }
return typename lldb_private::SharingPtr (desired_object, new imp::shared_ptr_refcount (this));
}
@@ -79,10 +82,9 @@
bool ContainsObject (const T *desired_object)
{
- typename std::vector::iterator pos;
- pos = std::find(m_objects.begin(), m_objects.end(), desired_object);
-
- return pos < m_objects.end();
+ typename std::vector::iterator pos, end = m_objects.end();
+ pos = std::find(m_objects.begin(), end, desired_object);
+ return pos != end;
}
void DecrementRefCount ()
From gclayton at apple.com Fri Jan 27 12:18:23 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:18:23 -0000
Subject: [Lldb-commits] [lldb] r149133 - in /lldb/trunk/source/Commands:
CommandObjectExpression.cpp CommandObjectExpression.h
Message-ID: <20120127181824.04B9B2A6C12C@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:18:23 2012
New Revision: 149133
URL: http://llvm.org/viewvc/llvm-project?rev=149133&view=rev
Log:
There is no need to hold onto an ExecutionContext as a member variable.
ExecutionContext objects have shared pointers to Target, Process, Thread
and Frame objects and they can end up being held onto for too long.
Modified:
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectExpression.h
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=149133&r1=149132&r2=149133&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Jan 27 12:18:23 2012
@@ -282,7 +282,7 @@
CommandReturnObject *result
)
{
- Target *target = m_exe_ctx.GetTargetPtr();
+ Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
if (!target)
target = Host::GetDummyTarget(m_interpreter.GetDebugger()).get();
@@ -310,7 +310,7 @@
}
exe_results = target->EvaluateExpression (expr,
- m_exe_ctx.GetFramePtr(),
+ m_interpreter.GetExecutionContext().GetFramePtr(),
eExecutionPolicyOnlyWhenNeeded,
m_command_options.print_object,
m_command_options.unwind_on_error,
@@ -323,7 +323,7 @@
uint32_t start_frame = 0;
uint32_t num_frames = 1;
uint32_t num_frames_with_source = 0;
- Thread *thread = m_exe_ctx.GetThreadPtr();
+ Thread *thread = m_interpreter.GetExecutionContext().GetThreadPtr();
if (thread)
{
thread->GetStatus (result->GetOutputStream(),
@@ -333,7 +333,7 @@
}
else
{
- Process *process = m_exe_ctx.GetProcessPtr();
+ Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
if (process)
{
bool only_threads_with_stop_reason = true;
@@ -422,8 +422,6 @@
CommandReturnObject &result
)
{
- m_exe_ctx = m_interpreter.GetExecutionContext();
-
m_option_group.NotifyOptionParsingStarting();
const char * expr = NULL;
Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=149133&r1=149132&r2=149133&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Jan 27 12:18:23 2012
@@ -96,7 +96,6 @@
OptionGroupOptions m_option_group;
OptionGroupFormat m_format_options;
CommandOptions m_command_options;
- ExecutionContext m_exe_ctx;
uint32_t m_expr_line_count;
std::string m_expr_lines; // Multi-line expression support
};
From gclayton at apple.com Fri Jan 27 12:29:47 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:29:47 -0000
Subject: [Lldb-commits] [lldb] r149135 -
/lldb/trunk/source/Host/common/Mutex.cpp
Message-ID: <20120127182947.9E1E01BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:29:47 2012
New Revision: 149135
URL: http://llvm.org/viewvc/llvm-project?rev=149135&view=rev
Log:
Enable extra error checking for debug builds in our mutexes by
watching for errors from pthread_mutex_destroy () (usually "Resource
busy" errors for when you have a mutex locked and try to destroy
it), and pthread_mutex_lock, and pthread_mutex_unlock (usually for
trying to lock an invalid mutex that might have possible already
been freed).
Modified:
lldb/trunk/source/Host/common/Mutex.cpp
Modified: lldb/trunk/source/Host/common/Mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=149135&r1=149134&r2=149135&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Mutex.cpp (original)
+++ lldb/trunk/source/Host/common/Mutex.cpp Fri Jan 27 12:29:47 2012
@@ -8,6 +8,11 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/Mutex.h"
+#include "lldb/Host/Host.h"
+
+#include
+#include
+#include
#if 0
// This logging is way too verbose to enable even for a log channel.
@@ -19,6 +24,11 @@
#define DEBUG_LOG(fmt, ...)
#endif
+// Enable extra mutex error checking
+#ifdef LLDB_CONFIGURATION_DEBUG
+#define ENABLE_MUTEX_ERROR_CHECKING 1
+#endif
+
using namespace lldb_private;
//----------------------------------------------------------------------
@@ -145,7 +155,11 @@
switch (type)
{
case eMutexTypeNormal:
+#if ENABLE_MUTEX_ERROR_CHECKING
+ err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_ERRORCHECK);
+#else
err = ::pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_NORMAL);
+#endif
break;
case eMutexTypeRecursive:
@@ -172,6 +186,14 @@
{
int err;
err = ::pthread_mutex_destroy (&m_mutex);
+#if ENABLE_MUTEX_ERROR_CHECKING
+ if (err)
+ {
+ Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy() => err = %i (%s)", __PRETTY_FUNCTION__, err, strerror(err));
+ assert(err == 0);
+ }
+ memset (&m_mutex, '\xba', sizeof(m_mutex));
+#endif
}
//----------------------------------------------------------------------
@@ -188,6 +210,13 @@
{
DEBUG_LOG ("[%4.4x/%4.4x] pthread_mutex_lock (%p)...\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), mutex_ptr);
int err = ::pthread_mutex_lock (mutex_ptr);
+#if ENABLE_MUTEX_ERROR_CHECKING
+ if (err)
+ {
+ Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
+ assert(err == 0);
+ }
+#endif
DEBUG_LOG ("[%4.4x/%4.4x] pthread_mutex_lock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), mutex_ptr, err);
return err;
}
@@ -204,6 +233,13 @@
Mutex::Unlock (pthread_mutex_t *mutex_ptr)
{
int err = ::pthread_mutex_unlock (mutex_ptr);
+#if ENABLE_MUTEX_ERROR_CHECKING
+ if (err)
+ {
+ Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_unlock(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
+ assert(err == 0);
+ }
+#endif
DEBUG_LOG ("[%4.4x/%4.4x] pthread_mutex_unlock (%p) => %i\n", Host::GetCurrentProcessID(), Host::GetCurrentThreadID(), mutex_ptr, err);
return err;
}
From gclayton at apple.com Fri Jan 27 12:33:53 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:33:53 -0000
Subject: [Lldb-commits] [lldb] r149136 -
/lldb/trunk/include/lldb/Utility/SharingPtr.h
Message-ID: <20120127183353.87E971BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:33:53 2012
New Revision: 149136
URL: http://llvm.org/viewvc/llvm-project?rev=149136&view=rev
Log:
NULL out the "ptr_" member of shared pointers for debug and release
builds (not build and integration builds) to help catch when a shared pointer
that might be in a collection class is used after the collection
has been freed.
Modified:
lldb/trunk/include/lldb/Utility/SharingPtr.h
Modified: lldb/trunk/include/lldb/Utility/SharingPtr.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/SharingPtr.h?rev=149136&r1=149135&r2=149136&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/SharingPtr.h (original)
+++ lldb/trunk/include/lldb/Utility/SharingPtr.h Fri Jan 27 12:33:53 2012
@@ -684,6 +684,15 @@
~IntrusiveSharingPtr()
{
release_shared();
+#if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
+ // NULL out the pointer in objects which can help with leaks detection.
+ // We don't enable this for LLDB_CONFIGURATION_BUILD_AND_INTEGRATION or
+ // when none of the LLDB_CONFIGURATION_XXX macros are defined since
+ // those would be builds for release. But for debug and release builds
+ // that are for development, we NULL out the pointers to catch potential
+ // issues.
+ ptr_ = NULL;
+#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined (LLDB_CONFIGURATION_RELEASE)
}
T&
From gclayton at apple.com Fri Jan 27 12:45:39 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:45:39 -0000
Subject: [Lldb-commits] [lldb] r149138 - in /lldb/trunk:
include/lldb/Core/ModuleList.h source/Core/Module.cpp
source/Core/ModuleList.cpp source/Utility/SharingPtr.cpp
Message-ID: <20120127184539.AB9202A6C12C@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:45:39 2012
New Revision: 149138
URL: http://llvm.org/viewvc/llvm-project?rev=149138&view=rev
Log:
Added a ModuleList::Destroy() method which will reclaim the std::vector
memory by doing a swap.
Also added a few utilty functions that can be enabled for debugging issues
with modules staying around too long when external clients still have references
to them.
Modified:
lldb/trunk/include/lldb/Core/ModuleList.h
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Utility/SharingPtr.cpp
Modified: lldb/trunk/include/lldb/Core/ModuleList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=149138&r1=149137&r2=149138&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ModuleList.h (original)
+++ lldb/trunk/include/lldb/Core/ModuleList.h Fri Jan 27 12:45:39 2012
@@ -89,6 +89,16 @@
Clear ();
//------------------------------------------------------------------
+ /// Clear the object's state.
+ ///
+ /// Clears the list of modules and releases a reference to each
+ /// module object and if the reference count goes to zero, the
+ /// module will be deleted. Also relese all memory that might be
+ /// held by any collection classes (like std::vector)
+ //------------------------------------------------------------------
+ void
+ Destroy();
+ //------------------------------------------------------------------
/// Dump the description of each module contained in this list.
///
/// Dump the description of each module contained in this list to
@@ -395,8 +405,8 @@
size_t
GetSize () const;
- static const lldb::ModuleSP
- GetModuleSP (const Module *module_ptr);
+ static bool
+ ModuleIsInCache (const Module *module_ptr);
static Error
GetSharedModule (const FileSpec& file_spec,
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=149138&r1=149137&r2=149138&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Jan 27 12:45:39 2012
@@ -73,8 +73,42 @@
return modules[idx];
return NULL;
}
+#if 0
+// These functions help us to determine if modules are still loaded, yet don't require that
+// you have a command interpreter and can easily be called from an external debugger.
+namespace lldb {
+ void
+ ClearModuleInfo (void)
+ {
+ ModuleList::RemoveOrphanSharedModules();
+ }
+
+ void
+ DumpModuleInfo (void)
+ {
+ Mutex::Locker locker (Module::GetAllocationModuleCollectionMutex());
+ ModuleCollection &modules = GetModuleCollection();
+ const size_t count = modules.size();
+ printf ("%s: %zu modules:\n", __PRETTY_FUNCTION__, count);
+ for (size_t i=0; iGetDescription(&strm, eDescriptionLevelFull);
+ printf ("%p: shared = %i, ref_count = %3u, module = %s\n",
+ module,
+ in_shared_module_list,
+ (uint32_t)module->use_count(),
+ strm.GetString().c_str());
+ }
+ }
+}
+
+#endif
Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstString *object_name, off_t object_offset) :
Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=149138&r1=149137&r2=149138&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Fri Jan 27 12:45:39 2012
@@ -155,6 +155,14 @@
m_modules.clear();
}
+void
+ModuleList::Destroy()
+{
+ Mutex::Locker locker(m_modules_mutex);
+ collection empty;
+ m_modules.swap(empty);
+}
+
Module*
ModuleList::GetModulePointerAtIndex (uint32_t idx) const
{
@@ -653,28 +661,15 @@
return g_shared_module_list;
}
-const lldb::ModuleSP
-ModuleList::GetModuleSP (const Module *module_ptr)
+bool
+ModuleList::ModuleIsInCache (const Module *module_ptr)
{
- lldb::ModuleSP module_sp;
if (module_ptr)
{
ModuleList &shared_module_list = GetSharedModuleList ();
- module_sp = shared_module_list.FindModule (module_ptr);
- if (module_sp.get() == NULL)
- {
- char uuid_cstr[256];
- const_cast(module_ptr)->GetUUID().GetAsCString (uuid_cstr, sizeof(uuid_cstr));
- const FileSpec &module_file_spec = module_ptr->GetFileSpec();
- Host::SystemLog (Host::eSystemLogWarning,
- "warning: module not in shared module list: %s (%s) \"%s/%s\"\n",
- uuid_cstr,
- module_ptr->GetArchitecture().GetArchitectureName(),
- module_file_spec.GetDirectory().GetCString(),
- module_file_spec.GetFilename().GetCString());
- }
+ return shared_module_list.FindModule (module_ptr).get() != NULL;
}
- return module_sp;
+ return false;
}
size_t
Modified: lldb/trunk/source/Utility/SharingPtr.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/SharingPtr.cpp?rev=149138&r1=149137&r2=149138&view=diff
==============================================================================
--- lldb/trunk/source/Utility/SharingPtr.cpp (original)
+++ lldb/trunk/source/Utility/SharingPtr.cpp Fri Jan 27 12:45:39 2012
@@ -111,11 +111,16 @@
}
}
}
-extern "C" void dump_sp_refs (void *ptr)
-{
- // Use a specially crafted call to "track_sp" which will
- // dump info on all live shared pointers that reference "ptr"
- track_sp (NULL, ptr, 0);
+// Put dump_sp_refs in the lldb namespace to it gets through our exports lists filter in the LLDB.framework or lldb.so
+namespace lldb {
+
+ void dump_sp_refs (void *ptr)
+ {
+ // Use a specially crafted call to "track_sp" which will
+ // dump info on all live shared pointers that reference "ptr"
+ track_sp (NULL, ptr, 0);
+ }
+
}
#endif
From johnny.chen at apple.com Fri Jan 27 12:49:33 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 27 Jan 2012 18:49:33 -0000
Subject: [Lldb-commits] [lldb] r149139 -
/lldb/trunk/source/Commands/CommandObjectHelp.cpp
Message-ID: <20120127184933.BDFC51BE003@llvm.org>
Author: johnny
Date: Fri Jan 27 12:49:33 2012
New Revision: 149139
URL: http://llvm.org/viewvc/llvm-project?rev=149139&view=rev
Log:
Emit the message about putting ' -- ' between the end of command options and the raw input conditionally,
that is, only if the command object does not want completion. An example is the "settings set" command.
Modified:
lldb/trunk/source/Commands/CommandObjectHelp.cpp
Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=149139&r1=149138&r2=149139&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Fri Jan 27 12:49:33 2012
@@ -158,11 +158,13 @@
if ((long_help != NULL)
&& (strlen (long_help) > 0))
output_strm.Printf ("\n%s", long_help);
- // Mark this help command with a success status.
- if (sub_cmd_obj->WantsRawCommandString())
+ // Emit the message about using ' -- ' between the end of the command options and the raw input
+ // conditionally, i.e., only if the command object does not want completion.
+ if (sub_cmd_obj->WantsRawCommandString() && !sub_cmd_obj->WantsCompletion())
{
m_interpreter.OutputFormattedHelpText (output_strm, "", "", "\nIMPORTANT NOTE: Because this command takes 'raw' input, if you use any command options you must use ' -- ' between the end of the command options and the beginning of the raw input.", 1);
}
+ // Mark this help command with a success status.
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else if (sub_cmd_obj->IsMultiwordObject())
From johnny.chen at apple.com Fri Jan 27 12:53:22 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 27 Jan 2012 18:53:22 -0000
Subject: [Lldb-commits] [lldb] r149140 -
/lldb/trunk/source/Host/common/Mutex.cpp
Message-ID: <20120127185322.3C97F1BE003@llvm.org>
Author: johnny
Date: Fri Jan 27 12:53:22 2012
New Revision: 149140
URL: http://llvm.org/viewvc/llvm-project?rev=149140&view=rev
Log:
Fix typo.
Modified:
lldb/trunk/source/Host/common/Mutex.cpp
Modified: lldb/trunk/source/Host/common/Mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Mutex.cpp?rev=149140&r1=149139&r2=149140&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Mutex.cpp (original)
+++ lldb/trunk/source/Host/common/Mutex.cpp Fri Jan 27 12:53:22 2012
@@ -213,7 +213,7 @@
#if ENABLE_MUTEX_ERROR_CHECKING
if (err)
{
- Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_destroy(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
+ Host::SetCrashDescriptionWithFormat ("%s error: pthread_mutex_lock(%p) => err = %i (%s)", __PRETTY_FUNCTION__, mutex_ptr, err, strerror(err));
assert(err == 0);
}
#endif
From gclayton at apple.com Fri Jan 27 12:57:04 2012
From: gclayton at apple.com (Greg Clayton)
Date: Fri, 27 Jan 2012 18:57:04 -0000
Subject: [Lldb-commits] [lldb] r149141 - in /lldb/trunk:
include/lldb/Core/ConnectionFileDescriptor.h
source/Core/ConnectionFileDescriptor.cpp
Message-ID: <20120127185704.711BE1BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 12:57:04 2012
New Revision: 149141
URL: http://llvm.org/viewvc/llvm-project?rev=149141&view=rev
Log:
Disable the ConnectionFileDescriptor mutex for now as it is deadlocking our
test suite and I need to investigate this.
Modified:
lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
Modified: lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h?rev=149141&r1=149140&r2=149141&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h (original)
+++ lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h Fri Jan 27 12:57:04 2012
@@ -105,7 +105,7 @@
SocketAddress m_udp_send_sockaddr;
bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
uint32_t m_socket_timeout_usec;
- Mutex m_mutex;
+ //Mutex m_mutex;
static in_port_t
GetSocketPort (int fd);
Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=149141&r1=149140&r2=149141&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Fri Jan 27 12:57:04 2012
@@ -73,8 +73,8 @@
m_fd_recv_type (eFDTypeFile),
m_udp_send_sockaddr (),
m_should_close_fd (false),
- m_socket_timeout_usec(0),
- m_mutex (Mutex::eMutexTypeRecursive)
+ m_socket_timeout_usec(0)//,
+ //m_mutex (Mutex::eMutexTypeRecursive)
{
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION | LIBLLDB_LOG_OBJECT));
if (log)
@@ -114,7 +114,7 @@
ConnectionStatus
ConnectionFileDescriptor::Connect (const char *s, Error *error_ptr)
{
- Mutex::Locker locker (m_mutex);
+ //Mutex::Locker locker (m_mutex);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf ("%p ConnectionFileDescriptor::Connect (url = '%s')", this, s);
@@ -234,7 +234,6 @@
ConnectionStatus
ConnectionFileDescriptor::Disconnect (Error *error_ptr)
{
- Mutex::Locker locker (m_mutex);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf ("%p ConnectionFileDescriptor::Disconnect ()", this);
@@ -389,7 +388,7 @@
return 0;
}
- Disconnect (NULL);
+ //Disconnect (NULL);
return 0;
}
return bytes_read;
@@ -508,7 +507,7 @@
break; // Break to close....
}
- Disconnect (NULL);
+ //Disconnect (NULL);
return 0;
}
@@ -602,7 +601,7 @@
ConnectionStatus
ConnectionFileDescriptor::Close (int& fd, Error *error_ptr)
{
- Mutex::Locker locker (m_mutex);
+ //Mutex::Locker locker (m_mutex);
if (error_ptr)
error_ptr->Clear();
bool success = true;
From johnny.chen at apple.com Fri Jan 27 15:27:40 2012
From: johnny.chen at apple.com (Johnny Chen)
Date: Fri, 27 Jan 2012 21:27:40 -0000
Subject: [Lldb-commits] [lldb] r149145 - in /lldb/trunk:
include/lldb/Core/UserSettingsController.h
source/Core/UserSettingsController.cpp
Message-ID: <20120127212740.47F011BE003@llvm.org>
Author: johnny
Date: Fri Jan 27 15:27:39 2012
New Revision: 149145
URL: http://llvm.org/viewvc/llvm-project?rev=149145&view=rev
Log:
Add an InstanceSettings::NotifyOwnerIsShuttingDown() method so that the owner can notify InstanceSettings instances
that their owner reference is no longer valid.
Modified:
lldb/trunk/include/lldb/Core/UserSettingsController.h
lldb/trunk/source/Core/UserSettingsController.cpp
Modified: lldb/trunk/include/lldb/Core/UserSettingsController.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/UserSettingsController.h?rev=149145&r1=149144&r2=149145&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/UserSettingsController.h (original)
+++ lldb/trunk/include/lldb/Core/UserSettingsController.h Fri Jan 27 15:27:39 2012
@@ -400,6 +400,9 @@
// Begin Pure Virtual Functions
virtual void
+ NotifyOwnerIsShuttingDown ();
+
+ virtual void
UpdateInstanceSettingsVariable (const ConstString &var_name,
const char *index_value,
const char *value,
@@ -440,6 +443,7 @@
protected:
UserSettingsController &m_owner;
+ bool m_owner_is_live;
ConstString m_instance_name;
};
Modified: lldb/trunk/source/Core/UserSettingsController.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/UserSettingsController.cpp?rev=149145&r1=149144&r2=149145&view=diff
==============================================================================
--- lldb/trunk/source/Core/UserSettingsController.cpp (original)
+++ lldb/trunk/source/Core/UserSettingsController.cpp Fri Jan 27 15:27:39 2012
@@ -83,6 +83,10 @@
UserSettingsController::~UserSettingsController ()
{
Mutex::Locker locker (m_live_settings_mutex);
+
+ // Notify all instance settings that their owner is shutting down, first.
+ for (InstanceSettingsMap::iterator pos = m_live_settings.begin(); pos != m_live_settings.end(); ++pos)
+ pos->second->NotifyOwnerIsShuttingDown();
m_live_settings.clear();
}
@@ -2458,7 +2462,8 @@
InstanceSettings::InstanceSettings (UserSettingsController &owner, const char *instance_name, bool live_instance) :
m_owner (owner),
- m_instance_name (instance_name)
+ m_instance_name (instance_name),
+ m_owner_is_live (true)
{
if ((m_instance_name != InstanceSettings::GetDefaultName())
&& (m_instance_name != InstanceSettings::InvalidName())
@@ -2468,10 +2473,16 @@
InstanceSettings::~InstanceSettings ()
{
- if (m_instance_name != InstanceSettings::GetDefaultName())
+ if (m_instance_name != InstanceSettings::GetDefaultName() && m_owner_is_live)
m_owner.UnregisterInstanceSettings (this);
}
+void
+InstanceSettings::NotifyOwnerIsShuttingDown()
+{
+ m_owner_is_live = false;
+}
+
const ConstString &
InstanceSettings::GetDefaultName ()
{
From gclayton at apple.com Fri Jan 27 18:48:57 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 28 Jan 2012 00:48:57 -0000
Subject: [Lldb-commits] [lldb] r149160 - in /lldb/trunk:
include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
Message-ID: <20120128004857.D89B71BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 18:48:57 2012
New Revision: 149160
URL: http://llvm.org/viewvc/llvm-project?rev=149160&view=rev
Log:
Adding the DWARF parser side for assited layout where the AST context
will ask ExternalASTSource objects to help laying out a type. This is needed
because the DWARF typically doesn't contain alignement or packing attribute
values, and we need to be able to match up types that the compiler uses
in expressions.
Modified:
lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
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
Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h?rev=149160&r1=149159&r2=149160&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h Fri Jan 27 18:48:57 2012
@@ -18,6 +18,7 @@
#include
// Other libraries and framework includes
+#include "clang/AST/CharUnits.h"
// Project includes
#include "lldb/lldb-enumerations.h"
@@ -34,14 +35,23 @@
typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl *results);
+ typedef bool (*LayoutRecordTypeCallback)(void *baton,
+ const clang::RecordDecl *Record,
+ uint64_t &Size,
+ uint64_t &Alignment,
+ llvm::DenseMap &FieldOffsets,
+ llvm::DenseMap &BaseOffsets,
+ llvm::DenseMap &VirtualBaseOffsets);
ClangExternalASTSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
CompleteObjCInterfaceDeclCallback objc_decl_callback,
FindExternalVisibleDeclsByNameCallback find_by_name_callback,
+ LayoutRecordTypeCallback layout_record_type_callback,
void *callback_baton) :
m_callback_tag_decl (tag_decl_callback),
m_callback_objc_decl (objc_decl_callback),
m_callback_find_by_name (find_by_name_callback),
+ m_callback_layout_record_type (layout_record_type_callback),
m_callback_baton (callback_baton)
{
}
@@ -117,11 +127,13 @@
SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
CompleteObjCInterfaceDeclCallback objc_decl_callback,
FindExternalVisibleDeclsByNameCallback find_by_name_callback,
+ LayoutRecordTypeCallback layout_record_type_callback,
void *callback_baton)
{
m_callback_tag_decl = tag_decl_callback;
m_callback_objc_decl = objc_decl_callback;
m_callback_find_by_name = find_by_name_callback;
+ m_callback_layout_record_type = layout_record_type_callback;
m_callback_baton = callback_baton;
}
@@ -133,6 +145,7 @@
m_callback_tag_decl = NULL;
m_callback_objc_decl = NULL;
m_callback_find_by_name = NULL;
+ m_callback_layout_record_type = NULL;
}
}
@@ -143,6 +156,7 @@
CompleteTagDeclCallback m_callback_tag_decl;
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
FindExternalVisibleDeclsByNameCallback m_callback_find_by_name;
+ LayoutRecordTypeCallback m_callback_layout_record_type;
void * m_callback_baton;
};
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=149160&r1=149159&r2=149160&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jan 27 18:48:57 2012
@@ -243,8 +243,8 @@
new ClangExternalASTSourceCallbacks (SymbolFileDWARF::CompleteTagDecl,
SymbolFileDWARF::CompleteObjCInterfaceDecl,
SymbolFileDWARF::FindExternalVisibleDeclsByName,
+ SymbolFileDWARF::LayoutRecordType,
this));
-
ast.SetExternalSource (ast_source_ap);
}
return ast;
@@ -1305,7 +1305,8 @@
std::vector& member_accessibilities,
DWARFDIECollection& member_function_dies,
AccessType& default_accessibility,
- bool &is_a_class
+ bool &is_a_class,
+ LayoutInfo &layout_info
)
{
if (parent_die == NULL)
@@ -1343,7 +1344,7 @@
bool is_artificial = false;
lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
AccessType accessibility = eAccessNone;
- //off_t member_offset = 0;
+ uint32_t member_byte_offset = UINT32_MAX;
size_t byte_size = 0;
size_t bit_offset = 0;
size_t bit_size = 0;
@@ -1365,18 +1366,29 @@
case DW_AT_bit_size: bit_size = form_value.Unsigned(); break;
case DW_AT_byte_size: byte_size = form_value.Unsigned(); break;
case DW_AT_data_member_location:
-// if (form_value.BlockData())
-// {
-// Value initialValue(0);
-// Value memberOffset(0);
-// const DataExtractor& debug_info_data = get_debug_info_data();
-// uint32_t block_length = form_value.Unsigned();
-// uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
-// if (DWARFExpression::Evaluate(NULL, NULL, debug_info_data, NULL, NULL, block_offset, block_length, eRegisterKindDWARF, &initialValue, memberOffset, NULL))
-// {
-// member_offset = memberOffset.ResolveValue(NULL, NULL).UInt();
-// }
-// }
+ if (form_value.BlockData())
+ {
+ Value initialValue(0);
+ Value memberOffset(0);
+ const DataExtractor& debug_info_data = get_debug_info_data();
+ uint32_t block_length = form_value.Unsigned();
+ uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart();
+ if (DWARFExpression::Evaluate(NULL, // ExecutionContext *
+ NULL, // clang::ASTContext *
+ NULL, // ClangExpressionVariableList *
+ NULL, // ClangExpressionDeclMap *
+ NULL, // RegisterContext *
+ debug_info_data,
+ block_offset,
+ block_length,
+ eRegisterKindDWARF,
+ &initialValue,
+ memberOffset,
+ NULL))
+ {
+ member_byte_offset = memberOffset.ResolveValue(NULL, NULL).UInt();
+ }
+ }
break;
case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break;
@@ -1463,6 +1475,11 @@
encoding_uid);
}
+ if (member_byte_offset != UINT32_MAX)
+ {
+ // Set the field offset in bits
+ layout_info.field_offsets.insert(std::make_pair(field_decl, member_byte_offset * 8));
+ }
if (prop_name != NULL)
{
@@ -1745,146 +1762,179 @@
case DW_TAG_union_type:
case DW_TAG_class_type:
ast.StartTagDeclarationDefinition (clang_type);
- if (die->HasChildren())
{
- LanguageType class_language = eLanguageTypeUnknown;
- bool is_objc_class = ClangASTContext::IsObjCClassType (clang_type);
- if (is_objc_class)
- class_language = eLanguageTypeObjC;
-
- int tag_decl_kind = -1;
- AccessType default_accessibility = eAccessNone;
- if (tag == DW_TAG_structure_type)
+ LayoutInfo layout_info;
+ if (die->HasChildren())
{
- tag_decl_kind = clang::TTK_Struct;
- default_accessibility = eAccessPublic;
- }
- else if (tag == DW_TAG_union_type)
- {
- tag_decl_kind = clang::TTK_Union;
- default_accessibility = eAccessPublic;
- }
- else if (tag == DW_TAG_class_type)
- {
- tag_decl_kind = clang::TTK_Class;
- default_accessibility = eAccessPrivate;
- }
- SymbolContext sc(GetCompUnitForDWARFCompUnit(curr_cu));
- std::vector base_classes;
- std::vector member_accessibilities;
- bool is_a_class = false;
- // Parse members and base classes first
- DWARFDIECollection member_function_dies;
-
- ParseChildMembers (sc,
- curr_cu,
- die,
- clang_type,
- class_language,
- base_classes,
- member_accessibilities,
- member_function_dies,
- default_accessibility,
- is_a_class);
-
- // Now parse any methods if there were any...
- size_t num_functions = member_function_dies.Size();
- if (num_functions > 0)
- {
- for (size_t i=0; iFindByName(class_str.c_str(), method_die_offsets);
- }
- else
+ tag_decl_kind = clang::TTK_Union;
+ default_accessibility = eAccessPublic;
+ }
+ else if (tag == DW_TAG_class_type)
+ {
+ tag_decl_kind = clang::TTK_Class;
+ default_accessibility = eAccessPrivate;
+ }
+
+ SymbolContext sc(GetCompUnitForDWARFCompUnit(curr_cu));
+ std::vector base_classes;
+ std::vector member_accessibilities;
+ bool is_a_class = false;
+ // Parse members and base classes first
+ DWARFDIECollection member_function_dies;
+
+ ParseChildMembers (sc,
+ curr_cu,
+ die,
+ clang_type,
+ class_language,
+ base_classes,
+ member_accessibilities,
+ member_function_dies,
+ default_accessibility,
+ is_a_class,
+ layout_info);
+
+ // Now parse any methods if there were any...
+ size_t num_functions = member_function_dies.Size();
+ if (num_functions > 0)
+ {
+ for (size_t i=0; iFindByName(class_str.c_str(), method_die_offsets);
+ }
+ else
{
- const dw_offset_t die_offset = method_die_offsets[i];
- DWARFDebugInfoEntry *method_die = debug_info->GetDIEPtrWithCompileUnitHint (die_offset, &method_cu);
+ if (!m_indexed)
+ Index ();
- if (method_die)
- ResolveType (method_cu, method_die);
- else
+ ConstString class_name (class_str.c_str());
+ m_objc_class_selectors_index.Find (class_name, method_die_offsets);
+ }
+
+ if (!method_die_offsets.empty())
+ {
+ DWARFDebugInfo* debug_info = DebugInfo();
+
+ DWARFCompileUnit* method_cu = NULL;
+ const size_t num_matches = method_die_offsets.size();
+ for (size_t i=0; iGetDIEPtrWithCompileUnitHint (die_offset, &method_cu);
+
+ if (method_die)
+ ResolveType (method_cu, method_die);
+ else
{
- GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_objc accelerator table had bad die 0x%8.8x for '%s')\n",
- die_offset, class_str.c_str());
- }
- }
+ if (m_using_apple_tables)
+ {
+ GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_objc accelerator table had bad die 0x%8.8x for '%s')\n",
+ die_offset, class_str.c_str());
+ }
+ }
+ }
}
}
}
+
+ // If we have a DW_TAG_structure_type instead of a DW_TAG_class_type we
+ // need to tell the clang type it is actually a class.
+ if (class_language != eLanguageTypeObjC)
+ {
+ if (is_a_class && tag_decl_kind != clang::TTK_Class)
+ ast.SetTagTypeKind (clang_type, clang::TTK_Class);
+ }
+
+ // Since DW_TAG_structure_type gets used for both classes
+ // and structures, we may need to set any DW_TAG_member
+ // fields to have a "private" access if none was specified.
+ // When we parsed the child members we tracked that actual
+ // accessibility value for each DW_TAG_member in the
+ // "member_accessibilities" array. If the value for the
+ // member is zero, then it was set to the "default_accessibility"
+ // which for structs was "public". Below we correct this
+ // by setting any fields to "private" that weren't correctly
+ // set.
+ if (is_a_class && !member_accessibilities.empty())
+ {
+ // This is a class and all members that didn't have
+ // their access specified are private.
+ ast.SetDefaultAccessForRecordFields (clang_type,
+ eAccessPrivate,
+ &member_accessibilities.front(),
+ member_accessibilities.size());
+ }
+
+ if (!base_classes.empty())
+ {
+ ast.SetBaseClassesForClassType (clang_type,
+ &base_classes.front(),
+ base_classes.size());
+
+ // Clang will copy each CXXBaseSpecifier in "base_classes"
+ // so we have to free them all.
+ ClangASTContext::DeleteBaseClassSpecifiers (&base_classes.front(),
+ base_classes.size());
+ }
+
}
-
- // If we have a DW_TAG_structure_type instead of a DW_TAG_class_type we
- // need to tell the clang type it is actually a class.
- if (class_language != eLanguageTypeObjC)
- {
- if (is_a_class && tag_decl_kind != clang::TTK_Class)
- ast.SetTagTypeKind (clang_type, clang::TTK_Class);
- }
-
- // Since DW_TAG_structure_type gets used for both classes
- // and structures, we may need to set any DW_TAG_member
- // fields to have a "private" access if none was specified.
- // When we parsed the child members we tracked that actual
- // accessibility value for each DW_TAG_member in the
- // "member_accessibilities" array. If the value for the
- // member is zero, then it was set to the "default_accessibility"
- // which for structs was "public". Below we correct this
- // by setting any fields to "private" that weren't correctly
- // set.
- if (is_a_class && !member_accessibilities.empty())
- {
- // This is a class and all members that didn't have
- // their access specified are private.
- ast.SetDefaultAccessForRecordFields (clang_type,
- eAccessPrivate,
- &member_accessibilities.front(),
- member_accessibilities.size());
- }
-
- if (!base_classes.empty())
- {
- ast.SetBaseClassesForClassType (clang_type,
- &base_classes.front(),
- base_classes.size());
-
- // Clang will copy each CXXBaseSpecifier in "base_classes"
- // so we have to free them all.
- ClangASTContext::DeleteBaseClassSpecifiers (&base_classes.front(),
- base_classes.size());
+#if 0
+ // Disable assisted layout until we get the clang side hooked up
+ if (!layout_info.field_offsets.empty())
+ {
+ if (type)
+ layout_info.bit_size = type->GetByteSize() * 8;
+ if (layout_info.bit_size == 0)
+ layout_info.bit_size = die->GetAttributeValueAsUnsigned(this, curr_cu, DW_AT_byte_size, 0) * 8;
+ clang::QualType qual_type(clang::QualType::getFromOpaquePtr(clang_type));
+ const clang::RecordType *record_type = clang::dyn_cast(qual_type.getTypePtr());
+ if (record_type)
+ {
+ const clang::RecordDecl *record_decl = record_type->getDecl();
+
+ if (log)
+ GetObjectFile()->GetModule()->LogMessage (log.get(),
+ "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u],base_offsets[0], vbase_offsets[0])",
+ clang_type,
+ record_decl,
+ layout_info.bit_size,
+ layout_info.alignment,
+ (uint32_t)layout_info.field_offsets.size());
+
+
+ m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
+ }
}
-
+#endif
}
ast.CompleteTagDeclarationDefinition (clang_type);
return clang_type;
@@ -6099,3 +6149,61 @@
break;
}
}
+
+bool
+SymbolFileDWARF::LayoutRecordType (void *baton,
+ const clang::RecordDecl *record_decl,
+ uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap &field_offsets,
+ llvm::DenseMap &base_offsets,
+ llvm::DenseMap &vbase_offsets)
+{
+ SymbolFileDWARF *symbol_file_dwarf = (SymbolFileDWARF *)baton;
+ return symbol_file_dwarf->LayoutRecordType (record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets);
+}
+
+
+bool
+SymbolFileDWARF::LayoutRecordType (const clang::RecordDecl *record_decl,
+ uint64_t &bit_size,
+ uint64_t &alignment,
+ llvm::DenseMap &field_offsets,
+ llvm::DenseMap &base_offsets,
+ llvm::DenseMap &vbase_offsets)
+{
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+ RecordDeclToLayoutMap::iterator pos = m_record_decl_to_layout_map.find (record_decl);
+ bool success = false;
+ base_offsets.clear();
+ vbase_offsets.clear();
+ if (pos != m_record_decl_to_layout_map.end())
+ {
+ bit_size = pos->second.bit_size;
+ alignment = pos->second.alignment;
+ field_offsets.swap(pos->second.field_offsets);
+ m_record_decl_to_layout_map.erase(pos);
+ success = true;
+ }
+ else
+ {
+ bit_size = 0;
+ alignment = 0;
+ field_offsets.clear();
+ }
+
+ if (log)
+ GetObjectFile()->GetModule()->LogMessage (log.get(),
+ "SymbolFileDWARF::LayoutRecordType (record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u],base_offsets[%u], vbase_offsets[%u]) success = %i",
+ record_decl,
+ bit_size,
+ alignment,
+ (uint32_t)field_offsets.size(),
+ (uint32_t)base_offsets.size(),
+ (uint32_t)vbase_offsets.size(),
+ success);
+ return success;
+}
+
+
+
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=149160&r1=149159&r2=149160&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Jan 27 18:48:57 2012
@@ -18,6 +18,7 @@
#include
// Other libraries and framework includes
+#include "clang/AST/CharUnits.h"
#include "clang/AST/ExternalASTSource.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -141,6 +142,39 @@
clang::DeclarationName Name,
llvm::SmallVectorImpl *results);
+ static bool
+ LayoutRecordType (void *baton,
+ const clang::RecordDecl *record_decl,
+ uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap &field_offsets,
+ llvm::DenseMap &base_offsets,
+ llvm::DenseMap &vbase_offsets);
+
+ bool
+ LayoutRecordType (const clang::RecordDecl *record_decl,
+ uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap &field_offsets,
+ llvm::DenseMap &base_offsets,
+ llvm::DenseMap &vbase_offsets);
+
+ struct LayoutInfo
+ {
+ LayoutInfo () :
+ bit_size(0),
+ alignment(0),
+ field_offsets()//,
+ //base_offsets(), // We don't need to fill in the base classes, this can be done automatically
+ //vbase_offsets() // We don't need to fill in the virtual base classes, this can be done automatically
+ {
+ }
+ uint64_t bit_size;
+ uint64_t alignment;
+ llvm::DenseMap field_offsets;
+// llvm::DenseMap base_offsets;
+// llvm::DenseMap vbase_offsets;
+ };
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
@@ -307,7 +341,8 @@
std::vector& member_accessibilities,
DWARFDIECollection& member_function_dies,
lldb::AccessType &default_accessibility,
- bool &is_a_class);
+ bool &is_a_class,
+ LayoutInfo &layout_info);
size_t ParseChildParameters(
const lldb_private::SymbolContext& sc,
@@ -518,12 +553,14 @@
typedef llvm::DenseMap DIEToVariableSP;
typedef llvm::DenseMap DIEToClangType;
typedef llvm::DenseMap ClangTypeToDIE;
+ typedef llvm::DenseMap RecordDeclToLayoutMap;
DIEToDeclContextMap m_die_to_decl_ctx;
DeclContextToDIEMap m_decl_ctx_to_die;
DIEToTypePtr m_die_to_type;
DIEToVariableSP m_die_to_variable_sp;
DIEToClangType m_forward_decl_die_to_clang_type;
ClangTypeToDIE m_forward_decl_clang_type_to_die;
+ RecordDeclToLayoutMap m_record_decl_to_layout_map;
};
#endif // SymbolFileDWARF_SymbolFileDWARF_h_
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=149160&r1=149159&r2=149160&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri Jan 27 18:48:57 2012
@@ -83,6 +83,7 @@
new ClangExternalASTSourceCallbacks (SymbolFileDWARFDebugMap::CompleteTagDecl,
SymbolFileDWARFDebugMap::CompleteObjCInterfaceDecl,
NULL,
+ SymbolFileDWARFDebugMap::LayoutRecordType,
this));
GetClangASTContext().SetExternalSource (ast_source_ap);
@@ -1146,6 +1147,27 @@
}
}
+bool
+SymbolFileDWARFDebugMap::LayoutRecordType (void *baton,
+ const clang::RecordDecl *record_decl,
+ uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap &field_offsets,
+ llvm::DenseMap &base_offsets,
+ llvm::DenseMap &vbase_offsets)
+{
+ SymbolFileDWARFDebugMap *symbol_file_dwarf = (SymbolFileDWARFDebugMap *)baton;
+ SymbolFileDWARF *oso_dwarf;
+ for (uint32_t oso_idx = 0; ((oso_dwarf = symbol_file_dwarf->GetSymbolFileByOSOIndex (oso_idx)) != NULL); ++oso_idx)
+ {
+ if (oso_dwarf->LayoutRecordType (record_decl, size, alignment, field_offsets, base_offsets, vbase_offsets))
+ return true;
+ }
+ return false;
+}
+
+
+
clang::DeclContext*
SymbolFileDWARFDebugMap::GetClangDeclContextContainingTypeUID (lldb::user_id_t type_uid)
{
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=149160&r1=149159&r2=149160&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Fri Jan 27 18:48:57 2012
@@ -13,6 +13,9 @@
#include
#include
+
+#include "clang/AST/CharUnits.h"
+
#include "lldb/Symbol/SymbolFile.h"
#include "UniqueDWARFASTType.h"
@@ -90,6 +93,16 @@
static void
CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
+
+ static bool
+ LayoutRecordType (void *baton,
+ const clang::RecordDecl *record_decl,
+ uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap &field_offsets,
+ llvm::DenseMap &base_offsets,
+ llvm::DenseMap &vbase_offsets);
+
//------------------------------------------------------------------
// PluginInterface protocol
From gclayton at apple.com Fri Jan 27 19:40:47 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 28 Jan 2012 01:40:47 -0000
Subject: [Lldb-commits] [lldb] r149165 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj
tools/debugserver/debugserver.xcodeproj/project.pbxproj
Message-ID: <20120128014047.5CC2E1BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 19:40:47 2012
New Revision: 149165
URL: http://llvm.org/viewvc/llvm-project?rev=149165&view=rev
Log:
Xcode codesigning is broken. Work around this by doing code signing in a shell script build phase.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=149165&r1=149164&r2=149165&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 27 19:40:47 2012
@@ -2947,6 +2947,7 @@
buildPhases = (
26DC6A0D1337FE6900FF7998 /* Sources */,
26DC6A0E1337FE6900FF7998 /* Frameworks */,
+ 261CE9C014D327DE006D8EFE /* Codesign */,
);
buildRules = (
);
@@ -3078,6 +3079,20 @@
shellPath = /bin/sh;
shellScript = "cd \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nfor file in *.h\ndo\n\t/usr/bin/sed -i '' 's/\\(#include\\)[ ]*\"lldb\\/\\(API\\/\\)\\{0,1\\}\\(.*\\)\"/\\1 /1' \"$file\"\n\t/usr/bin/sed -i '' 's|
Author: gclayton
Date: Fri Jan 27 20:11:02 2012
New Revision: 149166
URL: http://llvm.org/viewvc/llvm-project?rev=149166&view=rev
Log:
Stop running so many individual commands when going into the script interpreter.
All of the commands now get globbed into a single line.
lldb.target, lldb.process, lldb.thread and lldb.frame now get initialized with
empty SBTarget, SBProcess, SBThread and SBFrame objects when they don't contain
anything.
Modified:
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=149166&r1=149165&r2=149166&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Fri Jan 27 20:11:02 2012
@@ -327,64 +327,36 @@
StreamString run_string;
- run_string.Printf ("run_one_line (%s, 'lldb.debugger_unique_id = %llu')", m_dictionary_name.c_str(),
- GetCommandInterpreter().GetDebugger().GetID());
- PyRun_SimpleString (run_string.GetData());
- run_string.Clear();
-
+ run_string.Printf ( "run_one_line (%s, 'lldb.debugger_unique_id = %llu", m_dictionary_name.c_str(), GetCommandInterpreter().GetDebugger().GetID());
+ run_string.Printf ( "; lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%llu)", GetCommandInterpreter().GetDebugger().GetID());
+ run_string.PutCString ("; lldb.target = lldb.debugger.GetSelectedTarget()");
+ run_string.PutCString ("; lldb.process = lldb.target.GetProcess()");
+ run_string.PutCString ("; lldb.thread = lldb.process.GetSelectedThread ()");
+ run_string.PutCString ("; lldb.frame = lldb.thread.GetSelectedFrame ()");
+ // Make sure STDIN is closed since when we run this as an embedded
+ // interpreter we don't want someone to call "line = sys.stdin.readline()"
+ // and lock up. We don't have multiple windows and when the interpreter is
+ // embedded we don't know we should be feeding input to the embedded
+ // interpreter or to the python sys.stdin. We also don't want to let python
+ // play with the real stdin from this process, so we need to close it...
+ run_string.PutCString ("; sys.stdin.close()");
+ run_string.PutCString ("')");
- run_string.Printf ("run_one_line (%s, 'lldb.debugger = lldb.SBDebugger.FindDebuggerWithID (%llu)')",
- m_dictionary_name.c_str(),
- GetCommandInterpreter().GetDebugger().GetID());
- PyRun_SimpleString (run_string.GetData());
- run_string.Clear();
-
-
- ExecutionContext exe_ctx (m_interpreter.GetDebugger().GetSelectedExecutionContext());
-
- if (exe_ctx.GetTargetPtr())
- run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.debugger.GetSelectedTarget()')",
- m_dictionary_name.c_str());
- else
- run_string.Printf ("run_one_line (%s, 'lldb.target = lldb.SBTarget()')", m_dictionary_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- run_string.Clear();
-
- if (exe_ctx.GetProcessPtr())
- run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.target.GetProcess()')", m_dictionary_name.c_str());
- else
- run_string.Printf ("run_one_line (%s, 'lldb.process = lldb.SBProcess()')", m_dictionary_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- run_string.Clear();
-
- if (exe_ctx.GetThreadPtr())
- run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.process.GetSelectedThread ()')",
- m_dictionary_name.c_str());
- else
- run_string.Printf ("run_one_line (%s, 'lldb.thread = lldb.SBThread()')", m_dictionary_name.c_str());
- PyRun_SimpleString (run_string.GetData());
- run_string.Clear();
-
- if (exe_ctx.GetFramePtr())
- run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.thread.GetSelectedFrame ()')",
- m_dictionary_name.c_str());
- else
- run_string.Printf ("run_one_line (%s, 'lldb.frame = lldb.SBFrame()')", m_dictionary_name.c_str());
PyRun_SimpleString (run_string.GetData());
run_string.Clear();
PyObject *sysmod = PyImport_AddModule ("sys");
PyObject *sysdict = PyModule_GetDict (sysmod);
- if ((m_new_sysout != NULL)
- && (sysmod != NULL)
- && (sysdict != NULL))
- PyDict_SetItemString (sysdict, "stdout", (PyObject*)m_new_sysout);
+ if (m_new_sysout && sysmod && sysdict)
+ {
+ PyDict_SetItemString (sysdict, "stdout", (PyObject*)m_new_sysout);
+ PyDict_SetItemString (sysdict, "stderr", (PyObject*)m_new_sysout);
+ }
if (PyErr_Occurred())
PyErr_Clear ();
-}
-
+}
bool
ScriptInterpreterPython::ExecuteOneLine (const char *command, CommandReturnObject *result)
From gclayton at apple.com Fri Jan 27 20:22:27 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 28 Jan 2012 02:22:27 -0000
Subject: [Lldb-commits] [lldb] r149167 -
/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Message-ID: <20120128022227.B92A42A6C12C@llvm.org>
Author: gclayton
Date: Fri Jan 27 20:22:27 2012
New Revision: 149167
URL: http://llvm.org/viewvc/llvm-project?rev=149167&view=rev
Log:
Added logging so we can see the field names and offsets of any structures
for when we enable the assisted layout.
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=149167&r1=149166&r2=149167&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Jan 27 20:22:27 2012
@@ -1922,15 +1922,25 @@
const clang::RecordDecl *record_decl = record_type->getDecl();
if (log)
+ {
GetObjectFile()->GetModule()->LogMessage (log.get(),
- "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u],base_offsets[0], vbase_offsets[0])",
+ "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) caching layout info for record_decl = %p, bit_size = %llu, alignment = %llu, field_offsets[%u], base_offsets[0], vbase_offsets[0])",
clang_type,
record_decl,
layout_info.bit_size,
layout_info.alignment,
(uint32_t)layout_info.field_offsets.size());
-
+ llvm::DenseMap ::const_iterator pos, end = layout_info.field_offsets.end();
+ for (pos = layout_info.field_offsets.begin(); pos != end; ++pos)
+ {
+ GetObjectFile()->GetModule()->LogMessage (log.get(),
+ "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (clang_type = %p) field = { bit_offset=%u, name='%s' }",
+ clang_type,
+ (uint32_t)pos->second,
+ pos->first->getNameAsString().c_str());
+ }
+ }
m_record_decl_to_layout_map.insert(std::make_pair(record_decl, layout_info));
}
}
From gclayton at apple.com Fri Jan 27 20:48:10 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 28 Jan 2012 02:48:10 -0000
Subject: [Lldb-commits] [lldb] r149168 - in /lldb/trunk:
lldb.xcodeproj/project.pbxproj resources/LLDB-Info.plist
tools/debugserver/debugserver.xcodeproj/project.pbxproj
Message-ID: <20120128024810.E53461BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 20:48:10 2012
New Revision: 149168
URL: http://llvm.org/viewvc/llvm-project?rev=149168&view=rev
Log:
Bumping Xcode project versions for lldb-109 and debugserver-167.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/resources/LLDB-Info.plist
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=149168&r1=149167&r2=149168&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 27 20:48:10 2012
@@ -3748,9 +3748,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- CURRENT_PROJECT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 108;
+ DYLIB_CURRENT_VERSION = 109;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3808,10 +3808,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
- CURRENT_PROJECT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 108;
+ DYLIB_CURRENT_VERSION = 109;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3867,8 +3867,8 @@
2689FFD513353D7A00698AC0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 108;
- DYLIB_CURRENT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
+ DYLIB_CURRENT_VERSION = 109;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3896,8 +3896,8 @@
2689FFD613353D7A00698AC0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 108;
- DYLIB_CURRENT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
+ DYLIB_CURRENT_VERSION = 109;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -3925,8 +3925,8 @@
2689FFD713353D7A00698AC0 /* BuildAndIntegration */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 108;
- DYLIB_CURRENT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
+ DYLIB_CURRENT_VERSION = 109;
EXECUTABLE_EXTENSION = a;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4006,7 +4006,7 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4037,10 +4037,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
DEAD_CODE_STRIPPING = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 108;
+ DYLIB_CURRENT_VERSION = 109;
EXPORTED_SYMBOLS_FILE = "resources/lldb-framework-exports";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -4278,7 +4278,7 @@
26F5C26C10F3D9A5009D5894 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
@@ -4308,7 +4308,7 @@
26F5C26D10F3D9A5009D5894 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CURRENT_PROJECT_VERSION = 108;
+ CURRENT_PROJECT_VERSION = 109;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks\"",
Modified: lldb/trunk/resources/LLDB-Info.plist
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/resources/LLDB-Info.plist?rev=149168&r1=149167&r2=149168&view=diff
==============================================================================
--- lldb/trunk/resources/LLDB-Info.plist (original)
+++ lldb/trunk/resources/LLDB-Info.plist Fri Jan 27 20:48:10 2012
@@ -17,7 +17,7 @@
CFBundleSignature
????
CFBundleVersion
- 108
+ 109
CFBundleName
${EXECUTABLE_NAME}
Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=149168&r1=149167&r2=149168&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Jan 27 20:48:10 2012
@@ -490,7 +490,7 @@
i386,
);
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 166;
+ CURRENT_PROJECT_VERSION = 167;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = "";
@@ -509,7 +509,7 @@
x86_64,
i386,
);
- CURRENT_PROJECT_VERSION = 166;
+ CURRENT_PROJECT_VERSION = 167;
DEAD_CODE_STRIPPING = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -530,7 +530,7 @@
x86_64,
i386,
);
- CURRENT_PROJECT_VERSION = 166;
+ CURRENT_PROJECT_VERSION = 167;
DEAD_CODE_STRIPPING = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@@ -549,7 +549,7 @@
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 166;
+ CURRENT_PROJECT_VERSION = 167;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
@@ -589,7 +589,7 @@
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 166;
+ CURRENT_PROJECT_VERSION = 167;
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
"$(SDKROOT)/System/Library/PrivateFrameworks",
@@ -628,7 +628,7 @@
"ARCHS[sdk=iphoneos*]" = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]" = "source/debugserver-entitlements.plist";
COPY_PHASE_STRIP = YES;
- CURRENT_PROJECT_VERSION = 166;
+ CURRENT_PROJECT_VERSION = 167;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = $SDKROOT/System/Library/PrivateFrameworks;
"FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*][arch=*]" = (
From gclayton at apple.com Fri Jan 27 20:51:43 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 28 Jan 2012 02:51:43 -0000
Subject: [Lldb-commits] [lldb] r149169 - /lldb/tags/lldb-109/
Message-ID: <20120128025143.B61F81BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 20:51:43 2012
New Revision: 149169
URL: http://llvm.org/viewvc/llvm-project?rev=149169&view=rev
Log:
lldb-109
Added:
lldb/tags/lldb-109/
- copied from r149168, lldb/trunk/
From gclayton at apple.com Fri Jan 27 21:14:56 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sat, 28 Jan 2012 03:14:56 -0000
Subject: [Lldb-commits] [lldb] r149170 - in /lldb/tags/lldb-109:
lldb.xcodeproj/project.pbxproj
tools/debugserver/debugserver.xcodeproj/project.pbxproj
Message-ID: <20120128031456.9F4E71BE003@llvm.org>
Author: gclayton
Date: Fri Jan 27 21:14:56 2012
New Revision: 149170
URL: http://llvm.org/viewvc/llvm-project?rev=149170&view=rev
Log:
Removing the code signing shell script build phase as it isn't properly detecting
BuildAndIntegration builds.
Modified:
lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj
lldb/tags/lldb-109/tools/debugserver/debugserver.xcodeproj/project.pbxproj
Modified: lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj?rev=149170&r1=149169&r2=149170&view=diff
==============================================================================
--- lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/tags/lldb-109/lldb.xcodeproj/project.pbxproj Fri Jan 27 21:14:56 2012
@@ -2947,7 +2947,6 @@
buildPhases = (
26DC6A0D1337FE6900FF7998 /* Sources */,
26DC6A0E1337FE6900FF7998 /* Frameworks */,
- 261CE9C014D327DE006D8EFE /* Codesign */,
);
buildRules = (
);
@@ -3079,20 +3078,6 @@
shellPath = /bin/sh;
shellScript = "cd \"${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}\"\nfor file in *.h\ndo\n\t/usr/bin/sed -i '' 's/\\(#include\\)[ ]*\"lldb\\/\\(API\\/\\)\\{0,1\\}\\(.*\\)\"/\\1 /1' \"$file\"\n\t/usr/bin/sed -i '' 's|
Author: jmolenda
Date: Fri Jan 27 22:19:15 2012
New Revision: 149171
URL: http://llvm.org/viewvc/llvm-project?rev=149171&view=rev
Log:
Fix shell commands that do code signing.
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=149171&r1=149170&r2=149171&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jan 27 22:19:15 2012
@@ -3091,7 +3091,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
- shellScript = "if [ $CONFIGURATION!=\"BuildAndIntegration\" ]; then\n if [ $PLATFORM_NAME=\"macosx\" ]; then\n /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"\n fi\nfi";
+ shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"; fi";
};
261EECA21337D399001D193C /* Build llvm and clang */ = {
isa = PBXShellScriptBuildPhase;
Modified: lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj?rev=149171&r1=149170&r2=149171&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/tools/debugserver/debugserver.xcodeproj/project.pbxproj Fri Jan 27 22:19:15 2012
@@ -417,7 +417,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/bin/sh -x";
- shellScript = "if [ $CONFIGURATION!=\"BuildAndIntegration\" ]; then\n if [ $PLATFORM_NAME=\"macosx\" ]; then\n /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"\n fi\nfi";
+ shellScript = "if [ $CONFIGURATION != BuildAndIntegration -a $PLATFORM_NAME = macosx ]; then /usr/bin/codesign -s lldb_codesign -f \"$TARGET_BUILD_DIR/$TARGET_NAME\"; fi";
};
26CE05C7115C36870022F371 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
From gclayton at apple.com Sun Jan 29 00:07:39 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sun, 29 Jan 2012 06:07:39 -0000
Subject: [Lldb-commits] [lldb] r149191 - in /lldb/trunk: include/lldb/API/
scripts/Python/interface/ source/API/
Message-ID: <20120129060740.040F32A6C12C@llvm.org>
Author: gclayton
Date: Sun Jan 29 00:07:39 2012
New Revision: 149191
URL: http://llvm.org/viewvc/llvm-project?rev=149191&view=rev
Log:
Added the ability to get the target triple, byte order and address byte size
from the SBTarget and SBModule interfaces. Also added many python properties
for easier access to many things from many SB objects.
Modified:
lldb/trunk/include/lldb/API/SBAddress.h
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/scripts/Python/interface/SBAddress.i
lldb/trunk/scripts/Python/interface/SBCompileUnit.i
lldb/trunk/scripts/Python/interface/SBData.i
lldb/trunk/scripts/Python/interface/SBError.i
lldb/trunk/scripts/Python/interface/SBFileSpec.i
lldb/trunk/scripts/Python/interface/SBFrame.i
lldb/trunk/scripts/Python/interface/SBFunction.i
lldb/trunk/scripts/Python/interface/SBInstruction.i
lldb/trunk/scripts/Python/interface/SBLineEntry.i
lldb/trunk/scripts/Python/interface/SBModule.i
lldb/trunk/scripts/Python/interface/SBProcess.i
lldb/trunk/scripts/Python/interface/SBSection.i
lldb/trunk/scripts/Python/interface/SBTarget.i
lldb/trunk/scripts/Python/interface/SBThread.i
lldb/trunk/scripts/Python/interface/SBType.i
lldb/trunk/scripts/Python/interface/SBValue.i
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBTarget.cpp
Modified: lldb/trunk/include/lldb/API/SBAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBAddress.h?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBAddress.h (original)
+++ lldb/trunk/include/lldb/API/SBAddress.h Sun Jan 29 00:07:39 2012
@@ -76,6 +76,9 @@
lldb::SBSection
GetSection ();
+ lldb::addr_t
+ GetOffset ();
+
lldb::SBModule
GetModule ();
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Sun Jan 29 00:07:39 2012
@@ -73,6 +73,15 @@
bool
SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
+ lldb::ByteOrder
+ GetByteOrder ();
+
+ uint32_t
+ GetAddressByteSize();
+
+ const char *
+ GetTriple ();
+
#ifndef SWIG
const uint8_t *
GetUUIDBytes () const;
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Sun Jan 29 00:07:39 2012
@@ -269,6 +269,15 @@
lldb::SBModule
FindModule (const lldb::SBFileSpec &file_spec);
+ lldb::ByteOrder
+ GetByteOrder ();
+
+ uint32_t
+ GetAddressByteSize();
+
+ const char *
+ GetTriple ();
+
//------------------------------------------------------------------
/// Set the base load address for a module section.
///
Modified: lldb/trunk/scripts/Python/interface/SBAddress.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBAddress.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBAddress.i (original)
+++ lldb/trunk/scripts/Python/interface/SBAddress.i Sun Jan 29 00:07:39 2012
@@ -82,6 +82,9 @@
lldb::SBSection
GetSection ();
+ lldb::addr_t
+ SBAddress::GetOffset ();
+
%feature("docstring", "
//------------------------------------------------------------------
/// GetSymbolContext() and the following can lookup symbol information for a given address.
@@ -124,6 +127,37 @@
lldb::SBLineEntry
GetLineEntry ();
+
+ %pythoncode %{
+ __swig_getmethods__["module"] = GetModule
+ if _newclass: x = property(GetModule, None)
+
+ __swig_getmethods__["compile_unit"] = GetCompileUnit
+ if _newclass: x = property(GetCompileUnit, None)
+
+ __swig_getmethods__["line_entry"] = GetLineEntry
+ if _newclass: x = property(GetLineEntry, None)
+
+ __swig_getmethods__["function"] = GetFunction
+ if _newclass: x = property(GetFunction, None)
+
+ __swig_getmethods__["block"] = GetBlock
+ if _newclass: x = property(GetBlock, None)
+
+ __swig_getmethods__["symbol"] = GetSymbol
+ if _newclass: x = property(GetSymbol, None)
+
+ __swig_getmethods__["offset"] = GetOffset
+ if _newclass: x = property(GetOffset, None)
+
+ __swig_getmethods__["section"] = GetSection
+ if _newclass: x = property(GetSection, None)
+
+ __swig_getmethods__["file_addr"] = GetFileAddress
+ if _newclass: x = property(GetFileAddress, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBCompileUnit.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCompileUnit.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBCompileUnit.i (original)
+++ lldb/trunk/scripts/Python/interface/SBCompileUnit.i Sun Jan 29 00:07:39 2012
@@ -79,6 +79,14 @@
bool
GetDescription (lldb::SBStream &description);
+
+ %pythoncode %{
+ __swig_getmethods__["file"] = GetFileSpec
+ if _newclass: x = property(GetFileSpec, None)
+
+ __swig_getmethods__["num_line_entries"] = GetNumLineEntries
+ if _newclass: x = property(GetNumLineEntries, None)
+ %}
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBData.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBData.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBData.i (original)
+++ lldb/trunk/scripts/Python/interface/SBData.i Sun Jan 29 00:07:39 2012
@@ -133,6 +133,16 @@
bool
SetDataFromDoubleArray (double* array, size_t array_len);
+ %pythoncode %{
+ __swig_getmethods__["byte_order"] = GetByteOrder
+ __swig_setmethods__["byte_order"] = SetByteOrder
+ if _newclass: x = property(GetByteOrder, SetByteOrder)
+
+ __swig_getmethods__["size"] = GetByteSize
+ if _newclass: x = property(GetByteSize, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBError.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBError.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBError.i (original)
+++ lldb/trunk/scripts/Python/interface/SBError.i Sun Jan 29 00:07:39 2012
@@ -102,6 +102,25 @@
bool
GetDescription (lldb::SBStream &description);
+
+ %pythoncode %{
+ __swig_getmethods__["value"] = GetError
+ if _newclass: x = property(GetError, None)
+
+ __swig_getmethods__["fail"] = Fail
+ if _newclass: x = property(Fail, None)
+
+ __swig_getmethods__["success"] = Success
+ if _newclass: x = property(Success, None)
+
+ __swig_getmethods__["description"] = GetCString
+ if _newclass: x = property(GetCString, None)
+
+ __swig_getmethods__["type"] = GetType
+ if _newclass: x = property(GetType, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBFileSpec.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFileSpec.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBFileSpec.i (original)
+++ lldb/trunk/scripts/Python/interface/SBFileSpec.i Sun Jan 29 00:07:39 2012
@@ -66,6 +66,18 @@
bool
GetDescription (lldb::SBStream &description) const;
+
+ %pythoncode %{
+ __swig_getmethods__["basename"] = GetFilename
+ if _newclass: x = property(GetFilename, None)
+
+ __swig_getmethods__["dirname"] = GetDirectory
+ if _newclass: x = property(GetDirectory, None)
+
+ __swig_getmethods__["exists"] = Exists
+ if _newclass: x = property(Exists, None)
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBFrame.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFrame.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBFrame.i (original)
+++ lldb/trunk/scripts/Python/interface/SBFrame.i Sun Jan 29 00:07:39 2012
@@ -217,7 +217,52 @@
bool
GetDescription (lldb::SBStream &description);
+
+ %pythoncode %{
+ __swig_getmethods__["pc"] = GetPC
+ __swig_setmethods__["pc"] = SetPC
+ if _newclass: x = property(GetPC, SetPC)
+ __swig_getmethods__["fp"] = GetFP
+ if _newclass: x = property(GetFP, None)
+
+ __swig_getmethods__["sp"] = GetSP
+ if _newclass: x = property(GetSP, None)
+
+ __swig_getmethods__["module"] = GetModule
+ if _newclass: x = property(GetModule, None)
+
+ __swig_getmethods__["compile_unit"] = GetCompileUnit
+ if _newclass: x = property(GetCompileUnit, None)
+
+ __swig_getmethods__["function"] = GetFunction
+ if _newclass: x = property(GetFunction, None)
+
+ __swig_getmethods__["symbol"] = GetSymbol
+ if _newclass: x = property(GetSymbol, None)
+
+ __swig_getmethods__["block"] = GetBlock
+ if _newclass: x = property(GetBlock, None)
+
+ __swig_getmethods__["is_inlined"] = IsInlined
+ if _newclass: x = property(IsInlined, None)
+
+ __swig_getmethods__["name"] = GetFunctionName
+ if _newclass: x = property(GetFunctionName, None)
+
+ __swig_getmethods__["line_entry"] = GetLineEntry
+ if _newclass: x = property(GetLineEntry, None)
+
+ __swig_getmethods__["thread"] = GetThread
+ if _newclass: x = property(GetThread, None)
+
+ __swig_getmethods__["disassembly"] = Disassemble
+ if _newclass: x = property(Disassemble, None)
+
+ __swig_getmethods__["idx"] = GetFrameID
+ if _newclass: x = property(GetFrameID, None)
+
+ %}
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBFunction.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFunction.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBFunction.i (original)
+++ lldb/trunk/scripts/Python/interface/SBFunction.i Sun Jan 29 00:07:39 2012
@@ -76,6 +76,25 @@
bool
GetDescription (lldb::SBStream &description);
+
+ %pythoncode %{
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["mangled"] = GetMangledName
+ if _newclass: x = property(GetMangledName, None)
+
+ __swig_getmethods__["start_addr"] = GetStartAddress
+ if _newclass: x = property(GetStartAddress, None)
+
+ __swig_getmethods__["end_addr"] = GetEndAddress
+ if _newclass: x = property(GetEndAddress, None)
+
+ __swig_getmethods__["prologue_size"] = GetPrologueByteSize
+ if _newclass: x = property(GetPrologueByteSize, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBInstruction.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBInstruction.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBInstruction.i (original)
+++ lldb/trunk/scripts/Python/interface/SBInstruction.i Sun Jan 29 00:07:39 2012
@@ -62,6 +62,19 @@
bool
TestEmulation (lldb::SBStream &output_stream, const char *test_file);
+
+ %pythoncode %{
+ __swig_getmethods__["addr"] = GetAddress
+ if _newclass: x = property(GetAddress, None)
+
+ __swig_getmethods__["size"] = GetByteSize
+ if _newclass: x = property(GetByteSize, None)
+
+ __swig_getmethods__["is_branch"] = DoesBranch
+ if _newclass: x = property(DoesBranch, None)
+ %}
+
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBLineEntry.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBLineEntry.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBLineEntry.i (original)
+++ lldb/trunk/scripts/Python/interface/SBLineEntry.i Sun Jan 29 00:07:39 2012
@@ -77,6 +77,24 @@
void
SetColumn (uint32_t column);
+ %pythoncode %{
+ __swig_getmethods__["file"] = GetFileSpec
+ if _newclass: x = property(GetFileSpec, None)
+
+ __swig_getmethods__["line"] = GetLine
+ if _newclass: x = property(GetLine, None)
+
+ __swig_getmethods__["column"] = GetColumn
+ if _newclass: x = property(GetColumn, None)
+
+ __swig_getmethods__["start_addr"] = GetStartAddress
+ if _newclass: x = property(GetStartAddress, None)
+
+ __swig_getmethods__["end_addr"] = GetEndAddress
+ if _newclass: x = property(GetEndAddress, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Sun Jan 29 00:07:39 2012
@@ -236,6 +236,43 @@
FindGlobalVariables (lldb::SBTarget &target,
const char *name,
uint32_t max_matches);
+
+ lldb::ByteOrder
+ GetByteOrder ();
+
+ uint32_t
+ GetAddressByteSize();
+
+ const char *
+ GetTriple ();
+
+ %pythoncode %{
+ __swig_getmethods__["file"] = GetFileSpec
+ if _newclass: x = property(GetFileSpec, None)
+
+ __swig_getmethods__["platform_file"] = GetPlatformFileSpec
+ if _newclass: x = property(GetPlatformFileSpec, None)
+
+ __swig_getmethods__["uuid"] = GetUUIDString
+ if _newclass: x = property(GetUUIDString, None)
+
+ __swig_getmethods__["byte_order"] = GetByteOrder
+ if _newclass: x = property(GetByteOrder, None)
+
+ __swig_getmethods__["addr_size"] = GetAddressByteSize
+ if _newclass: x = property(GetAddressByteSize, None)
+
+ __swig_getmethods__["triple"] = GetTriple
+ if _newclass: x = property(GetTriple, None)
+
+ __swig_getmethods__["num_symbols"] = GetNumSymbols
+ if _newclass: x = property(GetNumSymbols, None)
+
+ __swig_getmethods__["num_sections"] = GetNumSections
+ if _newclass: x = property(GetNumSections, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBProcess.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBProcess.i (original)
+++ lldb/trunk/scripts/Python/interface/SBProcess.i Sun Jan 29 00:07:39 2012
@@ -281,6 +281,33 @@
lldb::SBError
UnloadImage (uint32_t image_token);
+ %pythoncode %{
+ __swig_getmethods__["id"] = GetProcessID
+ if _newclass: x = property(GetProcessID, None)
+
+ __swig_getmethods__["target"] = GetTarget
+ if _newclass: x = property(GetTarget, None)
+
+ __swig_getmethods__["num_threads"] = GetNumThreads
+ if _newclass: x = property(GetNumThreads, None)
+
+ __swig_getmethods__["selected_thread"] = GetSelectedThread
+ __swig_setmethods__["selected_thread"] = SetSelectedThread
+ if _newclass: x = property(GetSelectedThread, SetSelectedThread)
+
+ __swig_getmethods__["state"] = GetState
+ if _newclass: x = property(GetState, None)
+
+ __swig_getmethods__["exit_state"] = GetExitStatus
+ if _newclass: x = property(GetExitStatus, None)
+
+ __swig_getmethods__["exit_description"] = GetExitDescription
+ if _newclass: x = property(GetExitDescription, None)
+
+ __swig_getmethods__["broadcaster"] = GetBroadcaster
+ if _newclass: x = property(GetBroadcaster, None)
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBSection.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBSection.i (original)
+++ lldb/trunk/scripts/Python/interface/SBSection.i Sun Jan 29 00:07:39 2012
@@ -87,6 +87,30 @@
bool
GetDescription (lldb::SBStream &description);
+ %pythoncode %{
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["file_addr"] = GetFileAddress
+ if _newclass: x = property(GetFileAddress, None)
+
+ __swig_getmethods__["size"] = GetByteSize
+ if _newclass: x = property(GetByteSize, None)
+
+ __swig_getmethods__["file_offset"] = GetFileOffset
+ if _newclass: x = property(GetFileOffset, None)
+
+ __swig_getmethods__["file_size"] = GetFileByteSize
+ if _newclass: x = property(GetFileByteSize, None)
+
+ __swig_getmethods__["data"] = GetSectionData
+ if _newclass: x = property(GetSectionData, None)
+
+ __swig_getmethods__["type"] = GetSectionType
+ if _newclass: x = property(GetSectionType, None)
+
+ %}
+
private:
std::auto_ptr m_opaque_ap;
Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Sun Jan 29 00:07:39 2012
@@ -311,6 +311,15 @@
lldb::SBModule
FindModule (const lldb::SBFileSpec &file_spec);
+ lldb::ByteOrder
+ GetByteOrder ();
+
+ uint32_t
+ GetAddressByteSize();
+
+ const char *
+ GetTriple ();
+
lldb::SBError
SetSectionLoadAddress (lldb::SBSection section,
lldb::addr_t section_base_addr);
@@ -476,6 +485,39 @@
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
+
+ %pythoncode %{
+ __swig_getmethods__["process"] = GetProcess
+ if _newclass: x = property(GetProcess, None)
+
+ __swig_getmethods__["executable"] = GetExecutable
+ if _newclass: x = property(GetExecutable, None)
+
+ __swig_getmethods__["debugger"] = GetDebugger
+ if _newclass: x = property(GetDebugger, None)
+
+ __swig_getmethods__["file_offset"] = GetFileOffset
+ if _newclass: x = property(GetFileOffset, None)
+
+ __swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
+ if _newclass: x = property(GetNumBreakpoints, None)
+
+ __swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
+ if _newclass: x = property(GetNumWatchpoints, None)
+
+ __swig_getmethods__["broadcaster"] = GetBroadcaster
+ if _newclass: x = property(GetBroadcaster, None)
+
+ __swig_getmethods__["byte_order"] = GetByteOrder
+ if _newclass: x = property(GetByteOrder, None)
+
+ __swig_getmethods__["addr_size"] = GetAddressByteSize
+ if _newclass: x = property(GetAddressByteSize, None)
+
+ __swig_getmethods__["triple"] = GetTriple
+ if _newclass: x = property(GetTriple, None)
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBThread.i (original)
+++ lldb/trunk/scripts/Python/interface/SBThread.i Sun Jan 29 00:07:39 2012
@@ -173,6 +173,36 @@
bool
GetDescription (lldb::SBStream &description) const;
+
+ %pythoncode %{
+ __swig_getmethods__["id"] = GetThreadID
+ if _newclass: x = property(GetThreadID, None)
+
+ __swig_getmethods__["idx"] = GetIndexID
+ if _newclass: x = property(GetIndexID, None)
+
+ __swig_getmethods__["return_value"] = GetStopReturnValue
+ if _newclass: x = property(GetStopReturnValue, None)
+
+ __swig_getmethods__["process"] = GetProcess
+ if _newclass: x = property(GetProcess, None)
+
+ __swig_getmethods__["num_frames"] = GetNumFrames
+ if _newclass: x = property(GetNumFrames, None)
+
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["queue"] = GetQueueName
+ if _newclass: x = property(GetQueueName, None)
+
+ __swig_getmethods__["stop_reason"] = GetStopReason
+ if _newclass: x = property(GetStopReason, None)
+
+ __swig_getmethods__["is_suspended"] = IsSuspended
+ if _newclass: x = property(IsSuspended, None)
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Sun Jan 29 00:07:39 2012
@@ -37,6 +37,20 @@
uint64_t
GetOffsetInBits();
+ %pythoncode %{
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["type"] = GetType
+ if _newclass: x = property(GetType, None)
+
+ __swig_getmethods__["byte_offset"] = GetOffsetInBytes
+ if _newclass: x = property(GetOffsetInBytes, None)
+
+ __swig_getmethods__["bit_offset"] = GetOffsetInBits
+ if _newclass: x = property(GetOffsetInBits, None)
+ %}
+
protected:
std::auto_ptr m_opaque_ap;
};
@@ -174,6 +188,33 @@
lldb::TypeClass
GetTypeClass ();
+
+ %pythoncode %{
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["size"] = GetByteSize
+ if _newclass: x = property(GetByteSize, None)
+
+ __swig_getmethods__["is_pointer"] = IsPointerType
+ if _newclass: x = property(IsPointerType, None)
+
+ __swig_getmethods__["is_reference"] = IsReferenceType
+ if _newclass: x = property(IsReferenceType, None)
+
+ __swig_getmethods__["num_fields"] = GetNumberOfFields
+ if _newclass: x = property(GetNumberOfFields, None)
+
+ __swig_getmethods__["num_bases"] = GetNumberOfDirectBaseClasses
+ if _newclass: x = property(GetNumberOfDirectBaseClasses, None)
+
+ __swig_getmethods__["num_vbases"] = GetNumberOfVirtualBaseClasses
+ if _newclass: x = property(GetNumberOfVirtualBaseClasses, None)
+
+ __swig_getmethods__["class"] = GetTypeClass
+ if _newclass: x = property(GetTypeClass, None)
+ %}
+
};
%feature("docstring",
Modified: lldb/trunk/scripts/Python/interface/SBValue.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBValue.i?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBValue.i (original)
+++ lldb/trunk/scripts/Python/interface/SBValue.i Sun Jan 29 00:07:39 2012
@@ -362,6 +362,82 @@
) GetExpressionPath;
bool
GetExpressionPath (lldb::SBStream &description, bool qualify_cxx_base_classes);
+
+ %pythoncode %{
+
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["type"] = GetType
+ if _newclass: x = property(GetType, None)
+
+ __swig_getmethods__["size"] = GetByteSize
+ if _newclass: x = property(GetByteSize, None)
+
+ __swig_getmethods__["name"] = GetName
+ if _newclass: x = property(GetName, None)
+
+ __swig_getmethods__["is_in_scope"] = IsInScope
+ if _newclass: x = property(IsInScope, None)
+
+ __swig_getmethods__["format"] = GetFormat
+ __swig_setmethods__["format"] = SetFormat
+ if _newclass: x = property(GetName, SetFormat)
+
+ __swig_getmethods__["value"] = GetValue
+ __swig_setmethods__["value"] = SetValueFromCString
+ if _newclass: x = property(GetValue, SetValueFromCString)
+
+ __swig_getmethods__["value_type"] = GetValueType
+ if _newclass: x = property(GetValueType, None)
+
+ __swig_getmethods__["changed"] = GetValueDidChange
+ if _newclass: x = property(GetValueDidChange, None)
+
+ __swig_getmethods__["data"] = GetData
+ if _newclass: x = property(GetData, None)
+
+ __swig_getmethods__["load_addr"] = GetLoadAddress
+ if _newclass: x = property(GetLoadAddress, None)
+
+ __swig_getmethods__["addr"] = GetAddress
+ if _newclass: x = property(GetAddress, None)
+
+ __swig_getmethods__["deref"] = Dereference
+ if _newclass: x = property(Dereference, None)
+
+ __swig_getmethods__["address_of"] = AddressOf
+ if _newclass: x = property(AddressOf, None)
+
+ __swig_getmethods__["error"] = GetError
+ if _newclass: x = property(GetError, None)
+
+ __swig_getmethods__["summary"] = GetSummary
+ if _newclass: x = property(GetSummary, None)
+
+ __swig_getmethods__["description"] = GetObjectDescription
+ if _newclass: x = property(GetObjectDescription, None)
+
+ __swig_getmethods__["location"] = GetLocation
+ if _newclass: x = property(GetLocation, None)
+
+ __swig_getmethods__["target"] = GetTarget
+ if _newclass: x = property(GetTarget, None)
+
+ __swig_getmethods__["process"] = GetProcess
+ if _newclass: x = property(GetProcess, None)
+
+ __swig_getmethods__["thread"] = GetThread
+ if _newclass: x = property(GetThread, None)
+
+ __swig_getmethods__["frame"] = GetFrame
+ if _newclass: x = property(GetFrame, None)
+
+ __swig_getmethods__["num_children"] = GetNumChildren
+ if _newclass: x = property(GetNumChildren, None)
+
+ %}
+
};
} // namespace lldb
Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Sun Jan 29 00:07:39 2012
@@ -229,6 +229,13 @@
return sb_section;
}
+lldb::addr_t
+SBAddress::GetOffset ()
+{
+ if (m_opaque_ap.get())
+ m_opaque_ap->GetAddress().GetOffset();
+ return 0;
+}
Address *
SBAddress::operator->()
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Sun Jan 29 00:07:39 2012
@@ -475,3 +475,34 @@
return sb_section;
}
+lldb::ByteOrder
+SBModule::GetByteOrder ()
+{
+ if (m_opaque_sp)
+ return m_opaque_sp->GetArchitecture().GetByteOrder();
+ return eByteOrderInvalid;
+}
+
+const char *
+SBModule::GetTriple ()
+{
+ if (m_opaque_sp)
+ {
+ std::string triple (m_opaque_sp->GetArchitecture().GetTriple().str());
+ // Unique the string so we don't run into ownership issues since
+ // the const strings put the string into the string pool once and
+ // the strings never comes out
+ ConstString const_triple (triple.c_str());
+ return const_triple.GetCString();
+ }
+ return NULL;
+}
+
+uint32_t
+SBModule::GetAddressByteSize()
+{
+ if (m_opaque_sp)
+ return m_opaque_sp->GetArchitecture().GetAddressByteSize();
+ return sizeof(void*);
+}
+
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=149191&r1=149190&r2=149191&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Sun Jan 29 00:07:39 2012
@@ -1113,6 +1113,38 @@
return sb_module;
}
+lldb::ByteOrder
+SBTarget::GetByteOrder ()
+{
+ if (m_opaque_sp)
+ return m_opaque_sp->GetArchitecture().GetByteOrder();
+ return eByteOrderInvalid;
+}
+
+const char *
+SBTarget::GetTriple ()
+{
+ if (m_opaque_sp)
+ {
+ std::string triple (m_opaque_sp->GetArchitecture().GetTriple().str());
+ // Unique the string so we don't run into ownership issues since
+ // the const strings put the string into the string pool once and
+ // the strings never comes out
+ ConstString const_triple (triple.c_str());
+ return const_triple.GetCString();
+ }
+ return NULL;
+}
+
+uint32_t
+SBTarget::GetAddressByteSize()
+{
+ if (m_opaque_sp)
+ return m_opaque_sp->GetArchitecture().GetAddressByteSize();
+ return sizeof(void*);
+}
+
+
SBModule
SBTarget::GetModuleAtIndex (uint32_t idx)
{
From gclayton at apple.com Sun Jan 29 01:09:30 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sun, 29 Jan 2012 07:09:30 -0000
Subject: [Lldb-commits] [lldb] r149192 -
/lldb/trunk/scripts/Python/interface/SBTarget.i
Message-ID: <20120129070930.53C642A6C12C@llvm.org>
Author: gclayton
Date: Sun Jan 29 01:09:30 2012
New Revision: 149192
URL: http://llvm.org/viewvc/llvm-project?rev=149192&view=rev
Log:
Removed an incorrectly added property from SBTarget.i
Modified:
lldb/trunk/scripts/Python/interface/SBTarget.i
Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=149192&r1=149191&r2=149192&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Sun Jan 29 01:09:30 2012
@@ -496,9 +496,6 @@
__swig_getmethods__["debugger"] = GetDebugger
if _newclass: x = property(GetDebugger, None)
- __swig_getmethods__["file_offset"] = GetFileOffset
- if _newclass: x = property(GetFileOffset, None)
-
__swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
if _newclass: x = property(GetNumBreakpoints, None)
From gclayton at apple.com Sun Jan 29 14:56:32 2012
From: gclayton at apple.com (Greg Clayton)
Date: Sun, 29 Jan 2012 20:56:32 -0000
Subject: [Lldb-commits] [lldb] r149207 - in /lldb/trunk: include/lldb/
include/lldb/Breakpoint/ include/lldb/Core/ include/lldb/Expression/
include/lldb/Interpreter/ include/lldb/Symbol/ include/lldb/Target/
include/lldb/Utility/ lldb.xcodeproj/xcshareddata/xcschemes/ source/
source/API/ source/Breakpoint/ source/Commands/ source/Core/
source/Expression/ source/Interpreter/ source/Plugins/Disassembler/llvm/
source/Plugins/DynamicLoader/MacOSX-DYLD/
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/
source/Plugins/ObjectConta...
Message-ID: <20120129205633.2020D2A6C12C@llvm.org>
Author: gclayton
Date: Sun Jan 29 14:56:30 2012
New Revision: 149207
URL: http://llvm.org/viewvc/llvm-project?rev=149207&view=rev
Log:
Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared
pointer from just a pointer, which is also easily solved using the
std::tr1::enable_shared_from_this class.
The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.
So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).
Modified:
lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Core/FormatClasses.h
lldb/trunk/include/lldb/Core/FormatManager.h
lldb/trunk/include/lldb/Core/FormatNavigator.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Core/SearchFilter.h
lldb/trunk/include/lldb/Core/SourceManager.h
lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
lldb/trunk/include/lldb/Expression/ClangUserExpression.h
lldb/trunk/include/lldb/Interpreter/Args.h
lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/Target/Memory.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/RegisterContext.h
lldb/trunk/include/lldb/Target/StackFrame.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/include/lldb/Target/ThreadList.h
lldb/trunk/include/lldb/Utility/PriorityPointerPair.h
lldb/trunk/include/lldb/lldb-forward-rtti.h
lldb/trunk/include/lldb/lldb-types.h
lldb/trunk/lldb.xcodeproj/xcshareddata/xcschemes/lldb-tool.xcscheme
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBBreakpointLocation.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBFunction.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBSection.cpp
lldb/trunk/source/API/SBSymbol.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/Breakpoint/Breakpoint.cpp
lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
lldb/trunk/source/Breakpoint/BreakpointSite.cpp
lldb/trunk/source/Commands/CommandObjectArgs.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Core/AddressRange.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/Disassembler.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Core/ModuleList.cpp
lldb/trunk/source/Core/SearchFilter.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectMemory.cpp
lldb/trunk/source/Expression/ClangASTSource.cpp
lldb/trunk/source/Expression/ClangFunction.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/source/Expression/ClangUtilityFunction.cpp
lldb/trunk/source/Expression/IRInterpreter.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCSymbolVendor.cpp
lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDPLog.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.h
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp
lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h
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/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/trunk/source/Symbol/ObjectFile.cpp
lldb/trunk/source/Symbol/Symbol.cpp
lldb/trunk/source/Symbol/SymbolVendor.cpp
lldb/trunk/source/Symbol/Type.cpp
lldb/trunk/source/Symbol/Variable.cpp
lldb/trunk/source/Target/ExecutionContext.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/Target/ThreadList.cpp
lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
lldb/trunk/source/lldb-log.cpp
Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Sun Jan 29 14:56:30 2012
@@ -74,7 +74,7 @@
/// not by the breakpoint.
//----------------------------------------------------------------------
class Breakpoint:
- public ReferenceCountedBase,
+ public std::tr1::enable_shared_from_this,
public Stoppoint
{
public:
@@ -286,10 +286,6 @@
lldb::BreakpointLocationSP
GetLocationAtIndex (uint32_t index);
-
- const lldb::BreakpointSP
- GetSP ();
-
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Sun Jan 29 14:56:30 2012
@@ -47,7 +47,7 @@
//----------------------------------------------------------------------
class BreakpointLocation :
- public ReferenceCountedBase,
+ public std::tr1::enable_shared_from_this,
public StoppointLocation
{
public:
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Sun Jan 29 14:56:30 2012
@@ -39,7 +39,7 @@
//----------------------------------------------------------------------
class BreakpointSite :
- public ReferenceCountedBase,
+ public std::tr1::enable_shared_from_this,
public StoppointLocation
{
public:
@@ -159,7 +159,7 @@
/// \a owner is the Breakpoint Location to add.
//------------------------------------------------------------------
void
- AddOwner (lldb::BreakpointLocationSP &owner);
+ AddOwner (const lldb::BreakpointLocationSP &owner);
//------------------------------------------------------------------
/// This method returns the number of breakpoint locations currently
@@ -263,7 +263,7 @@
// Only the Process can create breakpoint sites in
// Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
BreakpointSite (BreakpointSiteList *list,
- lldb::BreakpointLocationSP& owner,
+ const lldb::BreakpointLocationSP& owner,
lldb::addr_t m_addr,
lldb::tid_t tid,
bool use_hardware);
Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Sun Jan 29 14:56:30 2012
@@ -435,7 +435,10 @@
/// isn't resolved yet.
//------------------------------------------------------------------
Module *
- GetModule () const;
+ GetModulePtr () const;
+
+ lldb::ModuleSP
+ GetModuleSP () const;
//------------------------------------------------------------------
/// Get const accessor for the section.
Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Sun Jan 29 14:56:30 2012
@@ -251,7 +251,7 @@
class Debugger :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public UserID,
public DebuggerInstanceSettings
{
@@ -315,9 +315,6 @@
void Clear();
- lldb::DebuggerSP
- GetSP ();
-
bool
GetAsyncExecution ();
Modified: lldb/trunk/include/lldb/Core/FormatClasses.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatClasses.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatClasses.h (original)
+++ lldb/trunk/include/lldb/Core/FormatClasses.h Sun Jan 29 14:56:30 2012
@@ -57,7 +57,7 @@
bool skipptr = false,
bool skipref = false);
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(ValueFormat) SharedPointer;
typedef bool(*ValueCallback)(void*, ConstString, const lldb::ValueFormatSP&);
~ValueFormat()
@@ -115,7 +115,7 @@
virtual void
Update() = 0;
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
};
@@ -166,7 +166,7 @@
virtual SyntheticChildrenFrontEnd::SharedPointer
GetFrontEnd(lldb::ValueObjectSP backend) = 0;
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(SyntheticChildren) SharedPointer;
typedef bool(*SyntheticChildrenCallback)(void*, ConstString, const SyntheticChildren::SharedPointer&);
};
@@ -266,7 +266,7 @@
return UINT32_MAX;
}
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
};
@@ -351,7 +351,7 @@
return m_interpreter->GetIndexOfChildWithName(m_wrapper, name.GetCString());
}
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
};
@@ -550,7 +550,7 @@
virtual uint32_t
GetIndexOfChildWithName (const ConstString &name_cs);
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(SyntheticChildrenFrontEnd) SharedPointer;
};
@@ -628,7 +628,7 @@
virtual std::string
GetDescription() = 0;
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(SummaryFormat) SharedPointer;
typedef bool(*SummaryCallback)(void*, ConstString, const lldb::SummaryFormatSP&);
typedef bool(*RegexSummaryCallback)(void*, lldb::RegularExpressionSP, const lldb::SummaryFormatSP&);
@@ -706,7 +706,7 @@
virtual std::string
GetDescription();
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(ScriptSummaryFormat) SharedPointer;
};
Modified: lldb/trunk/include/lldb/Core/FormatManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatManager.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatManager.h (original)
+++ lldb/trunk/include/lldb/Core/FormatManager.h Sun Jan 29 14:56:30 2012
@@ -154,7 +154,7 @@
const char** matching_category = NULL,
FormatCategoryItems* matching_type = NULL);
- typedef lldb::SharedPtr::Type SharedPointer;
+ typedef SHARED_PTR(FormatCategory) SharedPointer;
private:
SummaryNavigator::SharedPointer m_summary_nav;
Modified: lldb/trunk/include/lldb/Core/FormatNavigator.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatNavigator.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatNavigator.h (original)
+++ lldb/trunk/include/lldb/Core/FormatNavigator.h Sun Jan 29 14:56:30 2012
@@ -232,7 +232,7 @@
typedef typename MapType::mapped_type MapValueType;
typedef typename BackEndType::CallbackType CallbackType;
- typedef typename lldb::SharedPtr >::Type SharedPointer;
+ typedef typename std::tr1::shared_ptr > SharedPointer;
friend class FormatCategory;
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Sun Jan 29 14:56:30 2012
@@ -44,7 +44,7 @@
namespace lldb_private {
class Module :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public SymbolContextScope
{
public:
Modified: lldb/trunk/include/lldb/Core/SearchFilter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SearchFilter.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/SearchFilter.h (original)
+++ lldb/trunk/include/lldb/Core/SearchFilter.h Sun Jan 29 14:56:30 2012
@@ -281,7 +281,7 @@
public SearchFilter
{
public:
- SearchFilterForNonModuleSpecificSearches (lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
+ SearchFilterForNonModuleSpecificSearches (const lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
~SearchFilterForNonModuleSpecificSearches () {}
virtual bool
@@ -311,7 +311,7 @@
/// @param[in] module
/// The Module that limits the search.
//------------------------------------------------------------------
- SearchFilterByModule (lldb::TargetSP &targetSP,
+ SearchFilterByModule (const lldb::TargetSP &targetSP,
const FileSpec &module);
SearchFilterByModule (const SearchFilterByModule& rhs);
@@ -372,8 +372,8 @@
/// @param[in] module
/// The Module that limits the search.
//------------------------------------------------------------------
- SearchFilterByModuleList (lldb::TargetSP &targetSP,
- const FileSpecList &module_list);
+ SearchFilterByModuleList (const lldb::TargetSP &targetSP,
+ const FileSpecList &module_list);
SearchFilterByModuleList (const SearchFilterByModuleList& rhs);
@@ -433,9 +433,9 @@
/// @param[in] module
/// The Module that limits the search.
//------------------------------------------------------------------
- SearchFilterByModuleListAndCU (lldb::TargetSP &targetSP,
- const FileSpecList &module_list,
- const FileSpecList &cu_list);
+ SearchFilterByModuleListAndCU (const lldb::TargetSP &targetSP,
+ const FileSpecList &module_list,
+ const FileSpecList &cu_list);
SearchFilterByModuleListAndCU (const SearchFilterByModuleListAndCU& rhs);
Modified: lldb/trunk/include/lldb/Core/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/SourceManager.h (original)
+++ lldb/trunk/include/lldb/Core/SourceManager.h Sun Jan 29 14:56:30 2012
@@ -79,7 +79,7 @@
#endif // SWIG
- typedef lldb::SharedPtr::Type FileSP;
+ typedef std::tr1::shared_ptr FileSP;
#ifndef SWIG
Modified: lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangExpressionVariable.h Sun Jan 29 14:56:30 2012
@@ -216,7 +216,7 @@
void
TransferAddress (bool force = false);
- typedef lldb::SharedPtr::Type ValueObjectConstResultSP;
+ typedef SHARED_PTR(ValueObjectConstResult) ValueObjectConstResultSP;
//----------------------------------------------------------------------
/// Members
Modified: lldb/trunk/include/lldb/Expression/ClangUserExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangUserExpression.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangUserExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangUserExpression.h Sun Jan 29 14:56:30 2012
@@ -47,7 +47,7 @@
class ClangUserExpression : public ClangExpression
{
public:
- typedef lldb::SharedPtr::Type ClangUserExpressionSP;
+ typedef SHARED_PTR(ClangUserExpression) ClangUserExpressionSP;
//------------------------------------------------------------------
/// Constructor
Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Sun Jan 29 14:56:30 2012
@@ -30,7 +30,7 @@
typedef std::pair OptionArgValue;
typedef std::pair OptionArgPair;
typedef std::vector OptionArgVector;
-typedef lldb::SharedPtr::Type OptionArgVectorSP;
+typedef SHARED_PTR(OptionArgVector) OptionArgVectorSP;
struct OptionArgElement
{
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Sun Jan 29 14:56:30 2012
@@ -86,7 +86,7 @@
//
typedef std::vector < std::pair > NamespaceMap;
- typedef lldb::SharedPtr::Type NamespaceMapSP;
+ typedef SHARED_PTR(NamespaceMap) NamespaceMapSP;
void RegisterNamespaceMap (const clang::NamespaceDecl *decl,
NamespaceMapSP &namespace_map);
@@ -193,9 +193,9 @@
clang::ASTContext *m_source_ctx;
};
- typedef lldb::SharedPtr::Type MinionSP;
- typedef std::map MinionMap;
- typedef std::map NamespaceMetaMap;
+ typedef SHARED_PTR(Minion) MinionSP;
+ typedef std::map MinionMap;
+ typedef std::map NamespaceMetaMap;
struct ASTContextMetadata
{
@@ -216,11 +216,10 @@
MapCompleter *m_map_completer;
};
- typedef lldb::SharedPtr::Type ASTContextMetadataSP;
-
+ typedef SHARED_PTR(ASTContextMetadata) ASTContextMetadataSP;
typedef std::map ContextMetadataMap;
- ContextMetadataMap m_metadata_map;
+ ContextMetadataMap m_metadata_map;
ASTContextMetadataSP
GetContextMetadata (clang::ASTContext *dst_ctx)
Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Sun Jan 29 14:56:30 2012
@@ -78,7 +78,7 @@
inst_length (0), ptr_encoding (0), initial_row() {}
};
- typedef lldb::SharedPtr::Type CIESP;
+ typedef SHARED_PTR(CIE) CIESP;
struct FDEEntry
{
Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Sun Jan 29 14:56:30 2012
@@ -50,7 +50,7 @@
/// this abstract class.
//----------------------------------------------------------------------
class ObjectFile:
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public PluginInterface,
public ModuleChild
{
@@ -100,9 +100,6 @@
virtual
~ObjectFile();
- lldb::ObjectFileSP
- GetSP ();
-
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Sun Jan 29 14:56:30 2012
@@ -21,7 +21,7 @@
namespace lldb_private {
class SymbolFileType :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public UserID
{
public:
@@ -50,7 +50,7 @@
};
class Type :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public UserID
{
public:
Modified: lldb/trunk/include/lldb/Target/Memory.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Memory.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Memory.h (original)
+++ lldb/trunk/include/lldb/Target/Memory.h Sun Jan 29 14:56:30 2012
@@ -163,7 +163,7 @@
DeallocateMemory (lldb::addr_t ptr);
protected:
- typedef lldb::SharedPtr::Type AllocatedBlockSP;
+ typedef std::tr1::shared_ptr AllocatedBlockSP;
AllocatedBlockSP
AllocatePage (uint32_t byte_size,
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Sun Jan 29 14:56:30 2012
@@ -1263,7 +1263,7 @@
/// @brief A plug-in interface definition class for debugging a process.
//----------------------------------------------------------------------
class Process :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public UserID,
public Broadcaster,
public ExecutionContextScope,
@@ -2769,7 +2769,7 @@
ClearBreakpointSiteByID (lldb::user_id_t break_id);
lldb::break_id_t
- CreateBreakpointSite (lldb::BreakpointLocationSP &owner,
+ CreateBreakpointSite (const lldb::BreakpointLocationSP &owner,
bool use_hardware);
Error
@@ -2997,9 +2997,6 @@
virtual void
CalculateExecutionContext (ExecutionContext &exe_ctx);
- lldb::ProcessSP
- GetSP ();
-
void
SetSTDIOFileDescriptor (int file_descriptor);
Modified: lldb/trunk/include/lldb/Target/RegisterContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/RegisterContext.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/RegisterContext.h (original)
+++ lldb/trunk/include/lldb/Target/RegisterContext.h Sun Jan 29 14:56:30 2012
@@ -20,6 +20,7 @@
namespace lldb_private {
class RegisterContext :
+ public std::tr1::enable_shared_from_this,
public ExecutionContextScope
{
public:
Modified: lldb/trunk/include/lldb/Target/StackFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/StackFrame.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/StackFrame.h (original)
+++ lldb/trunk/include/lldb/Target/StackFrame.h Sun Jan 29 14:56:30 2012
@@ -27,7 +27,7 @@
namespace lldb_private {
class StackFrame :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public ExecutionContextScope
{
public:
@@ -166,9 +166,6 @@
virtual void
CalculateExecutionContext (ExecutionContext &exe_ctx);
- lldb::StackFrameSP
- GetSP ();
-
bool
GetStatus (Stream &strm,
bool show_frame_info,
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Sun Jan 29 14:56:30 2012
@@ -246,7 +246,7 @@
// Target
//----------------------------------------------------------------------
class Target :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public Broadcaster,
public ExecutionContextScope,
public TargetInstanceSettings
@@ -340,9 +340,6 @@
const lldb::ProcessSP &
GetProcessSP () const;
- lldb::TargetSP
- GetSP();
-
void
Destroy();
@@ -912,7 +909,7 @@
StopHook (lldb::TargetSP target_sp, lldb::user_id_t uid);
friend class Target;
};
- typedef lldb::SharedPtr::Type StopHookSP;
+ typedef SHARED_PTR(StopHook) StopHookSP;
// Add an empty stop hook to the Target's stop hook list, and returns a shared pointer to it in new_hook.
// Returns the id of the new hook.
Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Sun Jan 29 14:56:30 2012
@@ -85,7 +85,7 @@
};
class Thread :
- public ReferenceCountedBaseVirtual,
+ public std::tr1::enable_shared_from_this,
public UserID,
public ExecutionContextScope,
public ThreadInstanceSettings
@@ -233,9 +233,6 @@
lldb::StateType
GetState() const;
- lldb::ThreadSP
- GetSP ();
-
void
SetState (lldb::StateType state);
@@ -769,6 +766,7 @@
protected:
friend class ThreadPlan;
+ friend class ThreadList;
friend class StackFrameList;
// This is necessary to make sure thread assets get destroyed while the thread is still in good shape
Modified: lldb/trunk/include/lldb/Target/ThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadList.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadList.h Sun Jan 29 14:56:30 2012
@@ -59,6 +59,9 @@
void
Clear();
+ void
+ Destroy();
+
// Note that "idx" is not the same as the "thread_index". It is a zero
// based index to accessing the current threads, whereas "thread_index"
// is a unique index assigned
Modified: lldb/trunk/include/lldb/Utility/PriorityPointerPair.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/PriorityPointerPair.h?rev=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/PriorityPointerPair.h (original)
+++ lldb/trunk/include/lldb/Utility/PriorityPointerPair.h Sun Jan 29 14:56:30 2012
@@ -30,7 +30,7 @@
typedef T& reference_type;
typedef T* pointer_type;
- typedef typename lldb::SharedPtr::Type T_SP;
+ typedef typename SHARED_PTR(T) T_SP;
PriorityPointerPair() :
m_high(),
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=149207&r1=149206&r2=149207&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-forward-rtti.h (original)
+++ lldb/trunk/include/lldb/lldb-forward-rtti.h Sun Jan 29 14:56:30 2012
@@ -13,84 +13,84 @@
#if defined(__cplusplus)
#include "lldb/lldb-types.h"
+#include // for std::tr1::shared_ptr
//----------------------------------------------------------------------
// lldb forward declarations
//----------------------------------------------------------------------
namespace lldb {
- typedef SharedPtr::Type ABISP;
- typedef SharedPtr::Type AddressResolverSP;
- typedef SharedPtr::Type BatonSP;
- typedef SharedPtr::Type BlockSP;
- typedef IntrusiveSharedPtr::Type BreakpointSP;
- typedef IntrusiveSharedPtr::Type BreakpointSiteSP;
- typedef IntrusiveSharedPtr::Type BreakpointLocationSP;
- typedef SharedPtr::Type BreakpointResolverSP;
- typedef SharedPtr::Type BroadcasterSP;
- typedef SharedPtr::Type ClangExpressionVariableSP;
- typedef SharedPtr::Type CommandObjectSP;
- typedef SharedPtr::Type CommunicationSP;
- typedef SharedPtr::Type ConnectionSP;
- typedef SharedPtr::Type CompUnitSP;
- typedef SharedPtr::Type DataBufferSP;
- typedef SharedPtr::Type DataExtractorSP;
- typedef IntrusiveSharedPtr::Type DebuggerSP;
- typedef SharedPtr::Type DisassemblerSP;
- typedef SharedPtr::Type DynamicLoaderSP;
- typedef SharedPtr::Type EventSP;
- typedef SharedPtr::Type FormatCategorySP;
- typedef SharedPtr::Type FunctionSP;
- typedef SharedPtr::Type InlineFunctionInfoSP;
- typedef SharedPtr::Type InputReaderSP;
- typedef SharedPtr::Type InstanceSettingsSP;
- typedef SharedPtr::Type InstructionSP;
- typedef SharedPtr::Type LanguageRuntimeSP;
- typedef SharedPtr::Type LineTableSP;
- typedef SharedPtr::Type ListenerSP;
- typedef SharedPtr::Type LogSP;
- typedef SharedPtr::Type LogChannelSP;
- typedef IntrusiveSharedPtr::Type ModuleSP;
- typedef IntrusiveSharedPtr::Type ObjectFileSP;
- typedef SharedPtr::Type OptionValueSP;
- typedef SharedPtr::Type PlatformSP;
- typedef IntrusiveSharedPtr::Type ProcessSP;
- typedef SharedPtr::Type RegisterContextSP;
- typedef SharedPtr::Type RegularExpressionSP;
- typedef SharedPtr::Type SectionSP;
- typedef SharedPtr::Type SearchFilterSP;
+ typedef std::tr1::shared_ptr ABISP;
+ typedef std::tr1::shared_ptr BatonSP;
+ typedef std::tr1::shared_ptr BlockSP;
+ typedef std::tr1::shared_ptr BreakpointSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr BreakpointSiteSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr BreakpointLocationSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr BreakpointResolverSP;
+ typedef std::tr1::shared_ptr BroadcasterSP;
+ typedef std::tr1::shared_ptr ClangExpressionVariableSP;
+ typedef std::tr1::shared_ptr CommandObjectSP;
+ typedef std::tr1::shared_ptr CommunicationSP;
+ typedef std::tr1::shared_ptr ConnectionSP;
+ typedef std::tr1::shared_ptr CompUnitSP;
+ typedef std::tr1::shared_ptr DataBufferSP;
+ typedef std::tr1::shared_ptr DataExtractorSP;
+ typedef std::tr1::shared_ptr DebuggerSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr DisassemblerSP;
+ typedef std::tr1::shared_ptr DynamicLoaderSP;
+ typedef std::tr1::shared_ptr EventSP;
+ typedef std::tr1::shared_ptr FormatCategorySP;
+ typedef std::tr1::shared_ptr FunctionSP;
+ typedef std::tr1::shared_ptr InlineFunctionInfoSP;
+ typedef std::tr1::shared_ptr InputReaderSP;
+ typedef std::tr1::shared_ptr InstanceSettingsSP;
+ typedef std::tr1::shared_ptr InstructionSP;
+ typedef std::tr1::shared_ptr LanguageRuntimeSP;
+ typedef std::tr1::shared_ptr LineTableSP;
+ typedef std::tr1::shared_ptr ListenerSP;
+ typedef std::tr1::shared_ptr LogSP;
+ typedef std::tr1::shared_ptr LogChannelSP;
+ typedef std::tr1::shared_ptr ModuleSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr ObjectFileSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr OptionValueSP;
+ typedef std::tr1::shared_ptr PlatformSP;
+ typedef std::tr1::shared_ptr ProcessSP; // make_shared_from_this
+ typedef std::tr1::shared_ptr RegisterContextSP;
+ typedef std::tr1::shared_ptr RegularExpressionSP;
+ typedef std::tr1::shared_ptr SectionSP;
+ typedef std::tr1::shared_ptr SearchFilterSP;
#ifndef LLDB_DISABLE_PYTHON
- typedef SharedPtr::Type ScriptFormatSP;
+ typedef std::tr1::shared_ptr ScriptFormatSP;
#endif // #ifndef LLDB_DISABLE_PYTHON
- typedef IntrusiveSharedPtr::Type StackFrameSP;
- typedef SharedPtr::Type StackFrameListSP;
- typedef SharedPtr::Type StopInfoSP;
- typedef SharedPtr::Type StoppointLocationSP;
- typedef SharedPtr::Type StreamSP;
- typedef SharedPtr::Type StringSummaryFormatSP;
- typedef SharedPtr::Type SummaryFormatSP;
- typedef SharedPtr::Type SymbolFileSP;
- typedef IntrusiveSharedPtr::Type SymbolFileTypeSP;
- typedef SharedPtr