[Lldb-commits] LLVM buildmaster will be updated and restarted tonight

2016-02-26 Thread Galina Kistanova via lldb-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 8 PM Pacific time
today.

Thanks

Galina
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-02-26 Thread Jim Ingham via lldb-commits
jingham added a comment.

I don't think you can manipulate the public run lock in PrivateResume like 
this.  PrivateResume gets run in a bunch of places (like calling functions) 
that are way below the level the public run lock.  You probably need to catch 
errors from PrivateResume in Resume and release the lock there.

That's a little ugly, but it is good to have PrivateResume return an accurate 
error, so I think putting the check there is right.


http://reviews.llvm.org/D17635



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.

2016-02-26 Thread Zachary Turner via lldb-commits
Ok, so back to check_inlines.  I realized after I hit send that the
explanation I had written out is exactly what I thought I had to do for
check_inlines == true.

I guess a concrete example would make it clearer.  If I have this code:

// foo.cpp
#include "foo.h"

int main(int argc, char **argv) { return 0; }


And I run this C++ code:

// After this, sc_list should have 1 entry.
ResolveSymbolContext("foo.h", 0, true, eSymbolContextCompUnit, sc_list);

// After this, sc_list should have how many entries?  1 or 0?
ResolveSymbolContext("foo.h", 0, false, eSymbolContextCompUnit, sc_list);

how many entries are in sc_list after the second call?  If it's still 1,
then what is the difference with the first case?

Is the only difference what I put into the line tables?  In the 'true'
case, I fill out the line tables with all the contributions from foo.h, but
in the 'false' case I don't?  But both still return the same number of
entries in sc_list?

(Sorry this is so confusing, I'm planning to document this process as I go
so that the next person that comes along will be able to have all this
information up front)

On Fri, Feb 26, 2016 at 3:26 PM Greg Clayton  wrote:

>
> > On Feb 26, 2016, at 3:22 PM, Zachary Turner  wrote:
> >
> >
> >
> > On Fri, Feb 26, 2016 at 3:16 PM Greg Clayton  wrote:
> >
> > > On Feb 26, 2016, at 2:49 PM, Zachary Turner 
> wrote:
> >
> > > I'm coming back around to this now.  What happens if check_inlines is
> False, but the FileSpec is a header file like .  You said "If
> check_inlines is false, make sure file_spec matches".  But if file_spec is
> a header file, it's never going to match anything.  Should I simply expect
> that the API is not called in this way?
> >
> > It can be called, but you should only match on compile units whose files
> match "vector" as the basename.
> > Ahh, so I don't return each compile unit that matches the file_spec, but
> rather each CompileUnit where the compile unit OR one of the support files
> matches the file_spec.
>
> Yes. Think of what the user is going to want if they type:
>
> (lldb) b vector:123
>
> This should find all files that match vector and set a breakpoint on line
> 123 of _all_ of them.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.

2016-02-26 Thread Greg Clayton via lldb-commits

> On Feb 26, 2016, at 3:22 PM, Zachary Turner  wrote:
> 
> 
> 
> On Fri, Feb 26, 2016 at 3:16 PM Greg Clayton  wrote:
> 
> > On Feb 26, 2016, at 2:49 PM, Zachary Turner  wrote:
> 
> > I'm coming back around to this now.  What happens if check_inlines is 
> > False, but the FileSpec is a header file like .  You said "If 
> > check_inlines is false, make sure file_spec matches".  But if file_spec is 
> > a header file, it's never going to match anything.  Should I simply expect 
> > that the API is not called in this way?
>  
> It can be called, but you should only match on compile units whose files 
> match "vector" as the basename.
> Ahh, so I don't return each compile unit that matches the file_spec, but 
> rather each CompileUnit where the compile unit OR one of the support files 
> matches the file_spec.  

Yes. Think of what the user is going to want if they type:

(lldb) b vector:123

This should find all files that match vector and set a breakpoint on line 123 
of _all_ of them. 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262090 - Make LLDB safer to use with respect to the global destructor chain.

2016-02-26 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Feb 26 17:20:08 2016
New Revision: 262090

URL: http://llvm.org/viewvc/llvm-project?rev=262090=rev
Log:
Make LLDB safer to use with respect to the global destructor chain.


Modified:
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=262090=262089=262090=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Feb 26 17:20:08 2016
@@ -833,13 +833,14 @@ Process::~Process()
 const ProcessPropertiesSP &
 Process::GetGlobalProperties()
 {
-static ProcessPropertiesSP g_settings_sp;
+// NOTE: intentional leak so we don't crash if global destructor chain gets
+// called as other threads still use the result of this function
+static ProcessPropertiesSP *g_settings_sp_ptr = nullptr;
 static std::once_flag g_once_flag;
 std::call_once(g_once_flag,  []() {
-if (!g_settings_sp)
-g_settings_sp.reset (new ProcessProperties (NULL));
+g_settings_sp_ptr = new ProcessPropertiesSP(new ProcessProperties 
(NULL));
 });
-return g_settings_sp;
+return *g_settings_sp_ptr;
 }
 
 void

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=262090=262089=262090=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Feb 26 17:20:08 2016
@@ -2778,13 +2778,14 @@ Target::RunStopHooks ()
 const TargetPropertiesSP &
 Target::GetGlobalProperties()
 {
-static TargetPropertiesSP g_settings_sp;
+// NOTE: intentional leak so we don't crash if global destructor chain gets
+// called as other threads still use the result of this function
+static TargetPropertiesSP *g_settings_sp_ptr = nullptr;
 static std::once_flag g_once_flag;
 std::call_once(g_once_flag,  []() {
-if (!g_settings_sp)
-g_settings_sp.reset(new TargetProperties(nullptr));
+g_settings_sp_ptr = new TargetPropertiesSP(new 
TargetProperties(nullptr));
 });
-return g_settings_sp;
+return *g_settings_sp_ptr;
 }
 
 Error

Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=262090=262089=262090=diff
==
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Feb 26 17:20:08 2016
@@ -59,13 +59,14 @@ using namespace lldb_private;
 const ThreadPropertiesSP &
 Thread::GetGlobalProperties()
 {
-static ThreadPropertiesSP g_settings_sp;
+// NOTE: intentional leak so we don't crash if global destructor chain gets
+// called as other threads still use the result of this function
+static ThreadPropertiesSP *g_settings_sp_ptr = nullptr;
 static std::once_flag g_once_flag;
 std::call_once(g_once_flag,  []() {
-if (!g_settings_sp)
-g_settings_sp.reset (new ThreadProperties (true));
+g_settings_sp_ptr = new ThreadPropertiesSP(new ThreadProperties 
(true));
 });
-return g_settings_sp;
+return *g_settings_sp_ptr;
 }
 
 static PropertyDefinition


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.

2016-02-26 Thread Zachary Turner via lldb-commits
On Fri, Feb 26, 2016 at 3:16 PM Greg Clayton  wrote:

>
> > On Feb 26, 2016, at 2:49 PM, Zachary Turner  wrote:
>
> > I'm coming back around to this now.  What happens if check_inlines is
> False, but the FileSpec is a header file like .  You said "If
> check_inlines is false, make sure file_spec matches".  But if file_spec is
> a header file, it's never going to match anything.  Should I simply expect
> that the API is not called in this way?
>


> It can be called, but you should only match on compile units whose files
> match "vector" as the basename.
>
Ahh, so I don't return each compile unit that matches the file_spec, but
rather each CompileUnit where the compile unit OR one of the support files
matches the file_spec.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.

2016-02-26 Thread Greg Clayton via lldb-commits

