Re: [Lldb-commits] [PATCH] D11667: Allow ValueObject::Dereference to dereference references.

2015-07-30 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks fine.


http://reviews.llvm.org/D11667




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-30 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

A few unused things to remove and a reformat of a constructor and this is good 
to go!



Comment at: include/lldb/API/SBCommandInterpreter.h:100-102
@@ -99,2 +99,5 @@
 EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
+
+static void
+InitializeScriptInterpreter();
 

Remove unused definition


Comment at: source/API/SBCommandInterpreter.cpp:11
@@ -10,2 +10,3 @@
 #include "lldb/lldb-types.h"
+
 #include "lldb/Core/SourceManager.h"

Discard this change


Comment at: source/Interpreter/CommandInterpreter.cpp:105-121
@@ -106,24 +104,19 @@
 
-CommandInterpreter::CommandInterpreter
-(
-Debugger &debugger,
-ScriptLanguage script_language,
-bool synchronous_execution
-) :
-Broadcaster (&debugger, 
CommandInterpreter::GetStaticBroadcasterClass().AsCString()),
-Properties(OptionValuePropertiesSP(new 
OptionValueProperties(ConstString("interpreter",
-IOHandlerDelegate (IOHandlerDelegate::Completion::LLDBCommand),
-m_debugger (debugger),
-m_synchronous_execution (synchronous_execution),
-m_skip_lldbinit_files (false),
-m_skip_app_init_files (false),
-m_script_interpreter_ap (),
-m_command_io_handler_sp (),
-m_comment_char ('#'),
-m_batch_command_mode (false),
-m_truncation_warning(eNoTruncation),
-m_command_source_depth (0),
-m_num_errors(0),
-m_quit_requested(false),
-m_stopped_for_crash(false)
+CommandInterpreter::CommandInterpreter(Debugger &debugger, ScriptLanguage 
script_language, bool synchronous_execution)
+: Broadcaster(&debugger, 
CommandInterpreter::GetStaticBroadcasterClass().AsCString())
+, Properties(OptionValuePropertiesSP(new 
OptionValueProperties(ConstString("interpreter"
+, IOHandlerDelegate(IOHandlerDelegate::Completion::LLDBCommand)
+, m_debugger(debugger)
+, m_synchronous_execution(synchronous_execution)
+, m_skip_lldbinit_files(false)
+, m_skip_app_init_files(false)
+, m_script_interpreter_sp()
+, m_command_io_handler_sp()
+, m_comment_char('#')
+, m_batch_command_mode(false)
+, m_truncation_warning(eNoTruncation)
+, m_command_source_depth(0)
+, m_num_errors(0)
+, m_quit_requested(false)
+, m_stopped_for_crash(false)
 

Reformat. Please don't do the comma at the beginning of a line. 


http://reviews.llvm.org/D11431




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-30 Thread Greg Clayton
clayborg added a comment.

I have time today. I will check this out.


http://reviews.llvm.org/D11431




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-30 Thread Greg Clayton
I have time today. I will check this out.

> On Jul 30, 2015, at 10:56 AM, Zachary Turner  wrote:
> 
> zturner added a comment.
> 
> Ping.  If you don't have time to review this in detail, what do you think 
> about just going in with the change as-is, and I'll keep an eye on things and 
> make sure to be responsive to any breaks, reverting if necessary.
> 
> It's all using the plugin system now, which was your primary issue back in 
> June, so unless there's remaining issues that haven't been brought up yet, I 
> think I've addressed everything?
> 
> Compiles on Linux, Mac, and Windows, and no test regressions that I can see.
> 
> 
> http://reviews.llvm.org/D11431
> 
> 
> 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11415: Add jstopinfo support to llgs

2015-07-30 Thread Greg Clayton

> On Jul 30, 2015, at 5:09 AM, Pavel Labath  wrote:
> 
> Hello Greg, Jim,
> 
> after adding jstopinfo support to LLGS, i am still getting a bunch of
> register read packets which access the program counter. These are
> coming from Thread::SetupForResume(), where we need to check whether a
> thread is on a breakpoint before letting it run. I would like to get
> rid of those packets (my preliminary tests show I can gain about 10%
> stepping speed improvement on my test app with 20 threads). I see two
> ways to go about this:
> 1. send the program counters as a part of the jstopinfo field. I will
> need to change the format of the field a bit, because the current
> assumption is that you do not include the threads which don't have a
> stop reason there, but we need the registers for every thread.

This is what we were going to do in debugserver. So yes, add update the docs to 
say send info for all threads (except the current only in the stop reply 
packet?) and send the PC values back.

> 2. cache the registers on the client side. These queries happen after
> we have previously done a vCont:s (as a part of ThreadPlanStepOver),
> so the client can determine that the other threads have not executed,
> and the registers are unchanged. We would still avoid caching the stop
> reason, since on OSX this can change even if the thread is not
> running, but I hope the registers remain the same.

This would also be possible, but I vote for solution #1.
> 
> All in all, the first approach is probably more easier to implement,
> but the second one sounds better to me architecturally, and has the
> benefit of caching all registers, and not just the PC.
> 
> Do you have any thoughts on this?

Lets start with solution #1 and see how that works out since it will be simple.

Greg



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11641: Handle floating point and aggregate return types in SysV-mips64 ABI

2015-07-30 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks good after indentation fixes.



Comment at: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp:709-713
@@ +708,7 @@
+
+const size_t bytes_copied = r2_value.GetAsMemoryData (r2_info,
+data_sp->GetBytes(),
+r2_info->byte_size,
+target_byte_order,
+error);
+if (bytes_copied != r2_info->byte_size)

indent correctly.


Comment at: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp:722-725
@@ +721,6 @@
+const size_t bytes_copied = r3_value.GetAsMemoryData (r3_info,
+data_sp->GetBytes() + 
r2_info->byte_size,
+r3_info->byte_size,
+target_byte_order,
+error);
   
+

indent correctly.


Comment at: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp:735-737
@@ +734,5 @@
+return_valobj_sp = ValueObjectConstResult::Create (&thread, 
+
return_clang_type,
+
ConstString(""),
+return_ext);
+}

indent correctly


Comment at: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp:748-750
@@ -466,1 +747,5 @@
+return_valobj_sp = ValueObjectMemory::Create (&thread,
+  "",
+  Address (mem_address, NULL),
+  return_clang_type); 
 }

indent correctly and use ConstString("")?


Repository:
  rL LLVM

http://reviews.llvm.org/D11641




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11609: Use only unnamed pipes to launch lldb-server gdbserver.

2015-07-29 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

ok then, looks good as long the MacOSX test suite is happy.


http://reviews.llvm.org/D11609




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11609: Use only unnamed pipes to launch lldb-server gdbserver.

2015-07-29 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

This stops the fallback for Apple systems where it would try and unnamed pipe 
if we fail to create a named pipe. Please fix. It is ok to not try named pipes 
on other systems, but I would like the fallback to still work for Apple just in 
case.


http://reviews.llvm.org/D11609




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r243551 - Centralize where we update the source file contents in SourceManager::GetFile() in case APIs are called that don't update the source.

2015-07-29 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 29 13:37:25 2015
New Revision: 243551

URL: http://llvm.org/viewvc/llvm-project?rev=243551&view=rev
Log:
Centralize where we update the source file contents in SourceManager::GetFile() 
in case APIs are called that don't update the source.

The following functions were the only functions that updates the source file:

SourceManager::File::DisplaySourceLines()
SourceManager::File::FindLinesMatchingRegex()

But there we API calls that were using the SourceManager::File and asking it 
questions, like "is line 12 valid" and that might respond incorrectly if the 
source file had been updated.




Modified:
lldb/trunk/include/lldb/Core/SourceManager.h
lldb/trunk/source/Core/SourceManager.cpp

Modified: lldb/trunk/include/lldb/Core/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/SourceManager.h?rev=243551&r1=243550&r2=243551&view=diff
==
--- lldb/trunk/include/lldb/Core/SourceManager.h (original)
+++ lldb/trunk/include/lldb/Core/SourceManager.h Wed Jul 29 13:37:25 2015
@@ -35,6 +35,9 @@ public:
 File (const FileSpec &file_spec, Target *target);
 ~File();
 
+void
+UpdateIfNeeded ();
+
 size_t
 DisplaySourceLines (uint32_t line,
 uint32_t context_before,

Modified: lldb/trunk/source/Core/SourceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SourceManager.cpp?rev=243551&r1=243550&r2=243551&view=diff
==
--- lldb/trunk/source/Core/SourceManager.cpp (original)
+++ lldb/trunk/source/Core/SourceManager.cpp Wed Jul 29 13:37:25 2015
@@ -83,6 +83,10 @@ SourceManager::GetFile (const FileSpec &
 if (target_sp && file_sp && file_sp->GetSourceMapModificationID() != 
target_sp->GetSourcePathMap().GetModificationID())
 file_sp.reset();
 
+// Update the file contents if needed if we found a file
+if (file_sp)
+file_sp->UpdateIfNeeded();
+
 // If file_sp is no good or it points to a non-existent file, reset it.
 if (!file_sp || !file_sp->GetFileSpec().Exists())
 {
@@ -492,8 +496,8 @@ SourceManager::File::LineIsValid (uint32
 return false;
 }
 
-size_t
-SourceManager::File::DisplaySourceLines (uint32_t line, uint32_t 
context_before, uint32_t context_after, Stream *s)
+void
+SourceManager::File::UpdateIfNeeded ()
 {
 // TODO: use host API to sign up for file modifications to anything in our
 // source cache and only update when we determine a file has been updated.
@@ -506,7 +510,11 @@ SourceManager::File::DisplaySourceLines
 m_data_sp = m_file_spec.ReadFileContents ();
 m_offsets.clear();
 }
+}
 
+size_t
+SourceManager::File::DisplaySourceLines (uint32_t line, uint32_t 
context_before, uint32_t context_after, Stream *s)
+{
 // Sanity check m_data_sp before proceeding.
 if (!m_data_sp)
 return 0;
@@ -538,14 +546,6 @@ SourceManager::File::DisplaySourceLines
 void
 SourceManager::File::FindLinesMatchingRegex (RegularExpression& regex, 
uint32_t start_line, uint32_t end_line, std::vector &match_lines)
 {
-TimeValue curr_mod_time (m_file_spec.GetModificationTime());
-if (m_mod_time != curr_mod_time)
-{
-m_mod_time = curr_mod_time;
-m_data_sp = m_file_spec.ReadFileContents ();
-m_offsets.clear();
-}
-
 match_lines.clear();
 
 if (!LineIsValid(start_line) || (end_line != UINT32_MAX && 
!LineIsValid(end_line)))


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11586: Make DWARF at_comp_dir symbolic links configurable via plugin.symbol-file.dwarf.comp-dir-symlink-paths setting.

2015-07-29 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Do you want a default value for this, or are people going to manually set this 
setting? Looks good though.


http://reviews.llvm.org/D11586




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11595: Fix issues with separate symbolfile handling

2015-07-29 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks fine.


http://reviews.llvm.org/D11595




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11519: [MIPS] Use qfThreadID if qC packet is not supported by target

2015-07-29 Thread Greg Clayton
clayborg added a comment.

That is fine for unknown or for any known OSs where the pid == tid for the main 
thread.


Repository:
  rL LLVM

http://reviews.llvm.org/D11519




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11562: [LLDB][MIPS] Added expected failure for "test disassembler settings"

2015-07-29 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Ahh.. much better.


Repository:
  rL LLVM

http://reviews.llvm.org/D11562




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11586: Make DWARF at_comp_dir symbolic links configurable via plugin.process.dwarf.symlink-paths setting.

2015-07-29 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

We need a new "symbol-file" plug-in category. Copy how we did it for "process" 
and add one for "symbol-file". The setting should be 
"plugin.symbol-file.dwarf.symlink-paths". See inlined comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:118
@@ +117,3 @@
+{
+{ "symlink-paths" , OptionValue::eTypeFileSpecList, true,  0 ,   
nullptr, nullptr, "DWARF AT_comp_dir symbolic links." },
+{  nullptr, OptionValue::eTypeInvalid , false, 0,
nullptr, nullptr, nullptr }

Is this limited only the DW_AT_comp_dir? Then we should make the setting title 
clearer. Should this be "comp-dir-symlink-paths"? Then the description should 
be  a bit more verbose: "If the DW_AT_comp_dir matches any of these paths the 
symbolic links will be resolved at DWARF parse time."


Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:341-344
@@ +340,6 @@
+const bool is_global_setting = true;
+PluginManager::CreateSettingForProcessPlugin(debugger,
+ 
GetGlobalPluginProperties()->GetValueProperties(),
+ ConstString ("Properties 
for the dwarf symbol file plug-in."),
+ is_global_setting);
+}

We need a new SymbolFile based version of 
PluginManager::CreateSettingForProcessPlugin():

```
PluginManager::CreateSettingForSymbolFilePlugin(...)
```

Please create this function and have the setting name be "symbol-file".


http://reviews.llvm.org/D11586




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11357: Resolve DW_AT_comp_dir path if it contains a symlink

2015-07-28 Thread Greg Clayton
clayborg added a comment.

So a few rules that we must follow:

- lldb_private::Module and the contained lldb_private::ObjectFile and 
lldb_private::SymbolVendor/lldb_private::SymbolFile are never associated with a 
Target or Process unless they are loaded from memory and there is no backing 
file. This would be the typical way to get a platform, but that options isn't 
available. Why? We put all modules into a global cache that means multiple 
processes can all use the same module for libc.so. So there can be no ties to a 
target/process in any fix we do.
- Since we have no target/process we must rely on static function calls in the 
platforms or settings to fix this. One option is to make a setting, something 
like "plugin.symbol-file.dwarf.symlink-paths" which could be an array that 
could contain these items. This would allow people to add new ones, but this 
doesn't limit the checks to linux only. The setting could be a dictionary where 
the key is a triple (like "*-*-linux") and the value is a string which is the 
path to convert.
- Another option is to find the platform by using the triple from the symbol 
file and then asking the platform for the list to use.

I think I like the last option, but this options doesn't guarantee that we get 
the Platform that you might have created for your process.


http://reviews.llvm.org/D11357




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11557: [LLGS] Spawned process handling cleanup

2015-07-28 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good as long as the process ID is set to invalid when the process exits?


http://reviews.llvm.org/D11557




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11557: [LLGS] Spawned process handling cleanup

2015-07-28 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Fix the m_debugged_process_sp check and this is good to go.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp:280
@@ -291,1 +279,3 @@
+// Before we try to attach, make sure we aren't already monitoring 
something else.
+if (m_debugged_process_sp)
 {

ovyalov wrote:
> We may want to check for GetID() != LLDB_INVALID_PROCESS_ID 
> becauseNativeProcessProtocol::Attach doesn't nullify native_process_sp if 
> AttachToInferior fails.
> 
> Considering how often we check something like m_debugged_process_sp && 
> (m_debugged_process_sp->GetID () != LLDB_INVALID_PROCESS_ID)" having a 
> separate method for this might be pretty convenient - we can do it in another 
> CL.
Or put ask the process to validate itself with IsBeingDebugged() or some other 
function that verifies the process is being debugged:

```
if (m_debugged_process_sp && m_debugged_process_sp->IsBeingDebugged())
```


http://reviews.llvm.org/D11557




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11176: [LLDB][MIPS] To handle SI_KERNEL generated for invalid 64 bit address

2015-07-28 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11176




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11455: [MIPS] Create Unix Signals based on target architecture

2015-07-28 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11455




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11562: [LLDB][MIPS] Added expected failure for "test disassembler settings"

2015-07-28 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

I would rather see this as an opt in based on one or more architectures:

  @skipUnlessArch(['x86-64', 'i386'])

That way we don't have to keep adding new architectures to avoid.


Repository:
  rL LLVM

http://reviews.llvm.org/D11562




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits



[Lldb-commits] [lldb] r243344 - Make sure we detect symbols in the new __DATA_DIRTY and __DATA_CONST segments and classify them correctly.

2015-07-27 Thread Greg Clayton
Author: gclayton
Date: Mon Jul 27 18:21:05 2015
New Revision: 243344

URL: http://llvm.org/viewvc/llvm-project?rev=243344&view=rev
Log:
Make sure we detect symbols in the new __DATA_DIRTY and __DATA_CONST segments 
and classify them correctly.




Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=243344&r1=243343&r2=243344&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Mon Jul 27 
18:21:05 2015
@@ -1028,6 +1028,20 @@ ObjectFileMachO::GetSegmentNameDATA()
 }
 
 const ConstString &
+ObjectFileMachO::GetSegmentNameDATA_DIRTY()
+{
+static ConstString g_segment_name ("__DATA_DIRTY");
+return g_segment_name;
+}
+
+const ConstString &
+ObjectFileMachO::GetSegmentNameDATA_CONST()
+{
+static ConstString g_segment_name ("__DATA_CONST");
+return g_segment_name;
+}
+
+const ConstString &
 ObjectFileMachO::GetSegmentNameOBJC()
 {
 static ConstString g_segment_name_OBJC ("__OBJC");
@@ -2442,10 +2456,14 @@ ObjectFileMachO::ParseSymtab ()
 
 const ConstString &g_segment_name_TEXT = GetSegmentNameTEXT();
 const ConstString &g_segment_name_DATA = GetSegmentNameDATA();
+const ConstString &g_segment_name_DATA_DIRTY = 
GetSegmentNameDATA_DIRTY();
+const ConstString &g_segment_name_DATA_CONST = 
GetSegmentNameDATA_CONST();
 const ConstString &g_segment_name_OBJC = GetSegmentNameOBJC();
 const ConstString &g_section_name_eh_frame = GetSectionNameEHFrame();
 SectionSP 
text_section_sp(section_list->FindSectionByName(g_segment_name_TEXT));
 SectionSP 
data_section_sp(section_list->FindSectionByName(g_segment_name_DATA));
+SectionSP 
data_dirty_section_sp(section_list->FindSectionByName(g_segment_name_DATA_DIRTY));
+SectionSP 
data_const_section_sp(section_list->FindSectionByName(g_segment_name_DATA_CONST));
 SectionSP 
objc_section_sp(section_list->FindSectionByName(g_segment_name_OBJC));
 SectionSP eh_frame_section_sp;
 if (text_section_sp.get())
@@ -3298,7 +3316,9 @@ ObjectFileMachO::ParseSymtab ()
 else
 
type = eSymbolTypeCode;
 }
-else if 
(symbol_section->IsDescendant(data_section_sp.get()))
+else if 
(symbol_section->IsDescendant(data_section_sp.get()) ||
+ 
symbol_section->IsDescendant(data_dirty_section_sp.get()) ||
+ 
symbol_section->IsDescendant(data_const_section_sp.get()))
 {
 if 
(symbol_sect_name && ::strstr (symbol_sect_name, "__objc") == symbol_sect_name)
 {
@@ -4148,7 +4168,9 @@ ObjectFileMachO::ParseSymtab ()
 type = eSymbolTypeCode;
 }
 else
-if 
(symbol_section->IsDescendant(data_section_sp.get()))
+if 
(symbol_section->IsDescendant(data_section_sp.get()) ||
+
symbol_section->IsDescendant(data_dirty_section_sp.get()) ||
+
symbol_section->IsDescendant(data_const_section_sp.get()))
 {
 if (symbol_sect_name && ::strstr 
(symbol_sect_name, "__objc") == symbol_sect_name)
 {

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h?rev=243344&r1=243343&r2=243344&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h Mon Jul 27 
18:21:05 2015
@@ -223,6 +223,8 @@ protected:
 llvm::MachO::mach_header m_header;
 static const lldb_private::ConstString &GetSegmentN

[Lldb-commits] [lldb] r243342 - Fix test suite. For now we can't disable C++ for expressions since the return value is returned as a reference and this test fails on MacOSX.

2015-07-27 Thread Greg Clayton
Author: gclayton
Date: Mon Jul 27 18:02:14 2015
New Revision: 243342

URL: http://llvm.org/viewvc/llvm-project?rev=243342&view=rev
Log:
Fix test suite. For now we can't disable C++ for expressions since the return 
value is returned as a reference and this test fails on MacOSX.


Modified:
lldb/trunk/test/expression_command/options/TestExprOptions.py

Modified: lldb/trunk/test/expression_command/options/TestExprOptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/options/TestExprOptions.py?rev=243342&r1=243341&r2=243342&view=diff
==
--- lldb/trunk/test/expression_command/options/TestExprOptions.py (original)
+++ lldb/trunk/test/expression_command/options/TestExprOptions.py Mon Jul 27 
18:02:14 2015
@@ -69,7 +69,7 @@ class ExprOptionsTestCase(TestBase):
 self.DebugSBValue(val)
 
 # Make sure it still works if language is set to ObjC:
-options.SetLanguage(lldb.eLanguageTypeObjC)
+options.SetLanguage(lldb.eLanguageTypeObjC_plus_plus)
 val = frame.EvaluateExpression('id my_id = 0; my_id', options)
 self.assertTrue(val.IsValid())
 self.assertTrue(val.GetError().Success())


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11543: Fix evaluation of global operators in C++

2015-07-27 Thread Greg Clayton
clayborg resigned from this revision.
clayborg removed a reviewer: clayborg.
clayborg added a comment.

I will let Sean OK this as this is his area of expertise.


http://reviews.llvm.org/D11543




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11540: Deprecate `SBValue::TypeIsPointerType`.

2015-07-27 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11540




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11533: Add SBValue::TypeIsReferenceType to SB API.

2015-07-27 Thread Greg Clayton
clayborg added a comment.

API was added that should never have made it into the SB API:

``

  bool
  SBValue::TypeIsPointerType ();

  This led to others seeing this code and thinking it was OK. Now that the 
above function is in our API we can't remove it, but we should encourage the 
use of SBValue::GetType().XXX() from here on out.


http://reviews.llvm.org/D11533




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11539: Only test ObjC expression options on Darwin.

2015-07-27 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11539




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11465: Fix "process load/unload" on android

2015-07-27 Thread Greg Clayton
clayborg added a comment.

The second platform route would probably be better because it would allow for 
Windows to load/unload images if we ever move to lldb-server on windows.


http://reviews.llvm.org/D11465




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11465: Fix "process load/unload" on android

2015-07-27 Thread Greg Clayton
clayborg added a comment.

The other alternative is to have lldb_private::Platform have a new function:

  class Platform
  {
  virtual uint32_t
  LoadImage (lldb_private::Process *process, const FileSpec &image_spec, 
Error &error);
  
  virtual Error
  UnLoadImage (lldb_private::Process *process, uint32_t image_token);
  }

Then we move the current code from Process::LoadImage() and 
Process::UnLoadImage() into PlatformPOSIX, and have new versions for 
PlatformAndroid.


http://reviews.llvm.org/D11465




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11465: Fix "process load/unload" on android

2015-07-27 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

We should add support to lldb::SBPlatform and lldb_private::Platform where we 
get the shared library extension from the platform and also fix the logic as 
noted in the inlined comments.



Comment at: test/functionalities/load_unload/TestLoadUnload.py:201-204
@@ -205,7 +200,6 @@
 
-if lldb.remote_platform:
-dylibName = os.path.join(shlib_dir, 'libloadunload_a.so')
-elif self.platformIsDarwin():
+if self.platformIsDarwin():
 dylibName = 'libloadunload_a.dylib'
 else:
 dylibName = 'libloadunload_a.so'
+

It would be great to add something to lldb::SBPlatform and 
lldb_private::Platform that allows us to get the shared library extension from 
the platform:

```
class SBPlatform
{
const char *
GetSharedLibraryExtension();
};
```

Then this code can become:

```
dylibName = "libloadunload" + platform.GetSharedLibraryExtension()




Comment at: test/functionalities/load_unload/TestLoadUnload.py:206-209
@@ +205,6 @@
+
+if lldb.remote_platform:
+dylibPath = os.path.join(shlib_dir, 'libloadunload_a.so')
+else:
+dylibPath = dylibName
+

This code should be:

```
if lldb.remote_platform:
dylibPath = os.path.join(shlib_dir, dylibName)
else:
dylibPath = dylibName
```


http://reviews.llvm.org/D11465




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11176: [LLDB][MIPS] To handle SI_KERNEL generated for invalid 64 bit address

2015-07-27 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Fix typo and good to go



Comment at: source/Plugins/Process/Linux/NativeThreadLinux.cpp:267
@@ +266,3 @@
+case SIGILL:
+ //In case of MIPS64 target, SI_KERENEL is generated for invalid 
64bit address.
+ if (info->si_signo == SIGBUS && info->si_code == SI_KERNEL)

type above: SI_KERENEL, should be SI_KERNEL


Repository:
  rL LLVM

http://reviews.llvm.org/D11176




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11176: [LLDB][MIPS] To handle SI_KERNEL generated for invalid 64 bit address

2015-07-27 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Much better.


Repository:
  rL LLVM

http://reviews.llvm.org/D11176




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11519: [MIPS] Use qfThreadID if qC packet is not supported by target

2015-07-27 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Any other OSs other than Linux have process IDs being the same as thread IDs? 
The code added should be properly made conditional based on linux and any other 
OSs where this holds true.



Comment at: 
source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp:1462-1476
@@ -1461,2 +1461,17 @@
 }
+
+// If we don't get a response for $qC, check if $qfThreadID gives us a 
result.
+if (m_curr_pid == LLDB_INVALID_PROCESS_ID)
+{
+std::vector thread_ids;
+bool sequence_mutex_unavailable;
+size_t size;
+size = GetCurrentThreadIDs (thread_ids, 
sequence_mutex_unavailable);
+if (size && sequence_mutex_unavailable == false)
+{
+m_curr_pid = thread_ids.front();
+m_curr_pid_is_valid = eLazyBoolYes;
+return m_curr_pid;
+}
+}
 }

The threads ID is not the same as a process ID on any Apple based OS. We would 
need make this check conditional based on the OSs that have thread IDs being 
the same as process IDs. Not sure if that is only linux?


Repository:
  rL LLVM

http://reviews.llvm.org/D11519




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11482: Add target setting to have the language follow the frame's CU.

2015-07-27 Thread Greg Clayton
clayborg added a comment.

So we accurately set the

In http://reviews.llvm.org/D11482#211941, @dawn wrote:

> Thank you for your review.  I was afraid you might not go for it since you 
> objected to my original frame-based patch for breakpoints, but I had hoped 
> that by having it in an option you would be OK with it. Our users (with mixed 
> Pascal and C++ code) really want this so they don't have to remember to 
> specify the language each time they go up or down the stack and want to view 
> their local variables.  Consider this scenario:
>
> Suppose a user hits a breakpoint in a Pascal function called from C++ and 
> sets the target language to Pascal so that they can evaluate their locals 
> using the Pascal FE.  Now they go up a frame into C++ and try to see their 
> locals but can't without resetting the target language (or by always 
> specifying the expr --language option).  Then they run to a BP in a C++ 
> module, same problem.
>
> Does this help explain why having such a default would be so desirable?  It 
> is how all our debuggers and gdb work.  I'm curious - how do you get around 
> this problem in Swift?


We know the language of each frame because of DWARF and we "do the right thing" 
automatically. Having the user have to do anything (set target.language, or any 
other setting) is the wrong approach.

For Swift, we have modified ClangASTType to contain a pointer union where there 
is a "clang::ASTContext *" and a "swift::ASTContext *" and still a "void *" 
that represents the type. All function calls inside the ClangASTType class then 
have code like:

  if (IsClangType())
  {
  // clang::ASTContext specific code
  }
  else if (IsSwiftType())
  {
  // clang::ASTContext specific code
  }
  
  Then no changes need to be done to any code that displays the types because 
the API of ClangASTContext takes care of things. 
  
  For expressions we detect the language from the frame (if a language wasn't 
specified with an option) and we use either the clang based expression parser 
or the Swift one based on the language.
  
  So any solution must:
  - not require intervention from the user in any way (no settings, or any 
other options on command) when switching frames
  - Evaluating expressions can use the current frame's language
  - breakpoints, if the language isn't specified, should just do the right 
thing and set the breakpoint in all languages
  
  Questions:
  - So does pascal have a native llvm/clang type system that isn't in the clang 
namespace?
  - Does pascal use types created in a clang::ASTContext or doesn't it have its 
own type system?
  - Does pascal use the clang expression parser or a native one?


Repository:
  rL LLVM

http://reviews.llvm.org/D11482




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r243180 - Use double-checked locking to avoid locking the Module mutex if we don't need to. This avoid a deadlock we were seeing in Xcode.

2015-07-24 Thread Greg Clayton
Author: gclayton
Date: Fri Jul 24 18:38:01 2015
New Revision: 243180

URL: http://llvm.org/viewvc/llvm-project?rev=243180&view=rev
Log:
Use double-checked locking to avoid locking the Module mutex if we don't need 
to. This avoid a deadlock we were seeing in Xcode.




Modified:
lldb/trunk/include/lldb/Core/Module.h
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=243180&r1=243179&r2=243180&view=diff
==
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Fri Jul 24 18:38:01 2015
@@ -10,6 +10,7 @@
 #ifndef liblldb_Module_h_
 #define liblldb_Module_h_
 
+#include 
 #include "lldb/lldb-forward.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/UUID.h"
@@ -1119,13 +1120,13 @@ protected:
 PathMappingList m_source_mappings; ///< Module specific source 
remappings for when you have debug info for a module that doesn't match where 
the sources currently are
 lldb::SectionListUP m_sections_ap; ///< Unified section list for 
module that is used by the ObjectFile and and ObjectFile instances for the 
debug info
 
-boolm_did_load_objfile:1,
-m_did_load_symbol_vendor:1,
-m_did_parse_uuid:1,
-m_did_init_ast:1;
+std::atomic   m_did_load_objfile;
+std::atomic   m_did_load_symbol_vendor;
+std::atomic   m_did_parse_uuid;
+std::atomic   m_did_init_ast;
 mutable boolm_file_has_changed:1,
 m_first_file_changed_log:1;   /// See if the 
module was modified after it was initially opened.
-
+
 //--
 /// Resolve a file or load virtual address.
 ///

Modified: lldb/trunk/source/Core/Module.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=243180&r1=243179&r2=243180&view=diff
==
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Jul 24 18:38:01 2015
@@ -399,15 +399,18 @@ Module::GetMemoryObjectFile (const lldb:
 const lldb_private::UUID&
 Module::GetUUID()
 {
-Mutex::Locker locker (m_mutex);
-if (m_did_parse_uuid == false)
+if (m_did_parse_uuid.load() == false)
 {
-ObjectFile * obj_file = GetObjectFile ();
-
-if (obj_file != NULL)
+Mutex::Locker locker (m_mutex);
+if (m_did_parse_uuid.load() == false)
 {
-obj_file->GetUUID(&m_uuid);
-m_did_parse_uuid = true;
+ObjectFile * obj_file = GetObjectFile ();
+
+if (obj_file != NULL)
+{
+obj_file->GetUUID(&m_uuid);
+m_did_parse_uuid = true;
+}
 }
 }
 return m_uuid;
@@ -416,32 +419,35 @@ Module::GetUUID()
 ClangASTContext &
 Module::GetClangASTContext ()
 {
-Mutex::Locker locker (m_mutex);
-if (m_did_init_ast == false)
+if (m_did_init_ast.load() == false)
 {
-ObjectFile * objfile = GetObjectFile();
-ArchSpec object_arch;
-if (objfile && objfile->GetArchitecture(object_arch))
-{
-m_did_init_ast = true;
-
-// LLVM wants this to be set to iOS or MacOSX; if we're working on
-// a bare-boards type image, change the triple for llvm's benefit.
-if (object_arch.GetTriple().getVendor() == llvm::Triple::Apple 
-&& object_arch.GetTriple().getOS() == llvm::Triple::UnknownOS)
-{
-if (object_arch.GetTriple().getArch() == llvm::Triple::arm || 
-object_arch.GetTriple().getArch() == llvm::Triple::aarch64 
||
-object_arch.GetTriple().getArch() == llvm::Triple::thumb)
-{
-object_arch.GetTriple().setOS(llvm::Triple::IOS);
-}
-else
+Mutex::Locker locker (m_mutex);
+if (m_did_init_ast.load() == false)
+{
+ObjectFile * objfile = GetObjectFile();
+ArchSpec object_arch;
+if (objfile && objfile->GetArchitecture(object_arch))
+{
+m_did_init_ast = true;
+
+// LLVM wants this to be set to iOS or MacOSX; if we're 
working on
+// a bare-boards type image, change the triple for llvm's 
benefit.
+if (object_arch.GetTriple().getVendor() == llvm::Triple::Apple 
+&& object_arch.GetTriple().getOS() == 
llvm::Triple::UnknownOS)
 {
-object_arch.GetTriple().setOS(llvm::Triple::MacOSX);
+if 

Re: [Lldb-commits] [PATCH] D11482: Add target setting to have the language follow the frame's CU.

2015-07-24 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

I think it is fine to add support for looking at the target.language and using 
it if set, but I don't think we need a "target.language-follows-frame" setting 
at all. We should just do the right thing. But the right thing I think it means 
just asking the frame for its expression language. See inlined comments.



Comment at: include/lldb/Target/Target.h:175-177
@@ -174,2 +174,5 @@
 
+bool
+GetLanguageFollowsFrame () const;
+
 const char *

Remove this, we shouldn't need this setting.


Comment at: include/lldb/Target/Target.h:1443-1445
@@ -1439,2 +1442,5 @@
 
+lldb::LanguageType
+GetLanguageOfSelectedFrame () const;
+
 SourceManager &

This should be on lldb_private::StackFrame and should be:

```
lldb::LanguageType
StackFrame::GetDefaultExpressionLanguage();
```


Comment at: source/Commands/CommandObjectExpression.cpp:303-312
@@ -302,8 +302,12 @@
 options.SetDebug(m_command_options.debug);
-
-// If the language was not specified, set it from target's properties
+
+// If the expression's language was not specified, check the
+// target's properties to see if a language override was set,
+// or if the language should match that of the frame.
 if (m_command_options.language != eLanguageTypeUnknown)
 options.SetLanguage(m_command_options.language);
-else
+else if (target->GetLanguage() != eLanguageTypeUnknown)
 options.SetLanguage(target->GetLanguage());
+else if (target->GetLanguageFollowsFrame())
+options.SetLanguage(target->GetLanguageOfSelectedFrame());
 

This should be:

```
if (m_command_options.language != eLanguageTypeUnknown)
options.SetLanguage(m_command_options.language);
else
{
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame)
options.SetLanguage(frame-> GetDefaultExpressionLanguage());
}





Comment at: source/Target/Target.cpp:391-395
@@ -387,2 +390,7 @@
 language = GetLanguage();
+// If the target's language override wasn't set but
+// was set to follow the selected frame, use that.
+if (language == lldb::eLanguageTypeUnknown &&
+GetLanguageFollowsFrame())
+language = GetLanguageOfSelectedFrame();
 

Remove this.


Comment at: source/Target/Target.cpp:430-434
@@ -419,2 +429,7 @@
 language = GetLanguage();
+// If the target's language override wasn't set but
+// was set to follow the selected frame, use that.
+if (language == lldb::eLanguageTypeUnknown &&
+GetLanguageFollowsFrame())
+language = GetLanguageOfSelectedFrame();
 

Remove this.


Comment at: source/Target/Target.cpp:468-472
@@ -450,3 +467,7 @@
 language = GetLanguage();
-
+// If the target's language override wasn't set but
+// was set to follow the selected frame, use that.
+if (language == lldb::eLanguageTypeUnknown &&
+GetLanguageFollowsFrame())
+language = GetLanguageOfSelectedFrame();
 

Remove this.


Comment at: source/Target/Target.cpp:2158-2178
@@ -2136,1 +2157,23 @@
 
+// Return the language of the selected frame's CU.
+lldb::LanguageType
+Target::GetLanguageOfSelectedFrame () const
+{
+LanguageType language = eLanguageTypeUnknown;
+if (m_process_sp)
+{
+ThreadSP 
sel_thread_sp(m_process_sp->GetThreadList().GetSelectedThread());
+if (sel_thread_sp)
+{
+StackFrameSP sel_frame_sp = sel_thread_sp->GetSelectedFrame();
+if (sel_frame_sp)
+{
+CompileUnit *cu = 
sel_frame_sp->GetSymbolContext(eSymbolContextCompUnit).comp_unit;
+if (cu)
+language = cu->GetLanguage();
+}
+}
+}
+return language;
+}
+

This should be moved to the StackFrame as:

```
lldb::LanguageType
StackFrame::GetDefaultExpressionLanguage();
```

And it should check if the language is form of C, C++, ObjC, or ObjC ++, then 
return ObjC++, else return the language.


Comment at: source/Target/Target.cpp:2998
@@ -2955,1 +2997,3 @@
+{ "language"   , OptionValue::eTypeLanguage  , 
false, eLanguageTypeUnknown  , NULL, NULL, "The language to use when 
interpreting expressions entered in commands." },
+{ "language-follows-frame" , OptionValue::eTypeBoolean   , 
false, false , NULL, NULL, "If the target.language is 
unknown, default to the language of the selected frame." },
 { "expr-prefix", OptionValue::eTypeFileSpec  , 
false, 0

Re: [Lldb-commits] [PATCH] D11498: Print reference values on one line.

2015-07-24 Thread Greg Clayton
clayborg resigned from this revision.
clayborg removed a reviewer: clayborg.
clayborg added a comment.

I will defer to Enrico on this one.


http://reviews.llvm.org/D11498




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-24 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good, thanks for fixing everything.


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-24 Thread Greg Clayton
I can help you figure out the Xcode stuff, it isn't too hard once you see how 
Xcode does things. I don't have many cycles right now unfortunately.

Greg

> On Jul 24, 2015, at 10:52 AM, Zachary Turner  wrote:
> 
> 
> 
> On Fri, Jul 24, 2015 at 10:42 AM Greg Clayton  wrote:
> 
> > On Jul 24, 2015, at 10:19 AM, Zachary Turner  wrote:
> >
> > zturner added a comment.
> >
> > Hi Greg,
> >
> > I wonder if this has something to do with the fact that the SWIG generation 
> > shell script is one of the build phases of LLDB.Framework as you mentioned 
> > once before here: 
> > http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006685.html.  Is 
> > it possible to change this so that the SWIG wrappers are built along with 
> > the regular source?  It seems to me like LLDBWrapPython.cpp should be 
> > compiled into Plugins/ScriptInterpreter/Python
> 
> The SWIG stuff needs to be built in your ScriptInterpreterPython static 
> library, not with LLDB.framework. The bindings just use the public API so 
> these swig bindings should be moved to where you are compiling the 
> ScriptInterpreterPython.
> 
> >
> > Or, alternatively, manually fiddle with the linker line as a last resort?
> 
> Hopefully we don't have to do this.
> 
> >  This might be a better approach for now, because moving the location of 
> > LLDBWrapPython.cpp might require changes to the shells cript and python 
> > script.  Which we can do, but it seems better as a followup CL just so that 
> > we can do things in small pieces in order to keep moving forward.
> 
> No, this needs to be done with this CL since you are extracting all python 
> stuff into a plug-in.
> >
> > I'm still a little unclear why the problem happens though.  If 
> > LLDBWrapPython.cpp is being linked into liblldb, and 
> > ScriptInterpreterPython is being built as a static library, then where are 
> > the linker errors coming from?  They're declared extern in the Python 
> > plugin, which shouldn't care that they're not visible at link time, because 
> > liblldb contains all the definitions.  What part am I missing?
> 
> Not sure. I haven't had time to get tot this yet, but the SWIG stuff should 
> be being built into the static library for ScriptInterpreterPython.
>  
> I can make this work for the CMake build, but I think I will need help 
> getting this working with the Xcode build since it requires changing build 
> phases and is not just adding / moving around source files.
> 
> Is there anyone there that has some cycles to help out with this?  I've had 
> this CL in the pipeline for close to 3 weeks (not including the time I was 
> away on vacation), so I would like to see it closed out.


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-24 Thread Greg Clayton

> On Jul 24, 2015, at 10:19 AM, Zachary Turner  wrote:
> 
> zturner added a comment.
> 
> Hi Greg,
> 
> I wonder if this has something to do with the fact that the SWIG generation 
> shell script is one of the build phases of LLDB.Framework as you mentioned 
> once before here: 
> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006685.html.  Is it 
> possible to change this so that the SWIG wrappers are built along with the 
> regular source?  It seems to me like LLDBWrapPython.cpp should be compiled 
> into Plugins/ScriptInterpreter/Python

The SWIG stuff needs to be built in your ScriptInterpreterPython static 
library, not with LLDB.framework. The bindings just use the public API so these 
swig bindings should be moved to where you are compiling the 
ScriptInterpreterPython.

> 
> Or, alternatively, manually fiddle with the linker line as a last resort?

Hopefully we don't have to do this.

>  This might be a better approach for now, because moving the location of 
> LLDBWrapPython.cpp might require changes to the shells cript and python 
> script.  Which we can do, but it seems better as a followup CL just so that 
> we can do things in small pieces in order to keep moving forward.

No, this needs to be done with this CL since you are extracting all python 
stuff into a plug-in.
> 
> I'm still a little unclear why the problem happens though.  If 
> LLDBWrapPython.cpp is being linked into liblldb, and ScriptInterpreterPython 
> is being built as a static library, then where are the linker errors coming 
> from?  They're declared extern in the Python plugin, which shouldn't care 
> that they're not visible at link time, because liblldb contains all the 
> definitions.  What part am I missing?

Not sure. I haven't had time to get tot this yet, but the SWIG stuff should be 
being built into the static library for ScriptInterpreterPython.

> 
> 
> http://reviews.llvm.org/D11431
> 
> 
> 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-24 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Please use SB API calls for expression evaluation instead of self.expect calls.



Comment at: test/expression_command/options/TestExprOptions.py:57-87
@@ +56,33 @@
+
+# -- test --language on ObjC builtin type --
+# Make sure we can evaluate the ObjC builtin type 'id':
+self.expect("expr id my_id = 0; my_id",
+substrs = ["= nil"])
+# Make sure it still works if language is set to ObjC:
+self.expect("expr -l objc -- id my_id = 0; my_id",
+substrs = ["= nil"])
+# Make sure it fails if language is set to C:
+self.expect("expr -l c -- id my_id = 0; my_id", error=True,
+startstr = "error")
+# Make sure it fails if the target's language is set to C:
+self.runCmd("settings set target.language c")
+self.expect("expr id my_id = 0; my_id", error=True,
+startstr = "error")
+self.runCmd("settings clear target.language")
+
+# -- test --language on C++ expression --
+# Make sure we can evaluate 'ns::func'.
+self.expect("expr ns::func",
+patterns = ["\(int .* = 0x.*"])
+# Make sure it still works if language is set to C++:
+self.expect("expr -l c++ -- ns::func",
+patterns = ["\(int .* = 0x.*"])
+# Make sure it fails if language is set to C:
+self.expect("expr -l c -- ns::func", error=True,
+startstr = "error")
+# Make sure it fails if the target's language is set to C:
+self.runCmd("settings set target.language c")
+self.expect("expr ns::func", error=True,
+startstr = "error")
+self.runCmd("settings clear target.language")
+

Please use SB API calls for expression evaluation instead of self.expect calls.


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r243118 - Bind to the loopback when we are expecting a connection from 127.0.0.1 so we don't set off firewall protections.

2015-07-24 Thread Greg Clayton
Author: gclayton
Date: Fri Jul 24 11:55:00 2015
New Revision: 243118

URL: http://llvm.org/viewvc/llvm-project?rev=243118&view=rev
Log:
Bind to the loopback when we are expecting a connection from 127.0.0.1 so we 
don't set off firewall protections.




Modified:
lldb/trunk/source/Host/common/Socket.cpp

Modified: lldb/trunk/source/Host/common/Socket.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=243118&r1=243117&r2=243118&view=diff
==
--- lldb/trunk/source/Host/common/Socket.cpp (original)
+++ lldb/trunk/source/Host/common/Socket.cpp Fri Jul 24 11:55:00 2015
@@ -201,12 +201,12 @@ Error Socket::TcpConnect(llvm::StringRef
 return error;
 }
 
-Error Socket::TcpListen(
-llvm::StringRef host_and_port,
-bool child_processes_inherit,
-Socket *&socket,
-Predicate* predicate,
-int backlog)
+Error
+Socket::TcpListen (llvm::StringRef host_and_port,
+   bool child_processes_inherit,
+   Socket *&socket,
+   Predicate* predicate,
+   int backlog)
 {
 std::unique_ptr listen_socket;
 NativeSocket listen_sock = kInvalidSocketValue;
@@ -237,10 +237,19 @@ Error Socket::TcpListen(
 if (!DecodeHostAndPort (host_and_port, host_str, port_str, port, &error))
 return error;
 
-SocketAddress anyaddr;
-if (anyaddr.SetToAnyAddress (family, port))
+SocketAddress bind_addr;
+bool bind_addr_success = false;
+
+// Only bind to the loopback address if we are expecting a connection from
+// localhost to avoid any firewall issues.
+if (host_str == "127.0.0.1")
+bind_addr_success = bind_addr.SetToLocalhost (family, port);
+else
+bind_addr_success = bind_addr.SetToAnyAddress (family, port);
+
+if (bind_addr_success)
 {
-int err = ::bind (listen_sock, anyaddr, anyaddr.GetLength());
+int err = ::bind (listen_sock, bind_addr, bind_addr.GetLength());
 if (err == -1)
 {
 SetLastError (error);


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-23 Thread Greg Clayton
clayborg added a comment.

There are many tests that evaluate expressions using the SB API:

  expression_command/call-restarts/TestCallThatRestarts.py
  expression_command/call-throws/TestCallThatThrows.py
  expression_command/char/TestExprsChar.py
  expression_command/formatters/TestFormatters.py
  expression_command/test/TestExprs.py
  expression_command/timeout/TestCallWithTimeout.py
  functionalities/asan/TestMemoryHistory.py
  functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
  functionalities/inline-stepping/TestInlineStepping.py
  
functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
  lang/c/stepping/TestStepAndBreakpoints.py
  lang/cpp/dynamic-value/TestDynamicValue.py
  lang/objc/blocks/TestObjCIvarsInBlocks.py
  lang/objc/objc-checker/TestObjCCheckers.py
  lang/objc/objc-class-method/TestObjCClassMethod.py
  lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
  lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
  lang/objc/objc-property/TestObjCProperty.py
  lang/objc/objc-static-method/TestObjCStaticMethod.py
  lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
  lang/objc/objc-struct-argument/TestObjCStructArgument.py
  lang/objc/objc-struct-return/TestObjCStructReturn.py
  lang/objc/objc-super/TestObjCSuper.py
  lang/swift/different_clang_flags/TestSwiftDifferentClangFlags.py
  lang/swift/expression/access_control/TestExpressionAccessControl.py
  lang/swift/expression/classes/TestExpressionInMethods.py
  lang/swift/expression/errors/TestExpressionErrors.py
  lang/swift/expression/generic/TestGenericExpressions.py
  lang/swift/expression/scopes/TestExpressionScopes.py
  lang/swift/expression/simple/TestSimpleExpressions.py
  lang/swift/expression/static/TestGenericExpressions.py
  lang/swift/file_private/TestFilePrivate.py
  lang/swift/struct_change_rerun/TestSwiftStructChangeRerun.py
  lang/swift/swiftieformatting/TestSwiftieFormatting.py
  lang/swift/variables/globals/TestSwiftGlobals.py
  lang/swift/variables/inout/TestInOutVariables.py
  lldbinline.py
  python_api/default-constructor/sb_frame.py
  python_api/frame/TestFrames.py
  python_api/value/TestValueAPI.py


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-23 Thread Greg Clayton
clayborg added a comment.

To evaluate an expression use the SB API:

  threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
  self.assertTrue(len(threads) == 1)
  thread = threads[0]
  frame = thread.GetFrameAtIndex(0)
  
  options = lldb.SBExpressionOptions()
  value = frame.EvaluateExpression ("expression blabla", options)
  self.assertTrue (value.GetError().Fail())




Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r243067 - Disable mutex error checking so it doesn't create problems with the multi-threaded test case. The error would cause an assertion that could cause lldb to crash when unl

2015-07-23 Thread Greg Clayton
Author: gclayton
Date: Thu Jul 23 18:32:08 2015
New Revision: 243067

URL: http://llvm.org/viewvc/llvm-project?rev=243067&view=rev
Log:
Disable mutex error checking so it doesn't create problems with the 
multi-threaded test case. The error would cause an assertion that could cause 
lldb to crash when unlocking a mutex returned an error because it was in use.


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=243067&r1=243066&r2=243067&view=diff
==
--- lldb/trunk/source/Host/common/Mutex.cpp (original)
+++ lldb/trunk/source/Host/common/Mutex.cpp Thu Jul 23 18:32:08 2015
@@ -27,7 +27,7 @@
 #endif
 
 // Enable extra mutex error checking
-#ifdef LLDB_CONFIGURATION_DEBUG
+#if 0 // LLDB_CONFIGURATION_DEBUG
 #define ENABLE_MUTEX_ERROR_CHECKING 1
 #include 
 #endif


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-23 Thread Greg Clayton
clayborg added a comment.

See inlined comments.



Comment at: test/expression_command/options/TestExprOptions.py:46-55
@@ +45,12 @@
+
+# FIXME: runCmd (called by expect) fails if an error is
+# returned making it impossible to add negative tests.  As a
+# workaround, we'll expect runCmd to fail using the following
+# method:
+try:
+self.expect("expression blabla",
+startstr = "unexpected value")
+self.assertTrue(false, "runCmd didn't fail")
+except:
+print "OK"
+

use self.runCmd(check=False,...) instead of self.expect(...). You should 
actually use the "lldb.SB*" API if possible unless you are explicitly trying to 
test textual output from commands. Please don't use self.expect() or 
self.runCmd() if you can use "lldb.SB*" API calls.


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-23 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

runCmd can take a named argument "check = False" that will stop the mandatory 
checking of the success of the command.



Comment at: test/expression_command/options/TestExprOptions.py:36-41
@@ +35,8 @@
+
+self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line,
+num_expected_locations=1, loc_exact=False)
+
+self.runCmd("run", RUN_SUCCEEDED)
+

Actually don't make tests that use runCmd for creating targets use the 
following code:

```
# Set debugger into synchronous mode
self.dbg.SetAsync(False)

# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)

# Set breakpoints inside and outside methods that take pointers to the 
containing struct.
lldbutil.run_break_set_by_file_and_line (self, self.source, line, 
num_expected_locations=1, loc_exact=True)

# Register our shared libraries for remote targets so they get automatically 
uploaded
arguments = None
environment = None 

# Now launch the process, and do not stop at entry point.
process = target.LaunchSimple (arguments, environment, 
self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
```


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-23 Thread Greg Clayton
clayborg added a comment.

One thing you might want to fix is to use:

  self.dbg.HandleCommand("...")

This avoids the need for the command to succeed.


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11447: Specify a language to use when parsing expressions.

2015-07-23 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11447




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11473: Add option eTypeOptionHideEmptyAggregates.

2015-07-23 Thread Greg Clayton
clayborg resigned from this revision.
clayborg removed a reviewer: clayborg.
clayborg added a comment.

I am OK if Enrico is ok with this.


http://reviews.llvm.org/D11473




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11461: Improve C++ function name handling and step-in avoid regerxp handling

2015-07-23 Thread Greg Clayton
clayborg resigned from this revision.
clayborg removed a reviewer: clayborg.
clayborg added a comment.

Jim Ingham should be included as a reviewer. I am OK if he is OK with this.


http://reviews.llvm.org/D11461




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11455: [MIPS] Create Unix Signals based on target architecture

2015-07-23 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Fix logic as suggested in the second inline code snippet.



Comment at: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:827
@@ -827,1 +826,3 @@
+SetUnixSignals(std::make_shared(
+
GetTarget().GetPlatform()->GetUnixSignals()->Create(GetTarget().GetArchitecture(;
 

UnixSignals::Create() is a static function. If this is really what you are 
intending to do this should be:

```
if (error.Success())
SetUnixSignals(UnixSignals::Create(GetTarget().GetArchitecture());
```

But this ins't the intention here. We need to ask if the platform is connected 
and if so, use the unix signals returned by the platform. It is isn't use 
UnixSignals::Create(). So this code should be:

```
if (error.Success())
{
PlatformSP platform_sp = GetTarget().GetPlatform():
if (platform_sp && platform_sp->IsConnected())
SetUnixSignals(platform_sp->GetUnixSignals());
else
SetUnixSignals(UnixSignals::Create(GetTarget().GetArchitecture());
}



Repository:
  rL LLVM

http://reviews.llvm.org/D11455




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11450: Fix Mac OS X build, debugserver version handling.

2015-07-23 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11450




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11451: Add UNUSED_IF_ASSERT_DISABLED and apply it.

2015-07-23 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11451




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11449: Handle old style 'S' packet correctly

2015-07-23 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11449




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-22 Thread Greg Clayton
clayborg added a subscriber: clayborg.
clayborg added a comment.

I'll try and take a look first thing tomorrow.

Greg


http://reviews.llvm.org/D11431




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11431: Convert ScriptInterpreters to being first-class plugins

2015-07-22 Thread Greg Clayton
I'll try and take a look first thing tomorrow.

Greg

> On Jul 22, 2015, at 5:15 PM, Zachary Turner  wrote:
> 
> zturner updated this revision to Diff 30432.
> zturner added a comment.
> 
> This gets the Xcode project mostly working.  But there is something related 
> to linking the LLDBSwig methods.  I don't know how this is setup on Mac, but 
> the code works as-is on all other platforms.
> 
> Is there any way to make this work on Mac?  It's much better and more 
> logically organized using the way I've done in this patch, so it would be a 
> shame if there's no way to make this work in the Xcode build.  Can you take a 
> look Greg?
> 
> 
> http://reviews.llvm.org/D11431
> 
> Files:
>  include/lldb/API/SBCommandInterpreter.h
>  include/lldb/API/SystemInitializerFull.h
>  include/lldb/Core/PluginManager.h
>  include/lldb/Interpreter/CommandInterpreter.h
>  include/lldb/Interpreter/PythonDataObjects.h
>  include/lldb/Interpreter/ScriptInterpreter.h
>  include/lldb/Interpreter/ScriptInterpreterNone.h
>  include/lldb/Interpreter/ScriptInterpreterPython.h
>  include/lldb/Utility/PythonPointer.h
>  include/lldb/lldb-forward.h
>  include/lldb/lldb-private-interfaces.h
>  include/lldb/lldb-python.h
>  lldb.xcodeproj/project.pbxproj
>  source/API/CMakeLists.txt
>  source/API/SBCommandInterpreter.cpp
>  source/API/SystemInitializerFull.cpp
>  source/Core/PluginManager.cpp
>  source/Host/macosx/HostInfoMacOSX.mm
>  source/Host/posix/HostInfoPosix.cpp
>  source/Initialization/SystemInitializerCommon.cpp
>  source/Interpreter/CMakeLists.txt
>  source/Interpreter/CommandInterpreter.cpp
>  source/Interpreter/PythonDataObjects.cpp
>  source/Interpreter/ScriptInterpreterNone.cpp
>  source/Interpreter/ScriptInterpreterPython.cpp
>  source/Plugins/CMakeLists.txt
>  source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
>  source/Plugins/ScriptInterpreter/CMakeLists.txt
>  source/Plugins/ScriptInterpreter/None/CMakeLists.txt
>  source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
>  source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
>  source/Plugins/ScriptInterpreter/Python/CMakeLists.txt
>  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
>  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
>  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
>  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
>  source/Plugins/ScriptInterpreter/Python/lldb-python.h
>  unittests/CMakeLists.txt
> 
> 


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242972 - Fix TestReturnValue.py after 242903 changes that added vector register return value tests. These were failing on x86_64 and i386.

2015-07-22 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 22 18:47:29 2015
New Revision: 242972

URL: http://llvm.org/viewvc/llvm-project?rev=242972&view=rev
Log:
Fix TestReturnValue.py after 242903 changes that added vector register return 
value tests. These were failing on x86_64 and i386.

It also pointed out an error in our return values where the ABI only relies on 
xmm registers, not ymm registers for vector return types.


Modified:
lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp

Modified: lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp?rev=242972&r1=242971&r2=242972&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp Wed Jul 22 
18:47:29 2015
@@ -600,13 +600,9 @@ ABISysV_i386::GetReturnValueObjectSimple
 const size_t byte_size = return_clang_type.GetByteSize(nullptr);
 if (byte_size > 0)
 {
-const RegisterInfo *vec_reg = 
reg_ctx->GetRegisterInfoByName("ymm0", 0);
+const RegisterInfo *vec_reg = 
reg_ctx->GetRegisterInfoByName("xmm0", 0);
 if (vec_reg == nullptr)
-{
-vec_reg = reg_ctx->GetRegisterInfoByName("xmm0", 0);
-if (vec_reg == nullptr)
-vec_reg = reg_ctx->GetRegisterInfoByName("mm0", 0);
-}
+vec_reg = reg_ctx->GetRegisterInfoByName("mm0", 0);
 
 if (vec_reg)
 {
@@ -637,6 +633,45 @@ ABISysV_i386::GetReturnValueObjectSimple
 }
 }
 }
+}
+else if (byte_size <= vec_reg->byte_size*2)
+{
+const RegisterInfo *vec_reg2 = 
reg_ctx->GetRegisterInfoByName("xmm1", 0);
+if (vec_reg2)
+{
+ProcessSP process_sp (thread.GetProcess());
+if (process_sp)
+{
+std::unique_ptr heap_data_ap (new 
DataBufferHeap(byte_size, 0));
+const ByteOrder byte_order = 
process_sp->GetByteOrder();
+RegisterValue reg_value;
+RegisterValue reg_value2;
+if (reg_ctx->ReadRegister(vec_reg, reg_value) && 
reg_ctx->ReadRegister(vec_reg2, reg_value2))
+{
+
+Error error;
+if (reg_value.GetAsMemoryData (vec_reg,
+   
heap_data_ap->GetBytes(),
+   
vec_reg->byte_size,
+   byte_order,
+   error) &&
+reg_value2.GetAsMemoryData (vec_reg2,
+
heap_data_ap->GetBytes() + vec_reg->byte_size,
+
heap_data_ap->GetByteSize() - vec_reg->byte_size,
+byte_order,
+error))
+{
+DataExtractor data (DataBufferSP 
(heap_data_ap.release()),
+byte_order,
+
process_sp->GetTarget().GetArchitecture().GetAddressByteSize());
+return_valobj_sp = 
ValueObjectConstResult::Create (&thread,
+   
return_clang_type,
+   
ConstString(""),
+   
data);
+}
+}
+}
+}
 }
 }
 }

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=242972&r1=242971&r2=242972&view=diff
==
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Wed Jul 22 
18:47:29 2015
@@ -758,15 +758,10 @@ ABISysV_x86_64::GetReturnValueObjectSimp

[Lldb-commits] [lldb] r242969 - Don't specify languages when setting breakpoints in C function names. We won't be able to tell from the symbol value alone what language the symbol is.

2015-07-22 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 22 18:45:52 2015
New Revision: 242969

URL: http://llvm.org/viewvc/llvm-project?rev=242969&view=rev
Log:
Don't specify languages when setting breakpoints in C function names. We won't 
be able to tell from the symbol value alone what language the symbol is.


Modified:

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=242969&r1=242968&r2=242969&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 Wed Jul 22 18:45:52 2015
@@ -420,7 +420,7 @@ ItaniumABILanguageRuntime::CreateExcepti
   
exception_names.data(),
   
exception_names.size(),
   
eFunctionNameTypeBase,
-  
eLanguageTypeC_plus_plus,
+  
eLanguageTypeUnknown,
   
eLazyBoolNo));
 
 return resolver_sp;

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=242969&r1=242968&r2=242969&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
 Wed Jul 22 18:45:52 2015
@@ -132,7 +132,7 @@ AppleObjCRuntimeV1::CreateExceptionResol
 resolver_sp.reset (new BreakpointResolverName (bkpt,
"objc_exception_throw",
eFunctionNameTypeBase,
-   eLanguageTypeObjC,
+   eLanguageTypeUnknown,
Breakpoint::Exact,
eLazyBoolNo));
 // FIXME: don't do catch yet.

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=242969&r1=242968&r2=242969&view=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
 Wed Jul 22 18:45:52 2015
@@ -714,7 +714,7 @@ AppleObjCRuntimeV2::CreateExceptionResol
 resolver_sp.reset (new BreakpointResolverName (bkpt,
"objc_exception_throw",
eFunctionNameTypeBase,
-   eLanguageTypeObjC,
+   eLanguageTypeUnknown,
Breakpoint::Exact,
eLazyBoolNo));
 // FIXME: We don't do catch breakpoints for ObjC yet.


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242928 - Improved the packet dumper to escape the response string before sending it to the response functions (find any 0x7d characters and remove it and XOR the next character

2015-07-22 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 22 15:12:58 2015
New Revision: 242928

URL: http://llvm.org/viewvc/llvm-project?rev=242928&view=rev
Log:
Improved the packet dumper to escape the response string before sending it to 
the response functions (find any 0x7d characters and remove it and XOR the next 
character with 0x20). This allows us to parse the JSON in the reply packet and 
display it correctly.


Modified:
lldb/trunk/examples/python/gdbremote.py

Modified: lldb/trunk/examples/python/gdbremote.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=242928&r1=242927&r2=242928&view=diff
==
--- lldb/trunk/examples/python/gdbremote.py (original)
+++ lldb/trunk/examples/python/gdbremote.py Wed Jul 22 15:12:58 2015
@@ -18,6 +18,7 @@
 
 import binascii
 import commands
+import json
 import math
 import optparse
 import os
@@ -535,13 +536,13 @@ def rsp_stop_reply(options, cmd, cmd_arg
 elif key == 'jthreads' or key == 'jstopinfo':
 key_value_pair[1] = binascii.unhexlify(key_value_pair[1])
 key_value_pairs.insert(0, ['signal', signo])
-print 'Stop reply:'
+print 'stop_reply():'
 dump_key_value_pairs (key_value_pairs)
 elif stop_type == 'W':
 exit_status = packet.get_hex_uint8()
-print 'exit (status=%i)' % exit_status
+print 'stop_reply(): exit (status=%i)' % exit_status
 elif stop_type == 'O':
-print 'stdout = %s' % packet.str
+print 'stop_reply(): stdout = "%s"' % packet.str
 
 
 def cmd_unknown_packet(options, cmd, args):
@@ -1031,6 +1032,42 @@ def cmd_kill(options, cmd, args):
 print 'kill_process()'
 return False
 
+def cmd_jThreadsInfo(options, cmd, args):
+print 'jThreadsInfo()'
+return False
+
+def cmd_jGetLoadedDynamicLibrariesInfos(options, cmd, args):
+print 'jGetLoadedDynamicLibrariesInfos()'
+return False
+
+def decode_packet(s, start_index = 0):
+#print '\ndecode_packet("%s")' % (s[start_index:])
+index = s.find('}', start_index)
+have_escapes = index != -1
+if have_escapes:
+normal_s = s[start_index:index]
+else:
+normal_s = s[start_index:]
+#print 'normal_s = "%s"' % (normal_s)
+if have_escapes:
+escape_char = '%c' % (ord(s[index+1]) ^ 0x20)
+#print 'escape_char for "%s" = %c' % (s[index:index+2], escape_char)
+return normal_s + escape_char + decode_packet(s, index+2)
+else:
+return normal_s
+
+def rsp_json(options, cmd, cmd_args, rsp):
+print '%s() reply:' % (cmd)
+json_tree = json.loads(rsp)
+print json.dumps(json_tree, indent=4, separators=(',', ': '))
+
+
+def rsp_jGetLoadedDynamicLibrariesInfos(options, cmd, cmd_args, rsp):
+if cmd_args:
+rsp_json(options, cmd, cmd_args, rsp)
+else:
+rsp_ok_means_supported(options, cmd, cmd_args, rsp)
+
 gdb_remote_commands = {
 '\\?' : { 'cmd' : cmd_stop_reply, 'rsp' : 
rsp_stop_reply  , 'name' : "stop reply pacpket"},
 'qThreadStopInfo' : { 'cmd' : cmd_qThreadStopInfo   , 'rsp' : 
rsp_stop_reply  , 'name' : "stop reply pacpket"},
@@ -1071,6 +1108,8 @@ gdb_remote_commands = {
 'z'   : { 'cmd' : cmd_bp, 'rsp' : 
rsp_ok_means_success, 'name' : "clear breakpoint or watchpoint" },
 'Z'   : { 'cmd' : cmd_bp, 'rsp' : 
rsp_ok_means_success, 'name' : "set breakpoint or watchpoint" },
 'k'   : { 'cmd' : cmd_kill  , 'rsp' : 
rsp_stop_reply  , 'name' : "kill process" },
+'jThreadsInfo': { 'cmd' : cmd_jThreadsInfo  , 'rsp' : 
rsp_json, 'name' : "JSON get all threads info" },
+'jGetLoadedDynamicLibrariesInfos:' : { 'cmd' : 
cmd_jGetLoadedDynamicLibrariesInfos, 'rsp' : 
rsp_jGetLoadedDynamicLibrariesInfos, 'name' : 'JSON get loaded dynamic 
libraries' },
 }
 
 def calculate_mean_and_standard_deviation(floats):
@@ -1109,6 +1148,7 @@ def parse_gdb_log(file, options):
 packet_name_regex = re.compile('([A-Za-z_]+)[^a-z]')
 packet_transmit_name_regex = re.compile('(?Psend|read) packet: 
(?P.*)')
 packet_contents_name_regex = re.compile('\$([^#]+)#[0-9a-fA-F]{2}')
+packet_checksum_regex = re.compile('.*#[0-9a-fA-F]{2}$')
 packet_names_regex_str = '(' + '|'.join(gdb_remote_commands.keys()) + 
')(.*)';
 packet_names_regex = re.compile(packet_names_regex_str);
 
@@ -1123,7 +1163,13 @@ def parse_gdb_log(file, options):
 last_command_args = None
 last_command_packet = None
 hide_next_response = False
-for line in lines:
+num_lines = len(lines)
+skip_count = 0
+for (line_index, line) in enumerate(lines):
+# See if we need to skip any lines
+if skip_count > 0:
+skip_count -= 1
+continu

[Lldb-commits] [lldb] r242918 - Fix warnings related to virtual functions not being marked as override.

2015-07-22 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 22 13:16:05 2015
New Revision: 242918

URL: http://llvm.org/viewvc/llvm-project?rev=242918&view=rev
Log:
Fix warnings related to virtual functions not being marked as override.


Modified:
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h?rev=242918&r1=242917&r2=242918&view=diff
==
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h Wed Jul 
22 13:16:05 2015
@@ -94,20 +94,20 @@ public:
 return false;
 }
 
-virtual lldb_private::ConstString
-GetPluginName()
+lldb_private::ConstString
+GetPluginName() override
 {
 return GetPluginNameStatic();
 }
 
-virtual uint32_t
-GetPluginVersion()
+uint32_t
+GetPluginVersion()  override
 {
 return 1;
 }
 
 bool
-SetTargetTriple (const ArchSpec &arch);
+SetTargetTriple (const ArchSpec &arch)  override;
 
 enum Mode
 {
@@ -148,8 +148,8 @@ public:
 //{
 //}
 
-virtual bool
-SupportsEmulatingInstructionsOfType (InstructionType inst_type)
+bool
+SupportsEmulatingInstructionsOfType (InstructionType inst_type)  override
 {
 return SupportsEmulatingInstructionsOfTypeStatic (inst_type);
 }
@@ -157,27 +157,26 @@ public:
 virtual bool
 SetArchitecture (const ArchSpec &arch);
 
-virtual bool 
-ReadInstruction ();
+bool
+ReadInstruction ()  override;
 
-virtual bool
-SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, 
Target *target);
+bool
+SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, 
Target *target)  override;
 
-virtual bool
-EvaluateInstruction (uint32_t evaluate_options);
+bool
+EvaluateInstruction (uint32_t evaluate_options) override;
 
 bool
 IsInstructionConditional() override;
 
-virtual bool
-TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary 
*test_data);
+bool
+TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary 
*test_data)  override;
 
-virtual bool
-GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num, 
RegisterInfo ®_info);
-
+bool
+GetRegisterInfo (lldb::RegisterKind reg_kind, uint32_t reg_num, 
RegisterInfo ®_info)  override;
 
-virtual bool
-CreateFunctionEntryUnwind (UnwindPlan &unwind_plan);
+bool
+CreateFunctionEntryUnwind (UnwindPlan &unwind_plan) override;
 
 uint32_t
 ArchVersion();


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242917 - Don't water JSONGenerator objects down into ObjectSP's too early so that we can call member functions specific to dictionaries and arrays without calling GetAsDictionar

2015-07-22 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 22 13:15:30 2015
New Revision: 242917

URL: http://llvm.org/viewvc/llvm-project?rev=242917&view=rev
Log:
Don't water JSONGenerator objects down into ObjectSP's too early so that we can 
call member functions specific to dictionaries and arrays without calling 
GetAsDictionary() or GetAsArray() on them.


Modified:
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=242917&r1=242916&r2=242917&view=diff
==
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Wed Jul 22 
13:15:30 2015
@@ -288,7 +288,7 @@ MachProcess::GetTSDAddressForThread (nub
 JSONGenerator::ObjectSP
 MachProcess::GetLoadedDynamicLibrariesInfos (nub_process_t pid, nub_addr_t 
image_list_address, nub_addr_t image_count)
 {
-JSONGenerator::ObjectSP reply_sp;
+JSONGenerator::DictionarySP reply_sp;
 
 int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};
 struct kinfo_proc processInfo;
@@ -497,53 +497,53 @@ MachProcess::GetLoadedDynamicLibrariesIn
   Thrid, format all of the above in the JSONGenerator object.
 
 
-JSONGenerator::ObjectSP image_infos_array_sp (new 
JSONGenerator::Array());
+JSONGenerator::ArraySP image_infos_array_sp (new 
JSONGenerator::Array());
 for (size_t i = 0; i < image_count; i++)
 {
-JSONGenerator::ObjectSP image_info_dict_sp (new 
JSONGenerator::Dictionary());
-image_info_dict_sp->GetAsDictionary()->AddIntegerItem 
("load_address", image_infos[i].load_address);
-image_info_dict_sp->GetAsDictionary()->AddIntegerItem ("mod_date", 
image_infos[i].mod_date);
-image_info_dict_sp->GetAsDictionary()->AddStringItem ("pathname", 
image_infos[i].pathname);
+JSONGenerator::DictionarySP image_info_dict_sp (new 
JSONGenerator::Dictionary());
+image_info_dict_sp->AddIntegerItem ("load_address", 
image_infos[i].load_address);
+image_info_dict_sp->AddIntegerItem ("mod_date", 
image_infos[i].mod_date);
+image_info_dict_sp->AddStringItem ("pathname", 
image_infos[i].pathname);
 
 uuid_string_t uuidstr;
 uuid_unparse_upper (image_infos[i].uuid, uuidstr);
-image_info_dict_sp->GetAsDictionary()->AddStringItem ("uuid", 
uuidstr);
+image_info_dict_sp->AddStringItem ("uuid", uuidstr);
 
-JSONGenerator::ObjectSP mach_header_dict_sp (new 
JSONGenerator::Dictionary());
-mach_header_dict_sp->GetAsDictionary()->AddIntegerItem ("magic", 
image_infos[i].mach_header.magic);
-mach_header_dict_sp->GetAsDictionary()->AddIntegerItem ("cputype", 
image_infos[i].mach_header.cputype);
-mach_header_dict_sp->GetAsDictionary()->AddIntegerItem 
("cpusubtype", image_infos[i].mach_header.cpusubtype);
-mach_header_dict_sp->GetAsDictionary()->AddIntegerItem 
("filetype", image_infos[i].mach_header.filetype);
+JSONGenerator::DictionarySP mach_header_dict_sp (new 
JSONGenerator::Dictionary());
+mach_header_dict_sp->AddIntegerItem ("magic", 
image_infos[i].mach_header.magic);
+mach_header_dict_sp->AddIntegerItem ("cputype", 
image_infos[i].mach_header.cputype);
+mach_header_dict_sp->AddIntegerItem ("cpusubtype", 
image_infos[i].mach_header.cpusubtype);
+mach_header_dict_sp->AddIntegerItem ("filetype", 
image_infos[i].mach_header.filetype);
 
 //  DynamicLoaderMacOSX doesn't currently need these fields, so don't 
send them.
-//mach_header_dict_sp->GetAsDictionary()->AddIntegerItem ("ncmds", 
image_infos[i].mach_header.ncmds);
-//mach_header_dict_sp->GetAsDictionary()->AddIntegerItem 
("sizeofcmds", image_infos[i].mach_header.sizeofcmds);
-//mach_header_dict_sp->GetAsDictionary()->AddIntegerItem ("flags", 
image_infos[i].mach_header.flags);
-image_info_dict_sp->GetAsDictionary()->AddItem ("mach_header", 
mach_header_dict_sp);
+//mach_header_dict_sp->AddIntegerItem ("ncmds", 
image_infos[i].mach_header.ncmds);
+//mach_header_dict_sp->AddIntegerItem ("sizeofcmds", 
image_infos[i].mach_header.sizeofcmds);
+//mach_header_dict_sp->AddIntegerItem ("flags", 
image_infos[i].mach_header.flags);
+image_info_dict_sp->AddItem ("mach_header", mach_header_dict_sp);
 
-JSONGenerator::ObjectSP segments_sp (new JSONGenerator::Array());
+JSONGenerator::ArraySP segments_sp (new JSONGenerator::Array());
 for (size_t j = 0; j < image_infos[i].segments.size(); j++)
 {
-JSONGenerator::ObjectSP segment_sp (new 
JSONGenerator::Dictionary());
- 

Re: [Lldb-commits] [PATCH] D11415: Add jstopinfo support to llgs

2015-07-22 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11415




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11404: Fix warnings.

2015-07-22 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks fine.


http://reviews.llvm.org/D11404




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11176: [LLDB][MIPS] To handle SI_KERENEL generated for invalid 64 bit address

2015-07-22 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

So we are putting non-posix crash reasons into POSIX? Seems wrong to me. Seems 
like this should be detected in the linux specific code before letting a 
CrashReason.cpp crash reason if this is linux specific.


Repository:
  rL LLVM

http://reviews.llvm.org/D11176




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11404: Fix warnings.

2015-07-22 Thread Greg Clayton
clayborg added a comment.

You might want to put comments on your "(void)unused_variable;" lines to let 
people know it is there to make sure that we don't get unused variable warnings 
so people know not to take them out. It might be a good idea to make a macro 
that would make this more clear. Maybe something in lldb-defines.h like:

#define UNUSED_IF_ASSERT_DISABLED(x) ((void)(x))


http://reviews.llvm.org/D11404




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11390: Optimize GetCompileUnitContainingDIE with a lookup table

2015-07-21 Thread Greg Clayton
clayborg commandeered this revision.
clayborg edited reviewers, added: tberghammer; removed: clayborg.
clayborg added a comment.

I actually checked my changes in with:

% svn commit
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
Transmitting file data .
Committed revision 242852.


http://reviews.llvm.org/D11390




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11119: Specify a language to use when parsing breakpoint identifiers.

2015-07-21 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good as long as the test suite is happy. I worry about MacOSX tests.


Repository:
  rL LLVM

http://reviews.llvm.org/D9




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11390: Optimize GetCompileUnitContainingDIE with a lookup table

2015-07-21 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

No need for an extra map. A local C++ guru a while back told me about being 
able to use a comparison function with two different types if you use 
std::lower_bound() or std::upper_bound(). Since m_compiler_units is sorted, we 
can just do:

  static bool CompileUnitOffsetLessThan (dw_offset_t die_offset, const 
DWARFCompileUnitSP& cu_sp)
  {
  return die_offset < cu_sp->GetOffset();
  }
  
  DWARFCompileUnitSP
  DWARFDebugInfo::GetCompileUnitContainingDIE(dw_offset_t die_offset)
  {
  DWARFCompileUnitSP cu_sp;
  if (die_offset != DW_INVALID_OFFSET)
  {
  ParseCompileUnitHeadersIfNeeded();
  
  // Watch out for single compile unit executable as they are pretty 
common
  const size_t num_cus = m_compile_units.size();
  if (num_cus == 1)
  {
  if (m_compile_units[0]->ContainsDIEOffset(die_offset))
  cu_sp = m_compile_units[0];
  }
  else if (num_cus)
  {
  CompileUnitColl::const_iterator end_pos = m_compile_units.end();
  CompileUnitColl::const_iterator begin_pos = 
m_compile_units.begin();
  CompileUnitColl::const_iterator pos = std::upper_bound(begin_pos, 
end_pos, die_offset, CompileUnitOffsetLessThan);
  if (pos != begin_pos)
  {
  --pos;
  if ((*pos)->ContainsDIEOffset(die_offset))
  cu_sp = *pos;
  }
  }
  }
  return cu_sp;
  }

Try out the changes and make sure they work and then switch to using the code 
above.


http://reviews.llvm.org/D11390




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11388: Make stream::operator<< take "const" void *

2015-07-21 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11388




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11386: Fix typos.

2015-07-21 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11386




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242729 - Correctly get the arguments and environment, even for processes that have a large amount or arguments and/or environment variables.

2015-07-20 Thread Greg Clayton
Author: gclayton
Date: Mon Jul 20 17:52:13 2015
New Revision: 242729

URL: http://llvm.org/viewvc/llvm-project?rev=242729&view=rev
Log:
Correctly get the arguments and environment, even for processes that have a 
large amount or arguments and/or environment variables.

We previously passed in a 8192 byte buffer but this wasn't large enough. We now 
calculate the size we need and then add 128 to it and get the environment. If 
we pass exactly the number of bytes it says is needs, the sysctl() returns 
junk. Adding 1 seemed to do the trick, but to err on the side of caution, I 
added a few bytes more.




Modified:
lldb/trunk/source/Host/macosx/Host.mm

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=242729&r1=242728&r2=242729&view=diff
==
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Mon Jul 20 17:52:13 2015
@@ -39,6 +39,7 @@
 
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Communication.h"
+#include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
@@ -790,21 +791,23 @@ GetMacOSXProcessArgs (const ProcessInsta
 {
 int proc_args_mib[3] = { CTL_KERN, KERN_PROCARGS2, 
(int)process_info.GetProcessID() };
 
-char arg_data[8192];
-size_t arg_data_size = sizeof(arg_data);
-if (::sysctl (proc_args_mib, 3, arg_data, &arg_data_size , NULL, 0) == 
0)
+size_t arg_data_size = 0;
+if (::sysctl (proc_args_mib, 3, nullptr, &arg_data_size, NULL, 0) || 
arg_data_size == 0)
+arg_data_size = 8192;
+
+// Add a few bytes to the calculated length, I know we need to add at 
least one byte
+// to this number otherwise we get junk back, so add 128 just in 
case...
+DataBufferHeap arg_data(arg_data_size+128, 0);
+arg_data_size = arg_data.GetByteSize();
+if (::sysctl (proc_args_mib, 3, arg_data.GetBytes(), &arg_data_size , 
NULL, 0) == 0)
 {
-DataExtractor data (arg_data, arg_data_size, 
lldb::endian::InlHostByteOrder(), sizeof(void *));
+DataExtractor data (arg_data.GetBytes(), arg_data_size, 
lldb::endian::InlHostByteOrder(), sizeof(void *));
 lldb::offset_t offset = 0;
 uint32_t argc = data.GetU32 (&offset);
-const char *cstr;
-
-
 llvm::Triple &triple = process_info.GetArchitecture().GetTriple();
 const llvm::Triple::ArchType triple_arch = triple.getArch();
 const bool check_for_ios_simulator = (triple_arch == 
llvm::Triple::x86 || triple_arch == llvm::Triple::x86_64);
-
-cstr = data.GetCStr (&offset);
+const char *cstr = data.GetCStr (&offset);
 if (cstr)
 {
 process_info.GetExecutableFile().SetFile(cstr, false);


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11357: Resolve DW_AT_comp_dir path if it contains a symlink

2015-07-20 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Maybe we can look for these magic values and only resolve the symlink if they 
match? Is it currently only "/proc/self/cwd" that we would need to look for? 
stat-ing a ton of file can be very expensive as Jim said and we should strive 
to avoid it if at all possible.


http://reviews.llvm.org/D11357




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242709 - Fix the yellow colorizing and fix some logic in the "A" packet dumper.

2015-07-20 Thread Greg Clayton
Author: gclayton
Date: Mon Jul 20 16:22:18 2015
New Revision: 242709

URL: http://llvm.org/viewvc/llvm-project?rev=242709&view=rev
Log:
Fix the yellow colorizing and fix some logic in the "A" packet dumper.


Modified:
lldb/trunk/examples/python/gdbremote.py

Modified: lldb/trunk/examples/python/gdbremote.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=242709&r1=242708&r2=242709&view=diff
==
--- lldb/trunk/examples/python/gdbremote.py (original)
+++ lldb/trunk/examples/python/gdbremote.py Mon Jul 20 16:22:18 2015
@@ -129,9 +129,9 @@ class TerminalColors:
 The foreground color will be set if "fg" tests True. The background 
color will be set if "fg" tests False.'''
 if self.enabled: 
 if fg:   
-return "\x1b[43m";
-else:
 return "\x1b[33m";
+else:
+return "\x1b[43m";
 return ''
 
 def blue(self, fg = True): 
@@ -625,9 +625,13 @@ def cmd_A(options, cmd, args):
 packet = Packet(args)
 while 1:
 arg_len = packet.get_number()
+if arg_len == -1:
+break
 if not packet.skip_exact_string(','):
 break
 arg_idx = packet.get_number()
+if arg_idx == -1:
+break
 if not packet.skip_exact_string(','):
 break;
 arg_value = packet.get_hex_ascii_str(arg_len)
@@ -1138,6 +1142,7 @@ def parse_gdb_log(file, options):
 print '-->',
 else:
 print '<--',
+
 if packet[0] == '+':
 if not options.quiet: print 'ACK'
 continue


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242593 - More packet performance improvements.

2015-07-17 Thread Greg Clayton
Author: gclayton
Date: Fri Jul 17 18:42:28 2015
New Revision: 242593

URL: http://llvm.org/viewvc/llvm-project?rev=242593&view=rev
Log:
More packet performance improvements. 

Changed the "jthreads" key/value in the stop reply packets to be "jstopinfo". 
This JSON only contains threads with valid stop reasons and allows us not to 
have to ask about other threads via qThreadStopInfo when we are stepping. The 
"jstopinfo" only gets sent if there are more than one thread since the stop 
reply packet contains all the info needed for a single thread.

Added a Process::WillPublicStop() in case process subclasses want to do any 
extra gathering for public stops. For ProcessGDBRemote, we end up sending a 
jThreadsInfo packet to gather all expedited registers, expedited memory and 
MacOSX queue information. We only do this for public stops to minimize the 
packets we send when we have multiple private stops. Multiple private stops 
happen when a source level single step, step into or step out run the process 
multiple times while implementing the stepping, and none of these private stops 
make it out to the UI via notifications because they are private stops. 


Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachException.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.h

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=242593&r1=242592&r2=242593&view=diff
==
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Jul 17 18:42:28 2015
@@ -1263,6 +1263,26 @@ public:
 UnloadImage (uint32_t image_token);
 
 //--
+/// Called when the process is about to broadcast a public stop.
+///
+/// There are public and private stops. Private stops are when the
+/// process is doing things like stepping and the client doesn't
+/// need to know about starts and stop that implement a thread plan.
+/// Single stepping over a source line in code might end up being
+/// implemented by one or more process starts and stops. Public stops
+/// are when clients will be notified that the process is stopped.
+/// These events typically trigger UI updates (thread stack frames to
+/// be displayed, variables to be displayed, and more). This function
+/// can be overriden and allows process subclasses to do something
+/// before the eBroadcastBitStateChanged event is sent to public
+/// clients.
+//--
+virtual void
+WillPublicStop ()
+{
+}
+
+//--
 /// Register for process and thread notifications.
 ///
 /// Clients can register notification callbacks by filling out a

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=242593&r1=242592&r2=242593&view=diff
==
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Fri Jul 17 18:42:28 2015
@@ -303,6 +303,9 @@ public:
 lldb::StopReason
 GetStopReason();
 
+bool
+StopInfoIsUpToDate() const;
+
 // This sets the stop reason to a "blank" stop reason, so you can call 
functions on the thread
 // without having the called function run with whatever stop reason you 
stopped with.
 void

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=242593&r1=242592&r2=242593&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Jul 
17 18:42:28 2015
@@ -376,7 +376,8 @@ ProcessGDBRemote::ProcessGDBRemote(Targe
 m_async_broadcaster (NULL, "lldb.process.gdb-remote.async-broadcaster"),
 m_async_thread_state_mutex(Mutex::eMutexTypeRecursive),
 m_thread_ids (),
-m_threads_info_sp (),
+m_jstopinfo_sp (),
+m_jthreadsinfo_sp (),
 m_continue_c_tids (),
 m_continue_C_tids (),
 m_continue_s_tids (),
@@ -792,7 +793,7 @@ ProcessGDBRemote::DoConnectRemote (Strea
 }
 
  

[Lldb-commits] [lldb] r242586 - Handle dumping many more packet types including the A packet, qC, QSetDisableASLR, qLaunchSuccess and QLaunchArch.

2015-07-17 Thread Greg Clayton
Author: gclayton
Date: Fri Jul 17 18:08:14 2015
New Revision: 242586

URL: http://llvm.org/viewvc/llvm-project?rev=242586&view=rev
Log:
Handle dumping many more packet types including the A packet, qC, 
QSetDisableASLR, qLaunchSuccess and QLaunchArch.


Modified:
lldb/trunk/examples/python/gdbremote.py

Modified: lldb/trunk/examples/python/gdbremote.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=242586&r1=242585&r2=242586&view=diff
==
--- lldb/trunk/examples/python/gdbremote.py (original)
+++ lldb/trunk/examples/python/gdbremote.py Fri Jul 17 18:08:14 2015
@@ -34,6 +34,7 @@ import xml.etree.ElementTree as ET
 g_log_file = ''
 g_byte_order = 'little'
 g_number_regex = re.compile('^(0x[0-9a-fA-F]+|[0-9]+)')
+g_thread_id_regex = re.compile('^(-1|[0-9a-fA-F]+|0)')
 
 class TerminalColors:
 '''Simple terminal colors class'''
@@ -354,6 +355,15 @@ class Packet:
 else:
 return False
 
+def get_thread_id(self, fail_value = -1):
+match = g_number_regex.match (self.str)
+if match:
+number_str = match.group(1)
+self.str = self.str[len(number_str):]
+return int(number_str, 0)
+else:
+return fail_value
+
 def get_hex_uint8(self):
 if self.str and len(self.str) >= 2 and self.str[0] in string.hexdigits 
and self.str[1] in string.hexdigits:
 uval = int(self.str[0:2], 16)
@@ -498,6 +508,11 @@ def get_thread_from_thread_suffix(str):
 return int(match.group(1), 16)
 return None
 
+def cmd_qThreadStopInfo(options, cmd, args):
+packet = Packet(args)
+tid = packet.get_hex_uint('big')
+print "get_thread_stop_info  (tid = 0x%x)" % (tid)
+
 def cmd_stop_reply(options, cmd, args):
 print "get_last_stop_info()"
 return False
@@ -604,7 +619,31 @@ def rsp_qXfer(options, cmd, cmd_args, rs
 g_register_infos.append(reg_info)
 print 'XML for "%s":' % (data[2])
 ET.dump(xml_root)
-
+
+def cmd_A(options, cmd, args):
+print 'launch process:'
+packet = Packet(args)
+while 1:
+arg_len = packet.get_number()
+if not packet.skip_exact_string(','):
+break
+arg_idx = packet.get_number()
+if not packet.skip_exact_string(','):
+break;
+arg_value = packet.get_hex_ascii_str(arg_len)
+print 'argv[%u] = "%s"' % (arg_idx, arg_value)
+
+def cmd_qC(options, cmd, args):
+print "query_current_thread_id()"
+
+def rsp_qC(options, cmd, cmd_args, rsp):
+packet = Packet(rsp)
+if packet.skip_exact_string("QC"):
+tid = packet.get_thread_id()
+print "current_thread_id = %#x" % (tid)
+else:
+print "current_thread_id = old thread ID"
+
 def cmd_query_packet(options, cmd, args):
 if args:
 print "%s%s" % (cmd, args)
@@ -989,39 +1028,45 @@ def cmd_kill(options, cmd, args):
 return False
 
 gdb_remote_commands = {
-'\\?' : { 'cmd' : cmd_stop_reply, 'rsp' : 
rsp_stop_reply  , 'name' : "stop reply pacpket"},
-'QStartNoAckMode' : { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_ok_means_supported  , 'name' : "query if no ack mode is supported"},
-'QThreadSuffixSupported'  : { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_ok_means_supported  , 'name' : "query if thread suffix is supported" },
-'QListThreadsInStopReply' : { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_ok_means_supported  , 'name' : "query if threads in stop reply packets are 
supported" },
-'QSetDetachOnError' :   { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_ok_means_supported  , 'name' : "query if we should detach on error" },
-'qVAttachOrWaitSupported' : { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_ok_means_supported  , 'name' : "query if threads attach with optional wait 
is supported" },
-'qHostInfo'   : { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_dump_key_value_pairs, 'name' : "get host information" },
-'vCont'   : { 'cmd' : cmd_vCont , 'rsp' : 
rsp_vCont   , 'name' : "extended continue command" },
-'vAttach' : { 'cmd' : cmd_vAttach   , 'rsp' : 
rsp_stop_reply  , 'name' : "attach to process" },
-'c'   : { 'cmd' : cmd_c , 'rsp' : 
rsp_stop_reply  , 'name' : "continue" },
-'s'   : { 'cmd' : cmd_s , 'rsp' : 
rsp_stop_reply  , 'name' : "step" },
-'qRegisterInfo'   : { 'cmd' : cmd_qRegisterInfo , 'rsp' : 
rsp_qRegisterInfo   , 'name' : "query register info" },
-'qfThreadInfo': { 'cmd' : cmd_qThreadInfo   , 'rsp' : 
rsp_qThreadInfo , 'name' : "get current thread list" },
-'qsThreadInfo': { 'cmd' : cmd_qThreadInfo   , 'rsp' : 
rsp_qTh

Re: [Lldb-commits] [PATCH] D11309: Detect if necessary to build inferior with -pie for Android.

2015-07-17 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks fine.


http://reviews.llvm.org/D11309




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242566 - Added support for dumping 'x', 'X', 'qSymbol' packets. Also dump any XML retrieved from a qXfer packets.

2015-07-17 Thread Greg Clayton
Author: gclayton
Date: Fri Jul 17 15:16:50 2015
New Revision: 242566

URL: http://llvm.org/viewvc/llvm-project?rev=242566&view=rev
Log:
Added support for dumping 'x', 'X', 'qSymbol' packets. Also dump any XML 
retrieved from a qXfer packets.


Modified:
lldb/trunk/examples/python/gdbremote.py

Modified: lldb/trunk/examples/python/gdbremote.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=242566&r1=242565&r2=242566&view=diff
==
--- lldb/trunk/examples/python/gdbremote.py (original)
+++ lldb/trunk/examples/python/gdbremote.py Fri Jul 17 15:16:50 2015
@@ -33,6 +33,7 @@ import xml.etree.ElementTree as ET
 #--
 g_log_file = ''
 g_byte_order = 'little'
+g_number_regex = re.compile('^(0x[0-9a-fA-F]+|[0-9]+)')
 
 class TerminalColors:
 '''Simple terminal colors class'''
@@ -346,6 +347,13 @@ class Packet:
 self.str = self.str[1:]
 return ch
 
+def skip_exact_string(self, s):
+if self.str and self.str.startswith(s):
+self.str = self.str[len(s):]
+return True
+else:
+return False
+
 def get_hex_uint8(self):
 if self.str and len(self.str) >= 2 and self.str[0] in string.hexdigits 
and self.str[1] in string.hexdigits:
 uval = int(self.str[0:2], 16)
@@ -399,6 +407,19 @@ class Packet:
 uval |= self.get_hex_uint8() << 56
 return uval
 
+def get_number(self, fail_value=-1):
+'''Get a number from the packet. The number must be in big endian 
format and should be parsed
+according to its prefix (starts with "0x" means hex, starts with "0" 
means octal, starts with 
+[1-9] means decimal, etc)'''
+match = g_number_regex.match (self.str)
+if match:
+number_str = match.group(1)
+self.str = self.str[len(number_str):]
+return int(number_str, 0)
+else:
+return fail_value
+
+
 def get_hex_ascii_str(self, n=0):
 hex_chars = self.get_hex_chars(n)
 if hex_chars:
@@ -479,6 +500,7 @@ def get_thread_from_thread_suffix(str):
 
 def cmd_stop_reply(options, cmd, args):
 print "get_last_stop_info()"
+return False
 
 def rsp_stop_reply(options, cmd, cmd_args, rsp):
 global g_byte_order
@@ -498,6 +520,7 @@ def rsp_stop_reply(options, cmd, cmd_arg
 elif key == 'jthreads' or key == 'jstopinfo':
 key_value_pair[1] = binascii.unhexlify(key_value_pair[1])
 key_value_pairs.insert(0, ['signal', signo])
+print 'Stop reply:'
 dump_key_value_pairs (key_value_pairs)
 elif stop_type == 'W':
 exit_status = packet.get_hex_uint8()
@@ -511,10 +534,45 @@ def cmd_unknown_packet(options, cmd, arg
 print "cmd: %s, args: %s", cmd, args
 else:
 print "cmd: %s", cmd
+return False
+
+def cmd_qSymbol(options, cmd, args):
+if args == ':':
+print 'ready to serve symbols'
+else:
+packet = Packet(args)
+symbol_addr = packet.get_hex_uint('big')
+if symbol_addr is None:
+if packet.skip_exact_string(':'):
+symbol_name = packet.get_hex_ascii_str()
+print 'lookup_symbol("%s") -> symbol not available yet' % 
(symbol_name)
+else:
+print 'error: bad command format'
+else:
+if packet.skip_exact_string(':'):
+symbol_name = packet.get_hex_ascii_str()
+print 'lookup_symbol("%s") -> 0x%x' % (symbol_name, 
symbol_addr)
+else:
+print 'error: bad command format'
+
+def rsp_qSymbol(options, cmd, cmd_args, rsp):
+if len(rsp) == 0:
+print "Unsupported"
+else:
+if rsp == "OK":
+print "No more symbols to lookup"
+else:
+packet = Packet(rsp)
+if packet.skip_exact_string("qSymbol:"):
+symbol_name = packet.get_hex_ascii_str()
+print 'lookup_symbol("%s")' % (symbol_name)
+else:
+print 'error: response string should start with "qSymbol:": 
respnse is "%s"' % (rsp)
 
 def cmd_qXfer(options, cmd, args):
 # $qXfer:features:read:target.xml:0,1#14
 print "read target special data %s" % (args)
+return True
 
 def rsp_qXfer(options, cmd, cmd_args, rsp):
 data = string.split(cmd_args, ':')
@@ -544,14 +602,16 @@ def rsp_qXfer(options, cmd, cmd_args, rs
 if 'bitsize' in reg_element.attrib:
 reg_info.info['bitsize'] = 
reg_element.attrib['bitsize']
 g_register_infos.append(reg_info)
-
+print 'XML for "%s":' % (data[2])
+ET.dump(xml_root)
 
 def cmd_query_packet(options, cmd,

[Lldb-commits] [lldb] r242490 - Allow gdbremote.py to take input from STDIN and handle "c" and "s" packets.

2015-07-16 Thread Greg Clayton
Author: gclayton
Date: Thu Jul 16 19:19:31 2015
New Revision: 242490

URL: http://llvm.org/viewvc/llvm-project?rev=242490&view=rev
Log:
Allow gdbremote.py to take input from STDIN and handle "c" and "s" packets.

Modified:
lldb/trunk/examples/python/gdbremote.py

Modified: lldb/trunk/examples/python/gdbremote.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/examples/python/gdbremote.py?rev=242490&r1=242489&r2=242490&view=diff
==
--- lldb/trunk/examples/python/gdbremote.py (original)
+++ lldb/trunk/examples/python/gdbremote.py Thu Jul 16 19:19:31 2015
@@ -495,6 +495,8 @@ def rsp_stop_reply(options, cmd, cmd_arg
 reg_info = g_register_infos[reg_num]
 key_value_pair[0] = reg_info.name()
 key_value_pair[1] = reg_info.get_value_from_hex_string 
(key_value_pair[1])
+elif key == 'jthreads' or key == 'jstopinfo':
+key_value_pair[1] = binascii.unhexlify(key_value_pair[1])
 key_value_pairs.insert(0, ['signal', signo])
 dump_key_value_pairs (key_value_pairs)
 elif stop_type == 'W':
@@ -588,6 +590,12 @@ def rsp_dump_key_value_pairs(options, cm
 else:
 print "not supported"
 
+def cmd_c(options, cmd, args):
+print "continue()"
+
+def cmd_s(options, cmd, args):
+print "step()"
+
 def cmd_vCont(options, cmd, args):
 if args == '?':
 print "%s: get supported extended continue modes" % (cmd)
@@ -894,6 +902,8 @@ gdb_remote_commands = {
 'qHostInfo'   : { 'cmd' : cmd_query_packet  , 'rsp' : 
rsp_dump_key_value_pairs, 'name' : "get host information" },
 'vCont'   : { 'cmd' : cmd_vCont , 'rsp' : 
rsp_vCont   , 'name' : "extended continue command" },
 'vAttach' : { 'cmd' : cmd_vAttach   , 'rsp' : 
rsp_stop_reply  , 'name' : "attach to process" },
+'c'   : { 'cmd' : cmd_c , 'rsp' : 
rsp_stop_reply  , 'name' : "continue" },
+'s'   : { 'cmd' : cmd_s , 'rsp' : 
rsp_stop_reply  , 'name' : "step" },
 'qRegisterInfo'   : { 'cmd' : cmd_qRegisterInfo , 'rsp' : 
rsp_qRegisterInfo   , 'name' : "query register info" },
 'qfThreadInfo': { 'cmd' : cmd_qThreadInfo   , 'rsp' : 
rsp_qThreadInfo , 'name' : "get current thread list" },
 'qsThreadInfo': { 'cmd' : cmd_qThreadInfo   , 'rsp' : 
rsp_qThreadInfo , 'name' : "get current thread list" },
@@ -918,6 +928,8 @@ gdb_remote_commands = {
 def calculate_mean_and_standard_deviation(floats):
 sum = 0.0
 count = len(floats)
+if count == 0:
+return (0.0, 0.0)
 for f in floats:
 sum += f
 mean =  sum / count
@@ -928,8 +940,13 @@ def calculate_mean_and_standard_deviatio
 
 std_dev = math.sqrt(accum / (count-1));
 return (mean, std_dev)
+
+def parse_gdb_log_file(path, options):
+f = open(path)
+parse_gdb_log(f)
+f.close()
 
-def parse_gdb_log_file(file, options):
+def parse_gdb_log(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 function will then normalize
@@ -953,7 +970,6 @@ def parse_gdb_log_file(file, options):
 packet_total_times = {}
 packet_times = []
 packet_count = {}
-file = open(file)
 lines = file.read().splitlines()
 last_command = None
 last_command_args = None
@@ -1100,13 +1116,16 @@ 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.
-for file in args:
-print 
'#--'
-print "# GDB remote log file: '%s'" % file
-print 
'#--'
-parse_gdb_log_file (file, options)
-if options.symbolicator:
-print '%s' % (options.symbolicator)
+if len(args):
+for file in args:
+print 
'#--'
+print "# GDB remote log file: '%s'" % file
+print 
'#--'
+parse_gdb_log_file (file, options)
+if options.symbolicator:
+print '%s' % (options.symbolicator)
+else:
+parse_gdb_log(sys.stdin, options)
 
 else:
 import lldb


___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r242435 - Make sure we calculate resolver symbol addresses correctly for ARM. The trie entries have bit 0 set for Thumb functions and we need to remove that so we can correctly d

2015-07-16 Thread Greg Clayton
Author: gclayton
Date: Thu Jul 16 14:50:57 2015
New Revision: 242435

URL: http://llvm.org/viewvc/llvm-project?rev=242435&view=rev
Log:
Make sure we calculate resolver symbol addresses correctly for ARM. The trie 
entries have bit 0 set for Thumb functions and we need to remove that so we can 
correctly determine which symbols are resolvers.




Modified:
lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=242435&r1=242434&r2=242435&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Thu Jul 16 
14:50:57 2015
@@ -54,6 +54,7 @@
 #include "Utility/UuidCompatibility.h"
 #endif
 
+#define THUMB_ADDRESS_BIT_MASK 0xfffeull
 using namespace lldb;
 using namespace lldb_private;
 using namespace llvm::MachO;
@@ -2058,6 +2059,7 @@ struct TrieEntryWithOffset
 static void
 ParseTrieEntries (DataExtractor &data,
   lldb::offset_t offset,
+  const bool is_arm,
   std::vector &nameSlices,
   std::set &resolver_addresses,
   std::vector& output)
@@ -2080,9 +2082,11 @@ ParseTrieEntries (DataExtractor &data,
e.entry.address = data.GetULEB128(&offset);
if ( e.entry.flags & 
EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER )
 {
-//resolver_addresses.insert(e.entry.address);
e.entry.other = data.GetULEB128(&offset);
-resolver_addresses.insert(e.entry.other);
+uint64_t resolver_addr = e.entry.other;
+if (is_arm)
+resolver_addr &= THUMB_ADDRESS_BIT_MASK;
+resolver_addresses.insert(resolver_addr);
 }
else
e.entry.other = 0;
@@ -2118,6 +2122,7 @@ ParseTrieEntries (DataExtractor &data,
 {
 ParseTrieEntries(data,
  childNodeOffset,
+ is_arm,
  nameSlices,
  resolver_addresses,
  output);
@@ -2542,6 +2547,7 @@ ObjectFileMachO::ParseSymtab ()
 std::vector nameSlices;
 ParseTrieEntries (dyld_trie_data,
   0,
+  is_arm,
   nameSlices,
   resolver_addresses,
   trie_entries);
@@ -3423,7 +3429,7 @@ ObjectFileMachO::ParseSymtab ()
 {
 if 
(symbol_file_addr & 1)
 
symbol_flags = MACHO_NLIST_ARM_SYMBOL_IS_THUMB;
-
symbol_file_addr &= 0xfffeull;
+
symbol_file_addr &= THUMB_ADDRESS_BIT_MASK;
 }
 
 const 
FunctionStarts::Entry *next_func_start_entry = function_starts.FindNextEntry 
(func_start_entry);
@@ -3434,7 +3440,7 @@ ObjectFileMachO::ParseSymtab ()
 // Be sure the 
clear the Thumb address bit when we calculate the size
 // from the 
current and next address
 if (is_arm)
-
next_symbol_file_addr &= 0xfffeull;
+
next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK;
 
symbol_byte_size = std::min(next_symbol_file_addr - 
symbol_file_addr, section_end_file_addr - symbol_file_addr);
 }
 else
@@ -4275,7 +4281,7 @@ ObjectFileMachO::ParseSymtab ()
 
 addr_t symbol_file_addr = 
func_start_entry->addr;
 if (is_arm)
-symbol_file_addr &= 0xfffeull;
+symbol_file_addr &= THUMB_ADDRESS_BIT_MASK;
 
 const FunctionStarts::Entry 
*next_func_start_entry = function_starts.FindNextEntry (func_start_entr

[Lldb-commits] [lldb] r242352 - Added the ability to get JSON thread stop info with thread ID and stop info only in the normal stop reply packets using the new "jthreads" key value pair.

2015-07-15 Thread Greg Clayton
Author: gclayton
Date: Wed Jul 15 17:59:03 2015
New Revision: 242352

URL: http://llvm.org/viewvc/llvm-project?rev=242352&view=rev
Log:
Added the ability to get JSON thread stop info with thread ID and stop info 
only in the normal stop reply packets using the new "jthreads" key value pair.

This allows stepping operations that don't ever do a public stop to get all the 
info they need without having to send a jThreadsInfo packet since those tend to 
be large.

This patch will be followed by a patch that will detect when we do a public 
stop, and when that happens we will send a jThreadsInfo packet at that time to 
get all expedited registers and memory.



Modified:
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.h

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=242352&r1=242351&r2=242352&view=diff
==
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Jul 
15 17:59:03 2015
@@ -2341,6 +2341,18 @@ ProcessGDBRemote::SetThreadStopInfo (Str
 if (tid != LLDB_INVALID_THREAD_ID)
 m_thread_ids.push_back (tid);
 }
+else if (key.compare("jthreads") == 0)
+{
+StringExtractor json_extractor;
+// Swap "value" over into "name_extractor"
+json_extractor.GetStringRef().swap(value);
+// Now convert the HEX bytes into a string value
+json_extractor.GetHexByteString (value);
+
+// This JSON contains thread IDs and thread stop info for 
all threads.
+// It doesn't contain expedited registers, memory or queue 
info.
+m_threads_info_sp = StructuredData::ParseJSON (value);
+}
 else if (key.compare("hexname") == 0)
 {
 StringExtractor name_extractor;

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=242352&r1=242351&r2=242352&view=diff
==
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Wed Jul 15 17:59:03 2015
@@ -265,7 +265,7 @@ RNBRemote::CreatePacketTable  ()
 t.push_back (Packet (query_symbol_lookup,   
&RNBRemote::HandlePacket_qSymbol, NULL, "qSymbol:", "Notify 
that host debugger is ready to do symbol lookups"));
 t.push_back (Packet 
(json_query_thread_extended_info,&RNBRemote::HandlePacket_jThreadExtendedInfo   
, NULL, "jThreadExtendedInfo", "Replies with JSON data of thread extended 
information."));
 t.push_back (Packet (json_query_get_loaded_dynamic_libraries_infos,
  &RNBRemote::HandlePacket_jGetLoadedDynamicLibrariesInfos, NULL, 
"jGetLoadedDynamicLibrariesInfos", "Replies with JSON data of all the shared 
libraries loaded in this process."));
-//t.push_back (Packet (json_query_threads_info,   
&RNBRemote::HandlePacket_jThreadsInfo   , NULL, "jThreadsInfo", 
"Replies with JSON data with information about all threads."));
+t.push_back (Packet (json_query_threads_info,   
&RNBRemote::HandlePacket_jThreadsInfo   , NULL, "jThreadsInfo", 
"Replies with JSON data with information about all threads."));
 t.push_back (Packet (start_noack_mode,  
&RNBRemote::HandlePacket_QStartNoAckMode, NULL, "QStartNoAckMode", 
"Request that " DEBUGSERVER_PROGRAM_NAME " stop acking remote protocol 
packets"));
 t.push_back (Packet (prefix_reg_packets_with_tid,   
&RNBRemote::HandlePacket_QThreadSuffixSupported , NULL, 
"QThreadSuffixSupported", "Check if thread specific packets (register packets 
'g', 'G', 'p', and 'P') support having the thread ID appended to the end of the 
command"));
 t.push_back (Packet (set_logging_mode,  
&RNBRemote::HandlePacket_QSetLogging, NULL, "QSetLogging:", "Check 
if register packets ('g', 'G', 'p', and 'P' support having the thread ID 
prefix"));
@@ -2304,6 +2304,7 @@ RNBRemote::HandlePacket_QListThreadsInSt
 // Send the OK packet first so the correct checksum is appended...
 rnb_err_t result = SendPacket ("OK");
 m_list_threads_in_stop_reply = true;
+
 return result;
 }
 
@@ -2719,7 +2720,6 @@ RNBRemote::SendStopReplyPacketForThread
 // and qsThreadInfo packets, but it also might take a lot of room in 
the
 // stop reply packet, so it must 

Re: [Lldb-commits] [PATCH] D11204: Test chained function calls in C++

2015-07-15 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11204




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11119: Parse breakpoint expressions using the language of the frame's CU.

2015-07-15 Thread Greg Clayton
clayborg added a comment.

I think I would prefer --language and have the help text for this option 
specify what it means (it means expression language for --address and source 
language for file + line breakpoints).


Repository:
  rL LLVM

http://reviews.llvm.org/D9




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11202: Remove shell-specific code from TestLoadUnload Makefile.

2015-07-15 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11202




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11202: Remove shell-specific code from TestLoadUnload Makefile.

2015-07-15 Thread Greg Clayton
clayborg added a comment.

The eventual and correct fix it to source the main makefile rules and use the 
DYLIB_* make variables for LIB_A, and make equivalent DYLIB2_*, DYLIB3_*, 
DYLIB4_* variables which would allow the top level makefile rules to compile up 
to 4 shared libraries in one makefile and then use those for LIB_B, LIB_C and 
LIB_D.


http://reviews.llvm.org/D11202




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11203: Add a class ValueObjectConstResultCast.

2015-07-15 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Actually after speaking with Jim Ingham and Enrico Granata, this is the way it 
should be for now.


http://reviews.llvm.org/D11203




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11187: Add jThreadsInfo support to lldb-server

2015-07-15 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.

Very nice. Glad to see it speeds things up as well!


http://reviews.llvm.org/D11187




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11119: Parse breakpoint expressions using the language of the frame's CU.

2015-07-15 Thread Greg Clayton
clayborg added a comment.

I would like to see the following:

- Add a new class named PascalLanguageRuntime and have it be able to figure out 
how to chop pascal names up into a basename and the larger string to then 
compare against.
- Add a --language  to "breakpoint set" and pass it along if needed
- Modify the Module::PrepareForFunctionNameLookup() to look at the language 
(which should default to "eLanguageTypeUnknown") and skip C++ if  language it 
not eLanguageTypeUnknown and not related to C++. Have it call functions in your 
new PascalLanguageRuntime like a new (at least make 
PascalLanguageRuntime::ExtractContextAndIdentifier(...)).


Repository:
  rL LLVM

http://reviews.llvm.org/D9




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11206: Mark TestCModules.py as XFAIL on OSX

2015-07-15 Thread Greg Clayton
clayborg added a comment.

This test currently works fine for me. Do we know why this is failing for you 
and not for others?


http://reviews.llvm.org/D11206




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11203: Add a class ValueObjectConstResultCast.

2015-07-15 Thread Greg Clayton
clayborg added a comment.

I would almost rather see us create a ValueObjectCast class that just takes 
another ValueObjectSP and a new type to cast it to. We might want there to be 
different cast types like static, reinterpret, or dynamic. Is there a reason 
this is ValueObjectConstResultCast? I think it would be great to be able to 
cast any ValueObjectSP if possible. I will talk more with Jim Ingham on this 
and get back to you.


http://reviews.llvm.org/D11203




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11202: Remove shell-specific code from TestLoadUnload Makefile.

2015-07-15 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Use the $(DS) variable and this will be good go.



Comment at: test/functionalities/load_unload/Makefile:28
@@ -28,1 +27,3 @@
+
+   DS_IF_DARWIN = dsymutil -o $@.dSYM $@
 else

I believe our base makefile rules have a variable names $(DS) so this should 
probably be:

```
DS_IF_DARWIN = $(DS) -o $@.dSYM $@
```



http://reviews.llvm.org/D11202




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11129: Fix for remote-linux test fails: use currently selected platform on target launch

2015-07-15 Thread Greg Clayton

> On Jul 14, 2015, at 12:56 PM, Omair Javaid  wrote:
> 
> On 13 July 2015 at 22:47, Greg Clayton  wrote:
>> clayborg added a comment.
>> 
>> So you must select the platform first:
>> 
>>  target select remote-linux
>>  file a.out
>>  target connect connect://hostname:5432
>>  run
> 
> Alright, but if user does something like:
> 
> file path to some file or invokes ./lldb path to some file (This
> should create a target)
> platform select remote-linux
> target connect connect://hostname:5432
> run
> 
> What should be the expected error message here ?
> 
> This seems to be pretty common use-case.
> 
> 1) we give a executable to be debugged to our debugger on command line
> and it loads symbols etc figuring out architecture and symbol format
> internally.

So your target will populate the executable and find incorrect shared libraries 
when it tracks down the dependent files when the platform isn't set correctly. 
So now you have loaded a few hundred incorrect shared libraries.

> 2) Issue a run at this stage should run the process on host platform
> if there is mismatch (Architecture or OS not compatible) then debugger
> should exit with a suitable error message.

It does.

> 3) If we want to run the same binary on a remote platform then we
> connect to that platform and issue a run which should ideally launch
> our process on remote machine where debug agent is being run.

When you do "target list" it shows you the targets and their current platforms. 
It is currently expected that you select the platform before you make your 
target. I seem to remember we used to have the ability to specify the platform 
on target create, but that was removed.

> 
> At point 1) LLDB should decide on a platform for the binary image
> based on comparison of architecture and Operating System of lldb host
> and binary image target.
> Do you agree? This is not happening right now and if we agree this
> should happen I can go ahead and make those changes.

It certainly does. On MacOSX I can do this:

% cd lldb/test/lang/c/array_types
% make TRIPLE=x86_64-apple-ios
% lldb a.out
(lldb) target list 
Current targets:
* target #0: 
/Volumes/work/gclayton/Documents/src/lldb/tot/test/lang/c/array_types/a.out ( 
arch=x86_64-apple-ios, platform=ios-simulator )


Note that we detected that the current host platform wasn't compatible and we 
ran through all platforms and found one that matched. 

I am guessing the main problem is the ELF binary is too generic to be able to 
fully specify its triple, and too many platforms claim they are compatible. So 
you will need to improve the Platforms you care about to properly determine 
which binaries they can and should claim they are compatible with.


> At point 2) if we run a target built for foreign architecture or OS on
> a native local host at least for linux LLDB goes into a indefinite
> loop ending up in a crash.
> I think I should fix this too. Any thoughts?

Yes, the PlatformLinux (or which ever platform is claiming your binary) when 
IsHost() == true should only claim that it is compatible with native 
architectures. This is the bug we need to fix.
> 
> At point 3) If we select and connect a remote platform then we cannot
> run the target that we created at point 1) and we have create a new
> target.

Yes. Or we can add a "target platform" command that can switch a target's 
platform. I would say to just create a new target in easiest. But hopefully we 
won't have to when the platforms only claim to be compatible with what they 
should be compatible with. If you are on Linux and you say "target create 
a.out" and "target list" shows that the platform is "host":

(lldb) target create a.out
(lldb) target list 
Current targets:
* target #0: /Volumes/work/gclayton/Documents/src/args/a.out ( 
arch=x86_64-apple-macosx, platform=host )

The platform should only be "host" if your a.out contains a native 
architecture. If it doesn't, the "remote-linux" should be selected as the 
platform automatically. Again, part of the problem is ELF files might not 
contain enough info to extract the full triple for the current binary. The ELF 
plug-in currently uses the OSABI field from the match header, various note 
sections, and some other info to try and figure out the correct triple for a 
binary, but it doesn't always work if the info is missing or not set.

So if you have an "arm64-pc-linux" executable and you are on a x86_64 linux 
host and you type:

(lldb) target create a.out

you should not end of having a "host" platform. This is just a bug.



> If we launch the process using same target created initially
> LLDB again goes into a crash on linux platform.
> This should also be fixed to make sure we have

Re: [Lldb-commits] [PATCH] D11176: [LLDB][MIPS] To handle SI_KERENEL generated for invalid 64 bit address

2015-07-15 Thread Greg Clayton
clayborg added a comment.

Is "SI_KERNEL" part of posix? I wonder if we need to put a "#ifdef SI_KERNEL" / 
"#endif" around this case and possibly other cases. If it is part of the POSIX 
spec, then this is good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11176




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D10954: [LLDB][MIPS] Added test case support for MIPS

2015-07-15 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

ok, it you need to special case for MIPS then you can do so.


Repository:
  rL LLVM

http://reviews.llvm.org/D10954




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11163: Use target.exec-search-paths setting when resolving executable path for remote target.

2015-07-13 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


http://reviews.llvm.org/D11163




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11162: Fix debugserver build breakage on Mavericks caused by lldb commit svn 240728

2015-07-13 Thread Greg Clayton
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

Looks good.


Repository:
  rL LLVM

http://reviews.llvm.org/D11162




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-13 Thread Greg Clayton
clayborg added a comment.

So what happens if we are not connected to a remote platform? Do we get 
UnixSignal that are empty? Do we fall back to some constant notion of what we 
think the signal should be?


http://reviews.llvm.org/D11094




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11094: Refactor Unix signals.

2015-07-13 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks fine, just some possible cleanup with respect to calling 
"get_signal_number(signal_name, process):" as mentioned in inlined comments.



Comment at: test/lldbutil.py:935-939
@@ -934,33 +934,7 @@
 
 def get_signal_number(signal_name):
 platform = lldb.remote_platform
-if platform:
-if platform.GetName() == 'remote-linux':
-command = lldb.SBPlatformShellCommand('kill -l %d' % signal_name)
-if platform.Run(command).Success() and command.GetStatus() == 0:
-try:
-return int(command.GetOutput())
-except ValueError:
-pass
-elif platform.GetName() == 'remote-android':
-for signal_number in range(1, 65):
-command = lldb.SBPlatformShellCommand('kill -l %d' % 
signal_number)
-if platform.Run(command).Fail() or command.GetStatus() != 0:
-continue
-output = command.GetOutput().strip().upper()
-if not output.startswith('SIG'):
-output = 'SIG' + output
-if output == signal_name:
-return signal_number
-if lldb.debugger:
-for target_index in range(lldb.debugger.GetNumTargets()):
-target = lldb.debugger.GetTargetAtIndex(target_index)
-if not target.IsValid():
-continue
-process = target.GetProcess()
-if not process.IsValid():
-continue
-signals = process.GetUnixSignals()
-if not signals.IsValid():
-continue
+if platform and platform.IsValid():
+signals = platform.GetUnixSignals()
+if signals.IsValid():
 signal_number = signals.GetSignalNumberFromName(signal_name)

We should be getting this info from the current process if we can. This seems 
like it can introduce test suite errors if our const cached notion of what 
signals are that are retrieved from the static UnixSignals function doesn't 
actually match the real current process that might have fetched the info from 
the remote GDB server. Can you check on all of the callsites that use this 
get_signal_number() function and see if any have a live process they can supply?

I would like to see this function changed to:

```
def get_signal_number(signal_name, process):
signals = None
if process:
   signals = process.GetUnixSignals()
else:
platform = lldb.remote_platform
if platform and platform.IsValid():
signals = platform.GetUnixSignals()
if signals and signals.IsValid():
```


http://reviews.llvm.org/D11094




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11129: Fix for remote-linux test fails: use currently selected platform on target launch

2015-07-13 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

The target should get the currently selected platform when the target is 
created as long as the architecture in the supplied executable is compatible 
with the currently selected platform. It the executable arch isn't compatible, 
a compatible platform will be auto selected. I don't believe this change is 
correct and probably should not be committed.


http://reviews.llvm.org/D11129




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11133: [MIPS] Detect MIPS application specific extensions like micromips

2015-07-13 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

A few changes as noted in inlined comments.



Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp:418
@@ -417,3 +417,3 @@
 
-DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler (const char *triple, 
const char *cpu, unsigned flavor, DisassemblerLLVMC &owner):
+DisassemblerLLVMC::LLVMCDisassembler::LLVMCDisassembler (const char *triple, 
const char *cpu, std::string features_str, unsigned flavor, DisassemblerLLVMC 
&owner):
 m_is_valid(true)

Make "features_str" a "const char *". No need to construct a std::string just 
to pass a string argument. Or we can use llvm::StringRef objects for triple, 
cpu and features_str.


Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp:693
@@ -677,3 +692,3 @@
 
-m_disasm_ap.reset (new LLVMCDisassembler(triple, cpu, flavor, *this));
+m_disasm_ap.reset (new LLVMCDisassembler(triple, cpu, features_str, 
flavor, *this));
 if (!m_disasm_ap->IsValid())

pass features_str.c_str() if we switch to "const char *" as mentioned above, 
else it will make an llvm::StringRef implicitly.


Comment at: source/Plugins/Disassembler/llvm/DisassemblerLLVMC.h:44
@@ -43,3 +43,3 @@
 public:
-LLVMCDisassembler (const char *triple, const char *cpu, unsigned 
flavor, DisassemblerLLVMC &owner);
+LLVMCDisassembler (const char *triple, const char *cpu, std::string 
features_str, unsigned flavor, DisassemblerLLVMC &owner);
 

Make "features_str" a "const char *". No need to construct a std::string just 
to pass a string argument. Or we can use llvm::StringRef objects for triple, 
cpu and features_str.


Repository:
  rL LLVM

http://reviews.llvm.org/D11133




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D11119: Parse breakpoint expressions using the language of the frame's CU.

2015-07-13 Thread Greg Clayton
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

The current frame really isn't a good indicator of the language that one should 
use for a breakpoint you are want to set by name.

I would rather see smarts go into Module::PrepareForFunctionNameLookup() and 
teach it to pull apart names like "ns.foo" and do the right thing. If a string 
comes into Module::PrepareForFunctionNameLookup() that contains 
. repeated as many times as needed 
(...) then we should 
correctly pull those apart and search for "foo" and then match against "ns.foo" 
(just like Module::PrepareForFunctionNameLookup() takes "ns::foo" and looks up 
"foo" and then matches agains "ns::foo"). I don't think we need a language 
indicator to tell us, we should be able to just break it up without that hint. 
We could provide a language hint to Module::PrepareForFunctionNameLookup() if 
we want to and then have the user specify "--language pascal" when doing the 
"breakpoint set --name ns.foo --language pascal", but we shouldn't be using any 
frame's compile unit language to do so.


Repository:
  rL LLVM

http://reviews.llvm.org/D9




___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


  1   2   3   4   5   6   7   8   9   10   >