> On Feb 26, 2016, at 2:49 PM, Zachary Turner  wrote:
> 
> 
> 
> On Thu, Feb 18, 2016 at 6:16 PM Greg Clayton  wrote:
> 
> > Just to make sure I understand, is it safe to say that:
> >
> > If check_inlines is false, sc_list should return with exactly 1 
> > SymbolContext with m_comp_unit set to the main source file?
> 
> You would get one SymbolContext per compile unit whose path matches the 
> file_spec _and_ contains a line number. There might be multiple "Foo.cpp" 
> files in different directories withing one PDB file, so you might still end 
> up finding N matches. So your existing code can be used when check_inlines if 
> false as long as the PDB can search by fullname and by basename. I am 
> guessing it doesn't though, am I wrong?
> 
> > The same for the check_inlines is false calse -- we still just have  
> > SymbolContext but we add line table entries from all additional files that 
> > contribute to the compilation unit?
> > When will sc_list end up with multiple entries?
> 
> You always look through all compile units. If check_inlines is false, then 
> you make sure "file_spec" matches (by basename  if only basename is 
> specified, or by full path if a directory and filename are valid inside 
> file_spec. If the file matches, then look for any lines that match and return 
> ALL instances of them. Auto inlining of a function inside a compile unit 
> might cause there to be many entries for line 10.
> 
> I'm coming back around to this now.  What happens if check_inlines is False, 
> but the FileSpec is a header file like .  You said "If check_inlines 
> is false, make sure file_spec matches".  But if file_spec is a header file, 
> it's never going to match anything.  Should I simply expect that the API is 
> not called in this way?  

It can be called, but you should only match on compile units whose files match 
"vector" as the basename.

> i.e. if I write b vector:1234 then I can expect that check_inlines will be 
> true?

By default check_inlines is always true, but the user can change this setting:

(lldb) settings set target.inline-breakpoint-strategy 
Available completions:
never
always
headers

The default is aways:

(lldb) settings show target.inline-breakpoint-strategy 
target.inline-breakpoint-strategy (enum) = always

"headers" will try to determine if the source file name is actually a header 
and enable check_inlines only if it thinks it is a header. Or I should say it 
will enable check_inlines if it things the file is _not_ a source file. So 
anything with no extension will always be a header.

So you can expect that check_inlines will be true. If someone writes code that 
is C and C++ only where they never inline anything, they can get a performance 
boost from setting the setting to "headers" or "never" as we won't be going 
through all lines tables looking for "foo.cpp" looking for inline instances. 

Greg


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.

2016-02-26 Thread Zachary Turner via lldb-commits
On Thu, Feb 18, 2016 at 6:16 PM Greg Clayton  wrote:

>
> > Just to make sure I understand, is it safe to say that:
> >
> > If check_inlines is false, sc_list should return with exactly 1
> SymbolContext with m_comp_unit set to the main source file?
>
> You would get one SymbolContext per compile unit whose path matches the
> file_spec _and_ contains a line number. There might be multiple "Foo.cpp"
> files in different directories withing one PDB file, so you might still end
> up finding N matches. So your existing code can be used when check_inlines
> if false as long as the PDB can search by fullname and by basename. I am
> guessing it doesn't though, am I wrong?
>
> > The same for the check_inlines is false calse -- we still just have
> SymbolContext but we add line table entries from all additional files that
> contribute to the compilation unit?
> > When will sc_list end up with multiple entries?
>
> You always look through all compile units. If check_inlines is false, then
> you make sure "file_spec" matches (by basename  if only basename is
> specified, or by full path if a directory and filename are valid inside
> file_spec. If the file matches, then look for any lines that match and
> return ALL instances of them. Auto inlining of a function inside a compile
> unit might cause there to be many entries for line 10.
>

I'm coming back around to this now.  What happens if check_inlines is
False, but the FileSpec is a header file like .  You said "If
check_inlines is false, make sure file_spec matches".  But if file_spec is
a header file, it's never going to match anything.  Should I simply expect
that the API is not called in this way?  i.e. if I write b vector:1234 then
I can expect that check_inlines will be true?
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17658: Register value is not necessarily scalar.

2016-02-26 Thread Chaoren Lin via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262081: Register value is not necessarily scalar. (authored 
by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D17658?vs=49237=49238#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17658

Files:
  lldb/trunk/source/Expression/Materializer.cpp

Index: lldb/trunk/source/Expression/Materializer.cpp
===
--- lldb/trunk/source/Expression/Materializer.cpp
+++ lldb/trunk/source/Expression/Materializer.cpp
@@ -35,35 +35,35 @@
 {
 uint32_t size = entity.GetSize();
 uint32_t alignment = entity.GetAlignment();
-
+
 uint32_t ret;
-
+
 if (m_current_offset == 0)
 m_struct_alignment = alignment;
-
+
 if (m_current_offset % alignment)
 m_current_offset += (alignment - (m_current_offset % alignment));
-
+
 ret = m_current_offset;
-
+
 m_current_offset += size;
-
+
 return ret;
 }
 
 void
 Materializer::Entity::SetSizeAndAlignmentFromType (CompilerType )
 {
 m_size = type.GetByteSize(nullptr);
-
+
 uint32_t bit_alignment = type.GetTypeBitAlign();
-
+
 if (bit_alignment % 8)
 {
 bit_alignment += 8;
 bit_alignment &= ~((uint32_t)0x111u);
 }
-
+
 m_alignment = bit_alignment / 8;
 }
 
@@ -80,117 +80,117 @@
 m_size = 8;
 m_alignment = 8;
 }
-
+
 void MakeAllocation (IRMemoryMap , Error )
 {
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
 // Allocate a spare memory area to store the persistent variable's contents.
-
+
 Error allocate_error;
 const bool zero_memory = false;
-
+
 lldb::addr_t mem = map.Malloc(m_persistent_variable_sp->GetByteSize(),
   8,
   lldb::ePermissionsReadable | lldb::ePermissionsWritable,
   IRMemoryMap::eAllocationPolicyMirror,
   zero_memory,
   allocate_error);
-
+
 if (!allocate_error.Success())
 {
 err.SetErrorStringWithFormat("couldn't allocate a memory area to store %s: %s", m_persistent_variable_sp->GetName().GetCString(), allocate_error.AsCString());
 return;
 }
-
+
 if (log)
 log->Printf("Allocated %s (0x%" PRIx64 ") successfully", m_persistent_variable_sp->GetName().GetCString(), mem);
-
+
 // Put the location of the spare memory into the live data of the ValueObject.
-
+
 m_persistent_variable_sp->m_live_sp = ValueObjectConstResult::Create (map.GetBestExecutionContextScope(),
   m_persistent_variable_sp->GetCompilerType(),
   m_persistent_variable_sp->GetName(),
   mem,
   eAddressTypeLoad,
   map.GetAddressByteSize());
-
+
 // Clear the flag if the variable will never be deallocated.
-
+
 if (m_persistent_variable_sp->m_flags & ExpressionVariable::EVKeepInTarget)
 {
 Error leak_error;
 map.Leak(mem, leak_error);
 m_persistent_variable_sp->m_flags &= ~ExpressionVariable::EVNeedsAllocation;
 }
-
+
 // Write the contents of the variable to the area.
-
+
 Error write_error;
-
+
 map.WriteMemory (mem,
  m_persistent_variable_sp->GetValueBytes(),
  m_persistent_variable_sp->GetByteSize(),
  write_error);
-
+
 if (!write_error.Success())
 {
 err.SetErrorStringWithFormat ("couldn't write %s to the target: %s", m_persistent_variable_sp->GetName().AsCString(),
   write_error.AsCString());
 return;
 }
 }
-
+
 void DestroyAllocation (IRMemoryMap , Error )
 {
 Error deallocate_error;
-
+
 map.Free((lldb::addr_t)m_persistent_variable_sp->m_live_sp->GetValue().GetScalar().ULongLong(), deallocate_error);
-
+
 m_persistent_variable_sp->m_live_sp.reset();
-
+
 if (!deallocate_error.Success())
 {
 err.SetErrorStringWithFormat ("couldn't deallocate memory for %s: %s", m_persistent_variable_sp->GetName().GetCString(), deallocate_error.AsCString());
 }
 }
-
+
 void Materialize(lldb::StackFrameSP _sp,
  

[Lldb-commits] [lldb] r262081 - Register value is not necessarily scalar.

2016-02-26 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Fri Feb 26 16:12:35 2016
New Revision: 262081

URL: http://llvm.org/viewvc/llvm-project?rev=262081=rev
Log:
Register value is not necessarily scalar.

Reviewers: aidan.dodds, mamai

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D17658

Modified:
lldb/trunk/source/Expression/Materializer.cpp

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=262081=262080=262081=diff
==
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Fri Feb 26 16:12:35 2016
@@ -35,19 +35,19 @@ Materializer::AddStructMember (Entity 
 {
 uint32_t size = entity.GetSize();
 uint32_t alignment = entity.GetAlignment();
-
+
 uint32_t ret;
-
+
 if (m_current_offset == 0)
 m_struct_alignment = alignment;
-
+
 if (m_current_offset % alignment)
 m_current_offset += (alignment - (m_current_offset % alignment));
-
+
 ret = m_current_offset;
-
+
 m_current_offset += size;
-
+
 return ret;
 }
 
@@ -55,15 +55,15 @@ void
 Materializer::Entity::SetSizeAndAlignmentFromType (CompilerType )
 {
 m_size = type.GetByteSize(nullptr);
-
+
 uint32_t bit_alignment = type.GetTypeBitAlign();
-
+
 if (bit_alignment % 8)
 {
 bit_alignment += 8;
 bit_alignment &= ~((uint32_t)0x111u);
 }
-
+
 m_alignment = bit_alignment / 8;
 }
 
@@ -80,59 +80,59 @@ public:
 m_size = 8;
 m_alignment = 8;
 }
-
+
 void MakeAllocation (IRMemoryMap , Error )
 {
 Log *log(lldb_private::GetLogIfAllCategoriesSet 
(LIBLLDB_LOG_EXPRESSIONS));
 
 // Allocate a spare memory area to store the persistent variable's 
contents.
-
+
 Error allocate_error;
 const bool zero_memory = false;
-
+
 lldb::addr_t mem = map.Malloc(m_persistent_variable_sp->GetByteSize(),
   8,
   lldb::ePermissionsReadable | 
lldb::ePermissionsWritable,
   IRMemoryMap::eAllocationPolicyMirror,
   zero_memory,
   allocate_error);
-
+
 if (!allocate_error.Success())
 {
 err.SetErrorStringWithFormat("couldn't allocate a memory area to 
store %s: %s", m_persistent_variable_sp->GetName().GetCString(), 
allocate_error.AsCString());
 return;
 }
-
+
 if (log)
 log->Printf("Allocated %s (0x%" PRIx64 ") successfully", 
m_persistent_variable_sp->GetName().GetCString(), mem);
-
+
 // Put the location of the spare memory into the live data of the 
ValueObject.
-
+
 m_persistent_variable_sp->m_live_sp = ValueObjectConstResult::Create 
(map.GetBestExecutionContextScope(),
   
m_persistent_variable_sp->GetCompilerType(),
   
m_persistent_variable_sp->GetName(),
   
mem,
   
eAddressTypeLoad,
   
map.GetAddressByteSize());
-
+
 // Clear the flag if the variable will never be deallocated.
-
+
 if (m_persistent_variable_sp->m_flags & 
ExpressionVariable::EVKeepInTarget)
 {
 Error leak_error;
 map.Leak(mem, leak_error);
 m_persistent_variable_sp->m_flags &= 
~ExpressionVariable::EVNeedsAllocation;
 }
-
+
 // Write the contents of the variable to the area.
-
+
 Error write_error;
-
+
 map.WriteMemory (mem,
  m_persistent_variable_sp->GetValueBytes(),
  m_persistent_variable_sp->GetByteSize(),
  write_error);
-
+
 if (!write_error.Success())
 {
 err.SetErrorStringWithFormat ("couldn't write %s to the target: 
%s", m_persistent_variable_sp->GetName().AsCString(),
@@ -140,21 +140,21 @@ public:
 return;
 }
 }
-
+
 void DestroyAllocation (IRMemoryMap , Error )
 {
 Error deallocate_error;
-
+
 
map.Free((lldb::addr_t)m_persistent_variable_sp->m_live_sp->GetValue().GetScalar().ULongLong(),
 deallocate_error);
-
+
 m_persistent_variable_sp->m_live_sp.reset();
-
+
 if (!deallocate_error.Success())
 {
 err.SetErrorStringWithFormat ("couldn't deallocate 

Re: [Lldb-commits] [PATCH] D17658: Register value is not necessarily scalar.

2016-02-26 Thread Chaoren Lin via lldb-commits
chaoren updated this revision to Diff 49237.
chaoren added a comment.

Check return value of GetScalarValue directly.


http://reviews.llvm.org/D17658

Files:
  source/Expression/Materializer.cpp

Index: source/Expression/Materializer.cpp
===
--- source/Expression/Materializer.cpp
+++ source/Expression/Materializer.cpp
@@ -35,35 +35,35 @@
 {
 uint32_t size = entity.GetSize();
 uint32_t alignment = entity.GetAlignment();
-
+
 uint32_t ret;
-
+
 if (m_current_offset == 0)
 m_struct_alignment = alignment;
-
+
 if (m_current_offset % alignment)
 m_current_offset += (alignment - (m_current_offset % alignment));
-
+
 ret = m_current_offset;
-
+
 m_current_offset += size;
-
+
 return ret;
 }
 
 void
 Materializer::Entity::SetSizeAndAlignmentFromType (CompilerType )
 {
 m_size = type.GetByteSize(nullptr);
-
+
 uint32_t bit_alignment = type.GetTypeBitAlign();
-
+
 if (bit_alignment % 8)
 {
 bit_alignment += 8;
 bit_alignment &= ~((uint32_t)0x111u);
 }
-
+
 m_alignment = bit_alignment / 8;
 }
 
@@ -80,117 +80,117 @@
 m_size = 8;
 m_alignment = 8;
 }
-
+
 void MakeAllocation (IRMemoryMap , Error )
 {
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
 // Allocate a spare memory area to store the persistent variable's contents.
-
+
 Error allocate_error;
 const bool zero_memory = false;
-
+
 lldb::addr_t mem = map.Malloc(m_persistent_variable_sp->GetByteSize(),
   8,
   lldb::ePermissionsReadable | lldb::ePermissionsWritable,
   IRMemoryMap::eAllocationPolicyMirror,
   zero_memory,
   allocate_error);
-
+
 if (!allocate_error.Success())
 {
 err.SetErrorStringWithFormat("couldn't allocate a memory area to store %s: %s", m_persistent_variable_sp->GetName().GetCString(), allocate_error.AsCString());
 return;
 }
-
+
 if (log)
 log->Printf("Allocated %s (0x%" PRIx64 ") successfully", m_persistent_variable_sp->GetName().GetCString(), mem);
-
+
 // Put the location of the spare memory into the live data of the ValueObject.
-
+
 m_persistent_variable_sp->m_live_sp = ValueObjectConstResult::Create (map.GetBestExecutionContextScope(),
   m_persistent_variable_sp->GetCompilerType(),
   m_persistent_variable_sp->GetName(),
   mem,
   eAddressTypeLoad,
   map.GetAddressByteSize());
-
+
 // Clear the flag if the variable will never be deallocated.
-
+
 if (m_persistent_variable_sp->m_flags & ExpressionVariable::EVKeepInTarget)
 {
 Error leak_error;
 map.Leak(mem, leak_error);
 m_persistent_variable_sp->m_flags &= ~ExpressionVariable::EVNeedsAllocation;
 }
-
+
 // Write the contents of the variable to the area.
-
+
 Error write_error;
-
+
 map.WriteMemory (mem,
  m_persistent_variable_sp->GetValueBytes(),
  m_persistent_variable_sp->GetByteSize(),
  write_error);
-
+
 if (!write_error.Success())
 {
 err.SetErrorStringWithFormat ("couldn't write %s to the target: %s", m_persistent_variable_sp->GetName().AsCString(),
   write_error.AsCString());
 return;
 }
 }
-
+
 void DestroyAllocation (IRMemoryMap , Error )
 {
 Error deallocate_error;
-
+
 map.Free((lldb::addr_t)m_persistent_variable_sp->m_live_sp->GetValue().GetScalar().ULongLong(), deallocate_error);
-
+
 m_persistent_variable_sp->m_live_sp.reset();
-
+
 if (!deallocate_error.Success())
 {
 err.SetErrorStringWithFormat ("couldn't deallocate memory for %s: %s", m_persistent_variable_sp->GetName().GetCString(), deallocate_error.AsCString());
 }
 }
-
+
 void Materialize(lldb::StackFrameSP _sp,
  IRMemoryMap ,
  lldb::addr_t process_address,
  Error ) override
 {
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
 
   

Re: [Lldb-commits] [lldb] r262041 - Fix bug with register values byte order in expression evaluation.

2016-02-26 Thread Chaoren Lin via lldb-commits
Hmm. Weird. That assert is failing on Linux:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/11833

On Fri, Feb 26, 2016 at 9:40 AM, Aidan Dodds via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: aidandodds
> Date: Fri Feb 26 11:40:50 2016
> New Revision: 262041
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262041=rev
> Log:
> Fix bug with register values byte order in expression evaluation.
>
> The evaluation of expressions containing register values was broken for
> targets for which endianness differs from host.
>
> Committed on behalf of: mamai 
>
> Differential revision: http://reviews.llvm.org/D17167
>
> Modified:
> lldb/trunk/source/Expression/Materializer.cpp
>
> Modified: lldb/trunk/source/Expression/Materializer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=262041=262040=262041=diff
>
> ==
> --- lldb/trunk/source/Expression/Materializer.cpp (original)
> +++ lldb/trunk/source/Expression/Materializer.cpp Fri Feb 26 11:40:50 2016
> @@ -26,6 +26,7 @@
>  #include "lldb/Target/StackFrame.h"
>  #include "lldb/Target/Target.h"
>  #include "lldb/Target/Thread.h"
> +#include "lldb/Utility/LLDBAssert.h"
>
>  using namespace lldb_private;
>
> @@ -1275,9 +1276,14 @@ public:
>  m_register_contents.reset(new
> DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize()));
>
>  Error write_error;
> -
> -map.WriteMemory(load_addr, register_data.GetDataStart(),
> register_data.GetByteSize(), write_error);
> -
> +
> +Scalar scalar;
> +reg_value.GetScalarValue(scalar);
> +
> +lldbassert(scalar.GetByteSize() == register_data.GetByteSize());
> +
> +map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(),
> write_error);
> +
>  if (!write_error.Success())
>  {
>  err.SetErrorStringWithFormat("couldn't write the contents of
> register %s: %s", m_register_info.name, write_error.AsCString());
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262053 - Make sure the Target, Process and Thread GetGlobalProperties() static methods are thread safe.

2016-02-26 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Feb 26 13:38:18 2016
New Revision: 262053

URL: http://llvm.org/viewvc/llvm-project?rev=262053=rev
Log:
Make sure the Target, Process and Thread GetGlobalProperties() static methods 
are thread safe.




Modified:
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=262053=262052=262053=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Feb 26 13:38:18 2016
@@ -9,6 +9,7 @@
 
 // C Includes
 // C++ Includes
+#include 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Target/Process.h"
@@ -832,8 +833,11 @@ const ProcessPropertiesSP &
 Process::GetGlobalProperties()
 {
 static ProcessPropertiesSP g_settings_sp;
-if (!g_settings_sp)
-g_settings_sp.reset (new ProcessProperties (NULL));
+static std::once_flag g_once_flag;
+std::call_once(g_once_flag,  []() {
+if (!g_settings_sp)
+g_settings_sp.reset (new ProcessProperties (NULL));
+});
 return g_settings_sp;
 }
 

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=262053=262052=262053=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Fri Feb 26 13:38:18 2016
@@ -9,6 +9,7 @@
 
 // C Includes
 // C++ Includes
+#include 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Target/Target.h"
@@ -2778,10 +2779,11 @@ const TargetPropertiesSP &
 Target::GetGlobalProperties()
 {
 static TargetPropertiesSP g_settings_sp;
-if (!g_settings_sp)
-{
-g_settings_sp.reset(new TargetProperties(nullptr));
-}
+static std::once_flag g_once_flag;
+std::call_once(g_once_flag,  []() {
+if (!g_settings_sp)
+g_settings_sp.reset(new TargetProperties(nullptr));
+});
 return g_settings_sp;
 }
 

Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=262053=262052=262053=diff
==
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Fri Feb 26 13:38:18 2016
@@ -9,6 +9,7 @@
 
 // C Includes
 // C++ Includes
+#include 
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Breakpoint/BreakpointLocation.h"
@@ -59,8 +60,11 @@ const ThreadPropertiesSP &
 Thread::GetGlobalProperties()
 {
 static ThreadPropertiesSP g_settings_sp;
-if (!g_settings_sp)
-g_settings_sp.reset (new ThreadProperties (true));
+static std::once_flag g_once_flag;
+std::call_once(g_once_flag,  []() {
+if (!g_settings_sp)
+g_settings_sp.reset (new ThreadProperties (true));
+});
 return g_settings_sp;
 }
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262051 - SymbolFileDWARFDebugMap::FindTypes didn't obey the max_matches flag,

2016-02-26 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Fri Feb 26 13:33:11 2016
New Revision: 262051

URL: http://llvm.org/viewvc/llvm-project?rev=262051=rev
Log:
SymbolFileDWARFDebugMap::FindTypes didn't obey the max_matches flag, 
but kept looking through .o files even after it had found as many 
matches as were requested.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=262051=262050=262051=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Fri 
Feb 26 13:33:11 2016
@@ -1297,7 +1297,10 @@ SymbolFileDWARFDebugMap::FindTypes
 {
 ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
 oso_dwarf->FindTypes (sc, name, parent_decl_ctx, append, 
max_matches, searched_symbol_files, types);
-return false;
+if (types.GetSize() >= max_matches)
+return true;
+else
+return false;
 });
 }
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17650: Fix TestInlines.py on Windows

2016-02-26 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.h:1-4
@@ +1,4 @@
+int inner_inline (int inner_input, int mod_value);
+int outer_inline (int outer_input);
+int not_inlined_2 (int input);
+int not_inlined_1 (int input);

zturner wrote:
> Why do we need this header file now?  It wasn't here before.
Oh wait I'm wrong.  It was here before.


http://reviews.llvm.org/D17650



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17650: Fix TestInlines.py on Windows

2016-02-26 Thread Zachary Turner via lldb-commits
zturner added a comment.

I don't know where we draw the line between `test/lang` and 
`test/functionalities` but I feel like the purpose of this test is just to make 
sure LLDB has the general ability to handle setting breakpoints on inline call 
sites.  With that in mind, it make more sense to have this test in 
`test/functionalities/inline-breakpoint`, but I don't think it's a big deal 
either way.



Comment at: packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.h:1-4
@@ +1,4 @@
+int inner_inline (int inner_input, int mod_value);
+int outer_inline (int outer_input);
+int not_inlined_2 (int input);
+int not_inlined_1 (int input);

Why do we need this header file now?  It wasn't here before.


http://reviews.llvm.org/D17650



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D17650: Fix TestInlines.py on Windows

2016-02-26 Thread Adrian McCarthy via lldb-commits
amccarth created this revision.
amccarth added reviewers: zturner, spyffe.
amccarth added a subscriber: lldb-commits.

The inlining semantics for C and C++ are different, which affects the test's 
expectation of the number of times the function should appear in the binary.  
In the case of this test, C semantics means there should be three instances of 
inner_inline, while C++ semantics means there should be only two.

On Windows, clang uses C++ inline semantics even for C code, and there doesn't 
seem to be a combination of compiler flags to avoid this.

So, for consistency, I've recast the test to use C++ everywhere.  Since the 
test resided under lang/c, it seemed appropriate to move it to lang/cpp.

This does not address the other XFAIL for this test on Linux/gcc.  See 
https://llvm.org/bugs/show_bug.cgi?id=26710

http://reviews.llvm.org/D17650

Files:
  packages/Python/lldbsuite/test/lang/c/inlines/Makefile
  packages/Python/lldbsuite/test/lang/c/inlines/TestInlines.py
  packages/Python/lldbsuite/test/lang/c/inlines/inlines.c
  packages/Python/lldbsuite/test/lang/c/inlines/inlines.h
  packages/Python/lldbsuite/test/lang/cpp/inlines/Makefile
  packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py
  packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.cpp
  packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.h

Index: packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.h
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.h
@@ -0,0 +1,4 @@
+int inner_inline (int inner_input, int mod_value);
+int outer_inline (int outer_input);
+int not_inlined_2 (int input);
+int not_inlined_1 (int input);
Index: packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.cpp
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/cpp/inlines/inlines.cpp
@@ -0,0 +1,53 @@
+#include 
+#include "inlines.h"
+
+#define INLINE_ME __inline__ __attribute__((always_inline))
+
+int
+not_inlined_2 (int input)
+{
+  printf ("Called in not_inlined_2 with : %d.\n", input);
+  return input;
+}
+
+int 
+not_inlined_1 (int input)
+{
+  printf ("Called in not_inlined_1 with %d.\n", input);
+  return not_inlined_2(input);
+}
+  
+INLINE_ME int
+inner_inline (int inner_input, int mod_value)
+{
+  int inner_result;
+  inner_result = inner_input % mod_value;
+  printf ("Returning: %d.\n", inner_result);
+  return not_inlined_1 (inner_result); // Set break point at this line.
+}
+
+INLINE_ME int
+outer_inline (int outer_input)
+{
+  int outer_result;
+
+  outer_result = inner_inline (outer_input, outer_input % 3);
+  return outer_result;
+}
+
+int
+main (int argc, char **argv)
+{
+  printf ("Starting...\n");
+
+  int (*func_ptr) (int);
+  func_ptr = outer_inline;
+
+  outer_inline (argc);
+
+  func_ptr (argc);
+
+  return 0;
+}
+
+
Index: packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py
===
--- /dev/null
+++ packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py
@@ -0,0 +1,52 @@
+"""Test variable lookup when stopped in inline functions."""
+
+from __future__ import print_function
+
+import os, time
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class InlinesTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break inside main().
+self.line = line_number('inlines.cpp', '// Set break point at this line.')
+
+@expectedFailureAll("llvm.org/pr26710", oslist=["linux"], compiler="gcc")
+def test(self):
+"""Test that local variables are visible in expressions."""
+self.build()
+self.runToBreakpoint()
+
+# Check that 'frame variable' finds a variable
+self.expect("frame variable inner_input", VARIABLES_DISPLAYED_CORRECTLY,
+startstr = '(int) inner_input =')
+
+# Check that 'expr' finds a variable
+self.expect("expr inner_input", VARIABLES_DISPLAYED_CORRECTLY,
+startstr = '(int) $0 =')
+
+def runToBreakpoint(self):
+exe = os.path.join(os.getcwd(), "a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+# Break inside the main.
+lldbutil.run_break_set_by_file_and_line(self, "inlines.cpp", self.line, num_expected_locations=2,
+loc_exact=True)
+
+self.runCmd("run", RUN_SUCCEEDED)
+
+# The stop reason of the thread should be breakpoint.
+self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+substrs = ['stopped',
+   'stop reason = breakpoint'])
+
+# The breakpoint should have a hit count of 1.
+

[Lldb-commits] [lldb] r262043 - remove unused local string in IRForTarget.cpp

2016-02-26 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Fri Feb 26 12:03:06 2016
New Revision: 262043

URL: http://llvm.org/viewvc/llvm-project?rev=262043=rev
Log:
remove unused local string in IRForTarget.cpp

Committed on behalf of: ldrumm 

Differential revision: http://reviews.llvm.org/D16412

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=262043=262042=262043=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Fri Feb 26 
12:03:06 2016
@@ -134,8 +134,6 @@ IRForTarget::FixFunctionLinkage(llvm::Fu
 {
 llvm_function.setLinkage(GlobalValue::ExternalLinkage);
 
-std::string name = llvm_function.getName().str();
-
 return true;
 }
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D16412: remove unused local string in IRForTarget.cpp

2016-02-26 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262043: remove unused local string in IRForTarget.cpp 
(authored by aidandodds).

Changed prior to commit:
  http://reviews.llvm.org/D16412?vs=48006=49206#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16412

Files:
  lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp

Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -134,8 +134,6 @@
 {
 llvm_function.setLinkage(GlobalValue::ExternalLinkage);
 
-std::string name = llvm_function.getName().str();
-
 return true;
 }
 


Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
===
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -134,8 +134,6 @@
 {
 llvm_function.setLinkage(GlobalValue::ExternalLinkage);
 
-std::string name = llvm_function.getName().str();
-
 return true;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D16412: remove unused local string in IRForTarget.cpp

2016-02-26 Thread Aidan Dodds via lldb-commits
ADodds added a subscriber: ADodds.
ADodds accepted this revision.
ADodds added a reviewer: ADodds.
ADodds added a comment.
This revision is now accepted and ready to land.

I'm happy to commit this for you.


http://reviews.llvm.org/D16412



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17618: Improve looking up functions with equivalent mangled names.

2016-02-26 Thread Greg Clayton via lldb-commits
clayborg resigned from this revision.
clayborg removed a reviewer: clayborg.
clayborg added a comment.

Sean should be the one to OK this.


http://reviews.llvm.org/D17618



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-02-26 Thread Jim Ingham via lldb-commits
jingham requested changes to this revision.
jingham added a reviewer: jingham.
jingham added a comment.
This revision now requires changes to proceed.

I agree with Zachary, it would be better to put it in PrivateResume before the 
call to WillResume.  Having this happen in Process::PrivateResume after taking 
the run lock is okay, that works correctly on OS X.

OTOH, the error reporting isn't correct there:

> > > lldb.process.Continue()

> 

> > 

> 



Process 64883 exited with status = 0 (0x)

> > > error = lldb.process.Continue()

> 

> > 

> 

> > >  print error

> 

> > 

> 


error: Resume timed out.

So this definitely needs fixing generically...

Process::WillResume only gets called in one place (Process::PrivateResume) so 
it is fine to just put the check there before calling WillResume.  When we have 
generic bits of work we want to do before or after a plugin method X we often 
make a virtual "DoX" and have that be the plugin method, and then X is not 
virtual and does the generic work.  But that seems overkill in this case, we 
just want to make sure the process is alive before calling into the plugins.


http://reviews.llvm.org/D17635



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-02-26 Thread Zachary Turner via lldb-commits
zturner added a comment.

It doesn't look like `Process::PrivateResume()` returns an error if the process 
is alive unless `WillResume()` returns an error, which is up to the individual 
process implementation.  So maybe the short circuit needs to happen there.  
This isn't really my area though so I'll defer to Jim on this review.


http://reviews.llvm.org/D17635



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-02-26 Thread Petr Hons via lldb-commits
Honsik added a comment.

I tried to put this check in PrivateResume, but its not that simple because of 
the public RUN lock. I am not that sure if it is safe to always unclock the 
lock inside PrivateResume.


http://reviews.llvm.org/D17635



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17167: Fix bug with register values byte order in expression evaluation

2016-02-26 Thread Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL262041: Fix bug with register values byte order in 
expression evaluation. (authored by aidandodds).

Changed prior to commit:
  http://reviews.llvm.org/D17167?vs=48486=49204#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17167

Files:
  lldb/trunk/source/Expression/Materializer.cpp

Index: lldb/trunk/source/Expression/Materializer.cpp
===
--- lldb/trunk/source/Expression/Materializer.cpp
+++ lldb/trunk/source/Expression/Materializer.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBAssert.h"
 
 using namespace lldb_private;
 
@@ -1275,9 +1276,14 @@
 m_register_contents.reset(new 
DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize()));
 
 Error write_error;
-
-map.WriteMemory(load_addr, register_data.GetDataStart(), 
register_data.GetByteSize(), write_error);
-
+
+Scalar scalar;
+reg_value.GetScalarValue(scalar);
+
+lldbassert(scalar.GetByteSize() == register_data.GetByteSize());
+
+map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), 
write_error);
+
 if (!write_error.Success())
 {
 err.SetErrorStringWithFormat("couldn't write the contents of 
register %s: %s", m_register_info.name, write_error.AsCString());


Index: lldb/trunk/source/Expression/Materializer.cpp
===
--- lldb/trunk/source/Expression/Materializer.cpp
+++ lldb/trunk/source/Expression/Materializer.cpp
@@ -26,6 +26,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBAssert.h"
 
 using namespace lldb_private;
 
@@ -1275,9 +1276,14 @@
 m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize()));
 
 Error write_error;
-
-map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error);
-
+
+Scalar scalar;
+reg_value.GetScalarValue(scalar);
+
+lldbassert(scalar.GetByteSize() == register_data.GetByteSize());
+
+map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), write_error);
+
 if (!write_error.Success())
 {
 err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262041 - Fix bug with register values byte order in expression evaluation.

2016-02-26 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Fri Feb 26 11:40:50 2016
New Revision: 262041

URL: http://llvm.org/viewvc/llvm-project?rev=262041=rev
Log:
Fix bug with register values byte order in expression evaluation.

The evaluation of expressions containing register values was broken for targets 
for which endianness differs from host.

Committed on behalf of: mamai 

Differential revision: http://reviews.llvm.org/D17167

Modified:
lldb/trunk/source/Expression/Materializer.cpp

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=262041=262040=262041=diff
==
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Fri Feb 26 11:40:50 2016
@@ -26,6 +26,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBAssert.h"
 
 using namespace lldb_private;
 
@@ -1275,9 +1276,14 @@ public:
 m_register_contents.reset(new 
DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize()));
 
 Error write_error;
-
-map.WriteMemory(load_addr, register_data.GetDataStart(), 
register_data.GetByteSize(), write_error);
-
+
+Scalar scalar;
+reg_value.GetScalarValue(scalar);
+
+lldbassert(scalar.GetByteSize() == register_data.GetByteSize());
+
+map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), 
write_error);
+
 if (!write_error.Success())
 {
 err.SetErrorStringWithFormat("couldn't write the contents of 
register %s: %s", m_register_info.name, write_error.AsCString());


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262040 - The IOHandlerProcessSTDIO is the _only_ IOHandler that gets pushed and popped from functions that are run due to something that is NOT input from the user. All other IO

2016-02-26 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Fri Feb 26 11:36:44 2016
New Revision: 262040

URL: http://llvm.org/viewvc/llvm-project?rev=262040=rev
Log:
The IOHandlerProcessSTDIO is the _only_ IOHandler that gets pushed and popped 
from functions that are run due to something that is NOT input from the user. 
All other IOHandler objects result from input from the user. An issue rose up 
where if a command caused the process to resume and stop and process state 
changed, where state changed Event objects were broadcast, it would cause the 
IOHandlerProcessSTDIO to have its IOHandlerProcessSTDIO::Cancel() function 
called. This used to always write a byte to the control pipe 
(IOHandlerProcessSTDIO::m_pipe) even if the IOHandlerProcessSTDIO::Run() was 
never called. What would happen is:

(lldb) command_that_steps_process_thousands_of_times

As the "command_that_steps_process_thousands_of_times" could be a python 
command that resumed the process thousands of times and in doing so the 
IOHandlerProcessSTDIO would get pushed when the process resumed, and popped 
when it stoppped, causing the call to IOHandlerProcessSTDIO::Cancel(). Since 
the IOHandler thread is currently in IOHandlerEditline::Run() for the command 
interpreter handling the "command_that_steps_process_thousands_of_times" 
command, IOHandlerProcessSTDIO::Run() would never get called, even though the 
IOHandlerProcessSTDIO is on the top of the stack. This caused the command pipe 
to keep getting 1 bytes written each time the IOHandlerProcessSTDIO::Cancel() 
was called and eventually we will deadlock since the write buffer is full.

The fix here is to make sure we are in IOHandlerProcessSTDIO::Run() before we 
write anything to the command pipe, and just call SetIsDone(true) if we are not.




Modified:
lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=262040=262039=262040=diff
==
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Feb 26 11:36:44 2016
@@ -4949,6 +4949,7 @@ public:
 // FD_ZERO, FD_SET are not supported on windows
 #ifndef _WIN32
 const int pipe_read_fd = m_pipe.GetReadFileDescriptor();
+m_is_running = true;
 while (!GetIsDone())
 {
 fd_set read_fdset;
@@ -4957,6 +4958,7 @@ public:
 FD_SET (pipe_read_fd, _fdset);
 const int nfds = std::max(read_fd, pipe_read_fd) + 1;
 int num_set_fds = select (nfds, _fdset, NULL, NULL, NULL);
+
 if (num_set_fds < 0)
 {
 const int select_errno = errno;
@@ -5000,6 +5002,7 @@ public:
 }
 }
 }
+m_is_running = false;
 #endif
 terminal_state.Restore();
 }
@@ -5007,9 +5010,24 @@ public:
 void
 Cancel () override
 {
-char ch = 'q';  // Send 'q' for quit
-size_t bytes_written = 0;
-m_pipe.Write(, 1, bytes_written);
+SetIsDone(true);
+// Only write to our pipe to cancel if we are in 
IOHandlerProcessSTDIO::Run().
+// We can end up with a python command that is being run from the 
command
+// interpreter:
+//
+// (lldb) step_process_thousands_of_times
+//
+// In this case the command interpreter will be in the middle of 
handling
+// the command and if the process pushes and pops the IOHandler 
thousands
+// of times, we can end up writing to m_pipe without ever consuming the
+// bytes from the pipe in IOHandlerProcessSTDIO::Run() and end up
+// deadlocking when the pipe gets fed up and blocks until data is 
consumed.
+if (m_is_running)
+{
+char ch = 'q';  // Send 'q' for quit
+size_t bytes_written = 0;
+m_pipe.Write(, 1, bytes_written);
+}
 }
 
 bool
@@ -5056,6 +5074,7 @@ protected:
 File m_read_file;   // Read from this file (usually actual STDIN for LLDB
 File m_write_file;  // Write to this file (usually the master pty for 
getting io to debuggee)
 Pipe m_pipe;
+std::atomic m_is_running;
 };
 
 void


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17635: Continue after process exit

2016-02-26 Thread Jim Ingham via lldb-commits
jingham added a subscriber: jingham.
jingham added a comment.

It's okay to short-circuit this here, but why was PrivateResume not returning 
an error when the process was not alive.  That error should have gotten 
propagated to the caller, obviating the need for this short-circuit.


http://reviews.llvm.org/D17635



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262028 - Add new java plugin files to the xcode project

2016-02-26 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Feb 26 09:47:35 2016
New Revision: 262028

URL: http://llvm.org/viewvc/llvm-project?rev=262028=rev
Log:
Add new java plugin files to the xcode project

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=262028=262027=262028=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Feb 26 09:47:35 2016
@@ -706,6 +706,12 @@
4CF3D80C15AF4DC800845BF3 /* Security.framework in Frameworks */ 
= {isa = PBXBuildFile; fileRef = EDB919B414F6F10D008FF64B /* Security.framework 
*/; };
4CF52AF51428291E0051E832 /* SBFileSpecList.h in Headers */ = 
{isa = PBXBuildFile; fileRef = 4CF52AF41428291E0051E832 /* SBFileSpecList.h */; 
settings = {ATTRIBUTES = (Public, ); }; };
4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 4CF52AF7142829390051E832 /* SBFileSpecList.cpp 
*/; };
+   6D0F61431C80AAAE00A4ECEE /* JavaASTContext.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 6D0F61411C8000A4ECEE /* JavaASTContext.cpp 
*/; settings = {ASSET_TAGS = (); }; };
+   6D0F61481C80AAD600A4ECEE /* DWARFASTParserJava.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 6D0F61441C80AACF00A4ECEE /* 
DWARFASTParserJava.cpp */; settings = {ASSET_TAGS = (); }; };
+   6D0F614E1C80AB0700A4ECEE /* JavaLanguageRuntime.cpp in Sources 
*/ = {isa = PBXBuildFile; fileRef = 6D0F614A1C80AB0400A4ECEE /* 
JavaLanguageRuntime.cpp */; settings = {ASSET_TAGS = (); }; };
+   6D0F614F1C80AB0C00A4ECEE /* JavaLanguageRuntime.h in Headers */ 
= {isa = PBXBuildFile; fileRef = 6D0F614B1C80AB0400A4ECEE /* 
JavaLanguageRuntime.h */; settings = {ASSET_TAGS = (); }; };
+   6D0F61591C80AB3500A4ECEE /* JavaFormatterFunctions.cpp in 
Sources */ = {isa = PBXBuildFile; fileRef = 6D0F61511C80AB3000A4ECEE /* 
JavaFormatterFunctions.cpp */; settings = {ASSET_TAGS = (); }; };
+   6D0F615A1C80AB3900A4ECEE /* JavaLanguage.cpp in Sources */ = 
{isa = PBXBuildFile; fileRef = 6D0F61531C80AB3000A4ECEE /* JavaLanguage.cpp */; 
settings = {ASSET_TAGS = (); }; };
6D55B2901A8A806200A70529 /* 
GDBRemoteCommunicationServerCommon.cpp in Sources */ = {isa = PBXBuildFile; 
fileRef = 6D55B28D1A8A806200A70529 /* GDBRemoteCommunicationServerCommon.cpp 
*/; };
6D55B2911A8A806200A70529 /* 
GDBRemoteCommunicationServerLLGS.cpp in Sources */ = {isa = PBXBuildFile; 
fileRef = 6D55B28E1A8A806200A70529 /* GDBRemoteCommunicationServerLLGS.cpp */; 
};
6D55B2921A8A806200A70529 /* 
GDBRemoteCommunicationServerPlatform.cpp in Sources */ = {isa = PBXBuildFile; 
fileRef = 6D55B28F1A8A806200A70529 /* GDBRemoteCommunicationServerPlatform.cpp 
*/; };
@@ -2417,6 +2423,17 @@
69A01E1E1236C5D400C660B5 /* Mutex.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = Mutex.cpp; sourceTree = ""; };
69A01E1F1236C5D400C660B5 /* Symbols.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = Symbols.cpp; sourceTree = ""; };
69A01E201236C5D400C660B5 /* TimeValue.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = TimeValue.cpp; sourceTree = ""; };
+   6D0F613C1C80AA8900A4ECEE /* DebugMacros.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
DebugMacros.h; path = include/lldb/Symbol/DebugMacros.h; sourceTree = 
""; };
+   6D0F613D1C80AA8900A4ECEE /* JavaASTContext.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = 
JavaASTContext.h; path = include/lldb/Symbol/JavaASTContext.h; sourceTree = 
""; };
+   6D0F61411C8000A4ECEE /* JavaASTContext.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = JavaASTContext.cpp; path = source/Symbol/JavaASTContext.cpp; sourceTree 
= ""; };
+   6D0F61441C80AACF00A4ECEE /* DWARFASTParserJava.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
path = DWARFASTParserJava.cpp; sourceTree = ""; };
+   6D0F61451C80AACF00A4ECEE /* DWARFASTParserJava.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
DWARFASTParserJava.h; sourceTree = ""; };
+   6D0F614A1C80AB0400A4ECEE /* JavaLanguageRuntime.cpp */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; 
name = JavaLanguageRuntime.cpp; path = Java/JavaLanguageRuntime.cpp; sourceTree 
= ""; };
+   

Re: [Lldb-commits] [PATCH] D17167: Fix bug with register values byte order in expression evaluation

2016-02-26 Thread Marianne Mailhot-Sarrasin via lldb-commits
mamai added a comment.

Are the changes correct? And if so, could someone commit it for me? I don't 
have commit access.


Repository:
  rL LLVM

http://reviews.llvm.org/D17167



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262023 - Revert part of rL262014 as it caused issues on gcc-i386

2016-02-26 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Feb 26 09:33:32 2016
New Revision: 262023

URL: http://llvm.org/viewvc/llvm-project?rev=262023=rev
Log:
Revert part of rL262014 as it caused issues on gcc-i386

Modified:
lldb/trunk/source/Expression/DWARFExpression.cpp

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=262023=262022=262023=diff
==
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Feb 26 09:33:32 2016
@@ -1380,7 +1380,6 @@ DWARFExpression::Evaluate
 intptr_t ptr;
 ::memcpy (, src, sizeof(void *));
 stack.back().GetScalar() = ptr;
-stack.back().SetValueType(Value::eValueTypeScalar);
 stack.back().ClearContext();
 }
 break;
@@ -1395,7 +1394,6 @@ DWARFExpression::Evaluate
 if (pointer_value != LLDB_INVALID_ADDRESS)
 {
 stack.back().GetScalar() = pointer_value;
-
stack.back().SetValueType(Value::eValueTypeScalar);
 stack.back().ClearContext();
 }
 else
@@ -1477,7 +1475,6 @@ DWARFExpression::Evaluate
 default: break;
 }
 stack.back().GetScalar() = ptr;
-stack.back().SetValueType(Value::eValueTypeScalar);
 stack.back().ClearContext();
 }
 break;
@@ -1501,7 +1498,6 @@ DWARFExpression::Evaluate
 case 8: stack.back().GetScalar() = 
addr_data.GetU64(_data_offset); break;
 default: stack.back().GetScalar() = 
addr_data.GetPointer(_data_offset);
 }
-
stack.back().SetValueType(Value::eValueTypeScalar);
 stack.back().ClearContext();
 }
 else


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32

2016-02-26 Thread Cameron via lldb-commits
cameron314 updated this revision to Diff 49185.

http://reviews.llvm.org/D17107

Files:
  lldb/trunk/cmake/modules/LLDBConfig.cmake
  lldb/trunk/include/lldb/Host/FileSystem.h
  lldb/trunk/include/lldb/Host/posix/HostInfoPosix.h
  lldb/trunk/include/lldb/Host/windows/HostInfoWindows.h
  lldb/trunk/packages/Python/lldbsuite/test/dotest.py
  lldb/trunk/source/Commands/CommandCompletions.cpp
  lldb/trunk/source/Core/ConnectionSharedMemory.cpp
  lldb/trunk/source/Core/Disassembler.cpp
  lldb/trunk/source/Host/common/File.cpp
  lldb/trunk/source/Host/common/FileSpec.cpp
  lldb/trunk/source/Host/posix/FileSystem.cpp
  lldb/trunk/source/Host/posix/HostInfoPosix.cpp
  lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp
  lldb/trunk/source/Host/windows/FileSystem.cpp
  lldb/trunk/source/Host/windows/Host.cpp
  lldb/trunk/source/Host/windows/HostInfoWindows.cpp
  lldb/trunk/source/Host/windows/HostProcessWindows.cpp
  lldb/trunk/source/Host/windows/PipeWindows.cpp
  lldb/trunk/source/Host/windows/ProcessLauncherWindows.cpp
  lldb/trunk/source/Host/windows/Windows.cpp
  lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp
  lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLive.cpp
  lldb/trunk/source/Plugins/Process/Windows/MiniDump/ProcessWinMiniDump.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  lldb/trunk/source/Target/ProcessLaunchInfo.cpp
  lldb/trunk/tools/driver/Driver.cpp
  lldb/trunk/tools/driver/Platform.h
  lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
  lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp
  lldb/trunk/tools/lldb-mi/Platform.h

Index: lldb/trunk/tools/lldb-mi/Platform.h
===
--- lldb/trunk/tools/lldb-mi/Platform.h
+++ lldb/trunk/tools/lldb-mi/Platform.h
@@ -60,7 +60,7 @@
 typedef long pid_t;
 
 #define STDIN_FILENO 0
-#define PATH_MAX MAX_PATH
+#define PATH_MAX 32768
 #define snprintf _snprintf
 
 extern int ioctl(int d, int request, ...);
Index: lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp
===
--- lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp
+++ lldb/trunk/tools/lldb-mi/MIUtilFileStd.cpp
@@ -17,6 +17,8 @@
 #include "MIUtilFileStd.h"
 #include "MICmnResources.h"
 
+#include "llvm/Support/ConvertUTF.h"
+
 //++ 
 // Details: CMIUtilFileStd constructor.
 // Type:Method.
@@ -82,7 +84,14 @@
 m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb");
 #else
 // Open a file with exclusive write and shared read permissions
-m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR);
+std::wstring path;
+if (llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path))
+m_pFileHandle = ::_wfsopen(path.c_str(), L"wb", _SH_DENYWR);
+else
+{
+errno = EINVAL;
+m_pFileHandle = nullptr;
+}
 #endif // !defined( _MSC_VER )
 
 if (m_pFileHandle == nullptr)
@@ -222,7 +231,14 @@
 return false;
 
 FILE *pTmp = nullptr;
+#if _WIN32
+std::wstring path;
+if (!llvm::ConvertUTF8toWide(vFileNamePath.c_str(), path))
+return false;
+pTmp = ::_wfopen(path.c_str(), L"wb");
+#else
 pTmp = ::fopen(vFileNamePath.c_str(), "wb");
+#endif
 if (pTmp != nullptr)
 {
 ::fclose(pTmp);
Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
===
--- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
+++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp
@@ -27,6 +27,7 @@
 #include "MICmnMIValueTuple.h"
 #include "MICmdData.h"
 #include "MICmnLLDBUtilSBValue.h"
+#include "Platform.h"
 
 //++ 
 // Details: CMICmnLLDBDebugSessionInfo constructor.
@@ -614,7 +615,7 @@
 {
 lldb::SBFrame  = const_cast(vrFrame);
 
-static char pBuffer[MAX_PATH];
+static char pBuffer[PATH_MAX];
 const MIuint nBytes = rFrame.GetLineEntry().GetFileSpec().GetPath([0], sizeof(pBuffer));
 MIunused(nBytes);
 CMIUtilString strResolvedPath([0]);
Index: lldb/trunk/tools/driver/Platform.h
===
--- lldb/trunk/tools/driver/Platform.h
+++ lldb/trunk/tools/driver/Platform.h
@@ -81,7 +81,7 @@
 typedef long pid_t;
 #define snprintf _snprintf
 extern sighandler_t signal( int sig, sighandler_t );
-#define PATH_MAX MAX_PATH
+#define PATH_MAX 32768
 #endif
 
 #define STDIN_FILENO 0
Index: lldb/trunk/tools/driver/Driver.cpp
===
--- lldb/trunk/tools/driver/Driver.cpp
+++ lldb/trunk/tools/driver/Driver.cpp
@@ -42,6 +42,7 @@
 #include "lldb/API/SBTarget.h"
 #include "lldb/API/SBThread.h"
 #include "lldb/API/SBProcess.h"
+#include "llvm/Support/ConvertUTF.h"
 
 #if 

Re: [Lldb-commits] [PATCH] D17107: [lldb] Unicode support on Win32

2016-02-26 Thread Cameron via lldb-commits
cameron314 added inline comments.


Comment at: lldb/trunk/source/Host/common/FileSpec.cpp:242
@@ -221,1 +241,3 @@
+path.push_back(0);
+path.pop_back();
 }

amccarth wrote:
> I recognize that you're just repeating the pattern from above, but ...
> 
> This seems whacky and dangerous.  It appears the attempt is to put a null 
> terminator on the end, but not count it in the length of the vector.  And I 
> guess that we know it's safe here because path is an llvm::SmallVector, so 
> the implementation details are known.  But, ugh.  If `path` were ever changed 
> to std::vector, we'd no longer have assurance that the terminator remains 
> after the pop.
I totally agree. Took me a few minutes before I figured out what it was doing 
the first time I saw it :-) This is also done in the existing 
`convertUTF8ToUTF16String` wrapper too.

All the implementations of `std::vector` that I know of will work with this, 
though as you say it's not guaranteed by the standard.

Looking more closely, I think in this case it was only done for the call to 
`stat`, which I've removed. I had added it here too in case the caller relied 
on this null trick, but I don't think it's necessary in either place anymore. 
I'll remove it.


Comment at: lldb/trunk/source/Host/windows/FileSystem.cpp:231
@@ -191,3 +230,3 @@
 
-char buf[PATH_MAX];
+wchar_t buf[PATH_MAX + 1];
 // Subtract 1 from the path length since this function does not add a null 
terminator.

amccarth wrote:
> I agree with Zach that a dynamic solution here is better.  It's already icky 
> that we have a 32KB stack buffer here.  Turning it into a 64KB +1B stack 
> buffer seem egregious.
Hah, yes. I'll replace this with a vector to start with.


http://reviews.llvm.org/D17107



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262021 - Add mips32 software breakpoints into platform::GetSoftwareBreakpointTrapOpcode().

2016-02-26 Thread Aidan Dodds via lldb-commits
Author: aidandodds
Date: Fri Feb 26 09:11:01 2016
New Revision: 262021

URL: http://llvm.org/viewvc/llvm-project?rev=262021=rev
Log:
Add mips32 software breakpoints into 
platform::GetSoftwareBreakpointTrapOpcode().

The software breakpoint definitions for mips32 should have been included in my
recent patch that moved the software breakpoint definitions into the base 
platform
class.

Modified:
lldb/trunk/source/Target/Platform.cpp

Modified: lldb/trunk/source/Target/Platform.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=262021=262020=262021=diff
==
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Fri Feb 26 09:11:01 2016
@@ -2096,6 +2096,7 @@ Platform::GetSoftwareBreakpointTrapOpcod
 }
 break;
 
+case llvm::Triple::mips:
 case llvm::Triple::mips64:
 {
 static const uint8_t g_hex_opcode[] = {0x00, 0x00, 0x00, 0x0d};
@@ -2104,6 +2105,7 @@ Platform::GetSoftwareBreakpointTrapOpcod
 }
 break;
 
+case llvm::Triple::mipsel:
 case llvm::Triple::mips64el:
 {
 static const uint8_t g_hex_opcode[] = {0x0d, 0x00, 0x00, 0x00};


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262016 - Fix address class lookup for absolute symbols

2016-02-26 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Feb 26 08:21:27 2016
New Revision: 262016

URL: http://llvm.org/viewvc/llvm-project?rev=262016=rev
Log:
Fix address class lookup for absolute symbols

Modified:
lldb/trunk/source/Symbol/ObjectFile.cpp

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=262016=262015=262016=diff
==
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Fri Feb 26 08:21:27 2016
@@ -379,13 +379,17 @@ ObjectFile::GetAddressClass (addr_t file
 case eSectionTypeARMextab:
 case eSectionTypeCompactUnwind:
 return eAddressClassRuntime;
-case eSectionTypeAbsoluteAddress:
 case eSectionTypeELFSymbolTable:
 case eSectionTypeELFDynamicSymbols:
 case eSectionTypeELFRelocationEntries:
 case eSectionTypeELFDynamicLinkInfo:
 case eSectionTypeOther:
 return eAddressClassUnknown;
+case eSectionTypeAbsoluteAddress:
+// In case of absolute sections decide the address 
class based on the symbol
+// type because the section type isn't specify if it 
is a code or a data
+// section.
+break;
 }
 }
 }


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D17616: Add a set of new plugins to handle Java debugging

2016-02-26 Thread Tamas Berghammer via lldb-commits
This revision was automatically updated to reflect the committed changes.
tberghammer marked 2 inline comments as done.
Closed by commit rL262015: Add a set of new plugins to handle Java debugging 
(authored by tberghammer).

Changed prior to commit:
  http://reviews.llvm.org/D17616?vs=49089=49180#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17616

Files:
  lldb/trunk/cmake/LLDBDependencies.cmake
  lldb/trunk/include/lldb/Symbol/JavaASTContext.h
  lldb/trunk/include/lldb/Symbol/TypeSystem.h
  lldb/trunk/source/API/SystemInitializerFull.cpp
  lldb/trunk/source/Plugins/Language/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/Java/CMakeLists.txt
  lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.cpp
  lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.h
  lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp
  lldb/trunk/source/Plugins/Language/Java/JavaLanguage.h
  lldb/trunk/source/Plugins/LanguageRuntime/CMakeLists.txt
  lldb/trunk/source/Plugins/LanguageRuntime/Java/CMakeLists.txt
  lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp
  lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/trunk/source/Symbol/CMakeLists.txt
  lldb/trunk/source/Symbol/JavaASTContext.cpp

Index: lldb/trunk/include/lldb/Symbol/JavaASTContext.h
===
--- lldb/trunk/include/lldb/Symbol/JavaASTContext.h
+++ lldb/trunk/include/lldb/Symbol/JavaASTContext.h
@@ -0,0 +1,382 @@
+//===-- JavaASTContext.h *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef liblldb_JavaASTContext_h_
+#define liblldb_JavaASTContext_h_
+
+// C Includes
+// C++ Includes
+#include 
+#include 
+#include 
+
+// Other libraries and framework includes
+// Project includes
+#include "lldb/Core/ConstString.h"
+#include "lldb/Symbol/TypeSystem.h"
+
+namespace lldb_private
+{
+
+class JavaASTContext : public TypeSystem
+{
+public:
+class JavaType;
+typedef std::map JavaTypeMap;
+
+JavaASTContext(const ArchSpec );
+~JavaASTContext() override;
+
+//--
+// PluginInterface functions
+//--
+ConstString
+GetPluginName() override;
+
+uint32_t
+GetPluginVersion() override;
+
+static ConstString
+GetPluginNameStatic();
+
+static lldb::TypeSystemSP
+CreateInstance(lldb::LanguageType language, Module *module, Target *target);
+
+static void
+EnumerateSupportedLanguages(std::set _for_types,
+std::set _for_expressions);
+
+static void
+Initialize();
+
+static void
+Terminate();
+
+DWARFASTParser *
+GetDWARFParser() override;
+
+uint32_t
+GetPointerByteSize() override;
+
+//--
+// CompilerDecl functions
+//--
+ConstString
+DeclGetName(void *opaque_decl) override;
+
+lldb::VariableSP
+DeclGetVariable(void *opaque_decl) override;
+
+void
+DeclLinkToObject(void *opaque_decl, std::shared_ptr object) override;
+
+//--
+// CompilerDeclContext functions
+//--
+
+std::vector
+DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_imported_decls) override;
+
+bool
+DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
+
+ConstString
+DeclContextGetName(void *opaque_decl_ctx) override;
+
+bool
+DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override;
+
+//--
+// Tests
+//--
+
+bool
+IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size,
+bool *is_incomplete) override;
+
+bool
+

Re: [Lldb-commits] [PATCH] D17616: Add a set of new plugins to handle Java debugging

2016-02-26 Thread Tamas Berghammer via lldb-commits
tberghammer marked 2 inline comments as done.


Comment at: source/Plugins/Language/Java/JavaLanguage.cpp:81
@@ +80,3 @@
+HardcodedFormatters::HardcodedSummaryFinder
+JavaLanguage::GetHardcodedSummaries()
+{

granata.enrico wrote:
> Is there any reason to use hardcoded summaries here?
> 
> It looks like IsJavaString is a trivial textual match on the string 
> "java.lang.String". If so, could you please avoid hardcoding this formatter?
> 
> The rationale is that an hardcoded formatter can never be turned off by the 
> user, whereas for a normal typename --> formatter match, the user has a way 
> to delete the individual formatter should they desire to do so.
> 
> Not a big deal, but would be great to fix if possible.
I don't think this is a formatter a user will ever turn off because without it 
there is no sensible way to display the content of the string (traversing into 
a member won't work because we don't have a "const char*" member) but I updated 
it anyway to be a normal type name based formatter based on your suggestion.


Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp:35
@@ +34,3 @@
+lldb::TypeSP
+DWARFASTParserJava::ParseTypeFromDWARF(const lldb_private::SymbolContext , 
const DWARFDIE ,
+   lldb_private::Log *log, bool 
*type_is_new_ptr)

ovyalov wrote:
> Please consider splitting this method in smaller sub-methods.
Done


Comment at: source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp:519
@@ +518,1 @@
+}
\ No newline at end of file


ovyalov wrote:
> Please fix.
Done


http://reviews.llvm.org/D17616



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262014 - Add support for DW_OP_push_object_address in dwarf expressions

2016-02-26 Thread Tamas Berghammer via lldb-commits
Author: tberghammer
Date: Fri Feb 26 08:21:10 2016
New Revision: 262014

URL: http://llvm.org/viewvc/llvm-project?rev=262014=rev
Log:
Add support for DW_OP_push_object_address in dwarf expressions

Additionally fix the type of some dwarf expression where we had a
confusion between scalar and load address types after a dereference.

Differential revision: http://reviews.llvm.org/D17604

Modified:
lldb/trunk/include/lldb/Expression/DWARFExpression.h
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Expression/DWARFExpression.cpp
lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/include/lldb/Expression/DWARFExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/DWARFExpression.h?rev=262014=262013=262014=diff
==
--- lldb/trunk/include/lldb/Expression/DWARFExpression.h (original)
+++ lldb/trunk/include/lldb/Expression/DWARFExpression.h Fri Feb 26 08:21:10 
2016
@@ -282,6 +282,7 @@ public:
   ClangExpressionDeclMap *decl_map,
   lldb::addr_t loclist_base_load_addr,
   const Value* initial_value_ptr,
+  const Value* object_address_ptr,
   Value& result,
   Error *error_ptr) const;
 
@@ -296,6 +297,7 @@ public:
   RegisterContext *reg_ctx,
   lldb::addr_t loclist_base_load_addr,
   const Value* initial_value_ptr,
+  const Value* object_address_ptr,
   Value& result,
   Error *error_ptr) const;
 
@@ -370,6 +372,7 @@ public:
   const lldb::offset_t length,
   const lldb::RegisterKind reg_set,
   const Value* initial_value_ptr,
+  const Value* object_address_ptr,
   Value& result,
   Error *error_ptr);
 

Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=262014=262013=262014=diff
==
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Fri Feb 26 08:21:10 2016
@@ -164,7 +164,15 @@ ValueObjectVariable::UpdateValue ()
 loclist_base_load_addr = 
sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (target);
 }
 Value old_value(m_value);
-if (expr.Evaluate (_ctx, NULL, NULL, NULL, loclist_base_load_addr, 
NULL, m_value, _error))
+if (expr.Evaluate (_ctx,
+   nullptr,
+   nullptr,
+   nullptr,
+   loclist_base_load_addr,
+   nullptr,
+   nullptr,
+   m_value,
+   _error))
 {
 m_resolved_value = m_value;
 m_value.SetContext(Value::eContextTypeVariable, variable);

Modified: lldb/trunk/source/Expression/DWARFExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/DWARFExpression.cpp?rev=262014=262013=262014=diff
==
--- lldb/trunk/source/Expression/DWARFExpression.cpp (original)
+++ lldb/trunk/source/Expression/DWARFExpression.cpp Fri Feb 26 08:21:10 2016
@@ -1108,12 +1108,21 @@ DWARFExpression::Evaluate
 ClangExpressionDeclMap *decl_map,
 lldb::addr_t loclist_base_load_addr,
 const Value* initial_value_ptr,
+const Value* object_address_ptr,
 Value& result,
 Error *error_ptr
 ) const
 {
 ExecutionContext exe_ctx (exe_scope);
-return Evaluate(_ctx, expr_locals, decl_map, NULL, 
loclist_base_load_addr, initial_value_ptr, result, error_ptr);
+return Evaluate(_ctx,
+expr_locals,
+decl_map,
+nullptr,
+loclist_base_load_addr,
+initial_value_ptr,
+object_address_ptr,
+result,
+error_ptr);
 }
 
 bool
@@ -1125,6 +1134,7 @@ DWARFExpression::Evaluate
 RegisterContext *reg_ctx,
 lldb::addr_t loclist_base_load_addr,
 const Value* initial_value_ptr,
+const Value* object_address_ptr,
 Value& result,
 Error *error_ptr
 ) const
@@ -1189,6 +1199,7 @@ DWARFExpression::Evaluate
   length,
   m_reg_kind,
   initial_value_ptr,
+ 

Re: [Lldb-commits] [PATCH] D17131: [LLDB][MIPS] Fix TestInferiorAssert.py for MIPS

2016-02-26 Thread Sagar Thakur via lldb-commits
sagar closed this revision.
sagar added a comment.

Committed in revision 262011.


Repository:
  rL LLVM

http://reviews.llvm.org/D17131



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r262011 - [LLDB][MIPS] Fix TestInferiorAssert.py for MIPS

2016-02-26 Thread Sagar Thakur via lldb-commits
Author: slthakur
Date: Fri Feb 26 07:30:34 2016
New Revision: 262011

URL: http://llvm.org/viewvc/llvm-project?rev=262011=rev
Log:
[LLDB][MIPS] Fix TestInferiorAssert.py for MIPS

Patch by Nitesh Jain.

Summary: The debug version of libc.so is require for backtracing which may not 
be available on all platforms.

Reviewers: ovyalov, clayborg
Subscribers: zturner, lldb-commits, mohit.bhakkad, sagar, bhushan, jaydeep
Differential: http://reviews.llvm.org/D17131

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py?rev=262011=262010=262011=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/inferior-assert/TestInferiorAssert.py
 Fri Feb 26 07:30:34 2016
@@ -17,6 +17,7 @@ class AssertingInferiorTestCase(TestBase
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need 
to implement support for detecting assertion / abort on Windows")
 @expectedFailureAll(oslist=["linux"], archs=["arm"], 
bugnumber="llvm.org/pr25338")
+@expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
 def test_inferior_asserting(self):
 """Test that lldb reliably catches the inferior asserting (command)."""
 self.build()
@@ -31,6 +32,7 @@ class AssertingInferiorTestCase(TestBase
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need 
to implement support for detecting assertion / abort on Windows")
 @expectedFailureAll(oslist=["linux"], archs=["aarch64", "arm"], 
bugnumber="llvm.org/pr25338")
+@expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
 def test_inferior_asserting_disassemble(self):
 """Test that lldb reliably disassembles frames after asserting 
(command)."""
 self.build()
@@ -45,6 +47,7 @@ class AssertingInferiorTestCase(TestBase
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need 
to implement support for detecting assertion / abort on Windows")
 @expectedFailureAll(oslist=["linux"], archs=["aarch64", "arm"], 
bugnumber="llvm.org/pr25338")
+@expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
 def test_inferior_asserting_expr(self):
 """Test that the lldb expression interpreter can read from the 
inferior after asserting (command)."""
 self.build()
@@ -52,6 +55,7 @@ class AssertingInferiorTestCase(TestBase
 
 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21793: need 
to implement support for detecting assertion / abort on Windows")
 @expectedFailureAll(oslist=["linux"], archs=["aarch64", "arm"], 
bugnumber="llvm.org/pr25338")
+@expectedFailureAll(bugnumber="llvm.org/pr26592", triple = '^mips')
 def test_inferior_asserting_step(self):
 """Test that lldb functions correctly after stepping through a call to 
assert()."""
 self.build()


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits