[Lldb-commits] [PATCH] D14493: [MIPS][LLDB]Fix TestBreakpointCondition.py for MIPS

2015-11-09 Thread Nitesh Jain via lldb-commits
nitesh.jain created this revision.
nitesh.jain added reviewers: clayborg, ovyalov.
nitesh.jain added subscribers: jaydeep, bhushan, sagar, mohit.bhakkad, 
lldb-commits.
nitesh.jain set the repository for this revision to rL LLVM.

The self.getArchitecture() returns the architecture based on the value of "-A" 
flag passed to dotest.py script. 
There are many possible values for MIPS to this option (like mips32r2, 
mips32r6, mips64, mips64r2, ). 
This patch uses re.match("mips",arch) to check if architecture string starts 
with mips.

Repository:
  rL LLVM

http://reviews.llvm.org/D14493

Files:
  
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py

Index: 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
===
--- 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ 
packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -103,12 +103,15 @@
 self.runCmd("breakpoint disable")
 
 self.runCmd("breakpoint set -p Loop")
-if self.getArchitecture() in ['x86_64', 'i386']:
+arch = self.getArchitecture()
+if arch in ['x86_64', 'i386']:
 self.runCmd("breakpoint modify -c ($eax&&i)")
-elif self.getArchitecture() in ['aarch64']:
+elif arch in ['aarch64']:
 self.runCmd("breakpoint modify -c ($x1&&i)")
-elif self.getArchitecture() in ['arm']:
+elif arch in ['arm']:
 self.runCmd("breakpoint modify -c ($r0&&i)")
+elif re.match("mips",arch):
+self.runCmd("breakpoint modify -c ($r2&&i)")
 self.runCmd("run")
 
 self.expect("process status", PROCESS_STOPPED,


Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
===
--- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -103,12 +103,15 @@
 self.runCmd("breakpoint disable")
 
 self.runCmd("breakpoint set -p Loop")
-if self.getArchitecture() in ['x86_64', 'i386']:
+arch = self.getArchitecture()
+if arch in ['x86_64', 'i386']:
 self.runCmd("breakpoint modify -c ($eax&&i)")
-elif self.getArchitecture() in ['aarch64']:
+elif arch in ['aarch64']:
 self.runCmd("breakpoint modify -c ($x1&&i)")
-elif self.getArchitecture() in ['arm']:
+elif arch in ['arm']:
 self.runCmd("breakpoint modify -c ($r0&&i)")
+elif re.match("mips",arch):
+self.runCmd("breakpoint modify -c ($r2&&i)")
 self.runCmd("run")
 
 self.expect("process status", PROCESS_STOPPED,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r252498 - Add --curses shortcut for specifying the curses-based test results formatter.

2015-11-09 Thread Todd Fiala via lldb-commits
Author: tfiala
Date: Mon Nov  9 12:51:04 2015
New Revision: 252498

URL: http://llvm.org/viewvc/llvm-project?rev=252498&view=rev
Log:
Add --curses shortcut for specifying the curses-based test results formatter.

This commit closes the following review:
http://reviews.llvm.org/D14488

Modified:
lldb/trunk/packages/Python/lldbsuite/test/dosep.py
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/dosep.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dosep.py?rev=252498&r1=252497&r2=252498&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dosep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dosep.py Mon Nov  9 12:51:04 2015
@@ -1227,6 +1227,10 @@ def adjust_inferior_options(dotest_argv)
 _remove_option(dotest_argv, "--results-formatter-option", "-O",
True)
 
+# Remove the --curses shortcut if specified.
+if dotest_options.curses:
+_remove_option(dotest_argv, "--curses", None, False)
+
 # Remove test runner name if present.
 if dotest_options.test_runner_name is not None:
 _remove_option(dotest_argv, "--test-runner-name", None, True)

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=252498&r1=252497&r2=252498&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Nov  9 12:51:04 2015
@@ -22,7 +22,6 @@ from __future__ import absolute_import
 from __future__ import print_function
 
 # System modules
-import sys
 import atexit
 import importlib
 import os
@@ -751,6 +750,11 @@ def parseOptionsAndInitTestdirs():
 test_runner_name = args.test_runner_name
 
 # Capture test results-related args.
+if args.curses and not args.inferior:
+# Act as if the following args were set.
+args.results_formatter = "lldbsuite.test.curses_results.Curses"
+args.results_file = "stdout"
+
 if args.results_file:
 results_filename = args.results_file
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=252498&r1=252497&r2=252498&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Mon Nov  9 
12:51:04 2015
@@ -151,6 +151,10 @@ def create_parser():
 # Test results support.
 group = parser.add_argument_group('Test results options')
 group.add_argument(
+'--curses',
+action='store_true',
+help='Shortcut for specifying test results using the curses formatter')
+group.add_argument(
 '--results-file',
 action='store',
 help=('Specifies the file where test results will be written '


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


Re: [Lldb-commits] [PATCH] D14488: Add --curses shortcut for specifying the curses-based test results formatter.

2015-11-09 Thread Todd Fiala via lldb-commits
tfiala closed this revision.
tfiala added a comment.

Closed by commit:

  Committed r252498
M   packages/Python/lldbsuite/test/dosep.py
M   packages/Python/lldbsuite/test/dotest_args.py
M   packages/Python/lldbsuite/test/dotest.py


http://reviews.llvm.org/D14488



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


[Lldb-commits] [lldb] r252503 - Add a way for source languages to "mark" ValueObjects with language-specific flags

2015-11-09 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  9 13:27:34 2015
New Revision: 252503

URL: http://llvm.org/viewvc/llvm-project?rev=252503&view=rev
Log:
Add a way for source languages to "mark" ValueObjects with language-specific 
flags
In this way, when a language needs to tell itself things that are not bound to 
a type but to a value (imagine a base-class relation, this is not about the 
type, but about the ValueObject), it can do so in a clean and general fashion

The interpretation of the values of the flags is, of course, up to the language 
that owns the value (the value object's runtime language, that is)


Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectChild.h
lldb/trunk/include/lldb/Core/ValueObjectConstResultChild.h
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/GoASTContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectChild.cpp
lldb/trunk/source/Core/ValueObjectConstResultChild.cpp
lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
lldb/trunk/source/Symbol/GoASTContext.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=252503&r1=252502&r2=252503&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Mon Nov  9 13:27:34 2015
@@ -1006,6 +1006,12 @@ public:
 
 virtual bool
 IsRuntimeSupportValue ();
+
+virtual uint64_t
+GetLanguageFlags ();
+
+virtual void
+SetLanguageFlags (uint64_t flags);
 
 protected:
 typedef ClusterManager ValueObjectManager;
@@ -1124,6 +1130,8 @@ protected:
 
 lldb::LanguageType m_preferred_display_language;
 
+uint64_t m_language_flags;
+
 boolm_value_is_valid:1,
 m_value_did_change:1,
 m_children_count_valid:1,

Modified: lldb/trunk/include/lldb/Core/ValueObjectChild.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectChild.h?rev=252503&r1=252502&r2=252503&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectChild.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectChild.h Mon Nov  9 13:27:34 2015
@@ -123,7 +123,8 @@ protected:
   uint32_t bitfield_bit_offset,
   bool is_base_class,
   bool is_deref_of_parent,
-  AddressType child_ptr_or_ref_addr_type);
+  AddressType child_ptr_or_ref_addr_type,
+  uint64_t language_flags);
 
 DISALLOW_COPY_AND_ASSIGN (ValueObjectChild);
 };

Modified: lldb/trunk/include/lldb/Core/ValueObjectConstResultChild.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectConstResultChild.h?rev=252503&r1=252502&r2=252503&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectConstResultChild.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectConstResultChild.h Mon Nov  9 
13:27:34 2015
@@ -35,7 +35,8 @@ public:
  uint32_t bitfield_bit_offset,
  bool is_base_class,
  bool is_deref_of_parent,
- lldb::addr_t live_address = 
LLDB_INVALID_ADDRESS);
+ lldb::addr_t live_address,
+ uint64_t language_flags);
 
 ~ValueObjectConstResultChild() override;
 

Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=252503&r1=252502&r2=252503&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Mon Nov  9 13:27:34 
2015
@@ -106,6 +106,12 @@ public:
 
 bool
 GetDeclaration(Declaration &decl) override;
+
+uint64_t
+GetLanguageFlags () override;
+
+void
+SetLanguageFlags (uint64_t flags) override;
 
 protected:
 bool

Modified: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h
URL: 
http://llvm.org

[Lldb-commits] [PATCH] D14507: Make sure we use symbol flags to detect thumbness.

2015-11-09 Thread Stephane Sezer via lldb-commits
sas created this revision.
sas added reviewers: tberghammer, clayborg.
sas added a subscriber: lldb-commits.
Herald added a subscriber: rengolin.

This was GetAddressClass' behavior before. This is required when
debugging binaries that don't have mapping symbols ($a, $t, etc). These
binaries will only have the lower bit of the address set in the symbol
table.

http://reviews.llvm.org/D14507

Files:
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -972,9 +972,29 @@
 auto ub = m_address_class_map.upper_bound(file_addr);
 if (ub == m_address_class_map.begin())
 {
-// No entry in the address class map before the address. Return
-// default address class for an address in a code section.
-return eAddressClassCode;
+// No entry in the address class map before the address. Try finding
+// the address class by using symbol flags, otherwise return default
+// address class for an address in a code section.
+
+ArchSpec arch_spec;
+GetArchitecture(arch_spec);
+if (arch_spec.GetMachine() != llvm::Triple::arm)
+return res;
+
+auto symtab = GetSymtab();
+if (symtab == nullptr)
+return res;
+
+auto symbol = symtab->FindSymbolContainingFileAddress(file_addr);
+if (symbol == nullptr)
+return res;
+
+// Thumb symbols have the lower bit set in the flags field so we just 
check
+// for that.
+if (symbol->GetFlags() & ARM_ELF_SYM_IS_THUMB)
+res = eAddressClassCodeAlternateISA;
+
+return res;
 }
 
 // Move iterator to the address class entry preceding address


Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -972,9 +972,29 @@
 auto ub = m_address_class_map.upper_bound(file_addr);
 if (ub == m_address_class_map.begin())
 {
-// No entry in the address class map before the address. Return
-// default address class for an address in a code section.
-return eAddressClassCode;
+// No entry in the address class map before the address. Try finding
+// the address class by using symbol flags, otherwise return default
+// address class for an address in a code section.
+
+ArchSpec arch_spec;
+GetArchitecture(arch_spec);
+if (arch_spec.GetMachine() != llvm::Triple::arm)
+return res;
+
+auto symtab = GetSymtab();
+if (symtab == nullptr)
+return res;
+
+auto symbol = symtab->FindSymbolContainingFileAddress(file_addr);
+if (symbol == nullptr)
+return res;
+
+// Thumb symbols have the lower bit set in the flags field so we just check
+// for that.
+if (symbol->GetFlags() & ARM_ELF_SYM_IS_THUMB)
+res = eAddressClassCodeAlternateISA;
+
+return res;
 }
 
 // Move iterator to the address class entry preceding address
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r252381 - Python 3 - Don't use unbuffered I/O in text mode.

2015-11-09 Thread Todd Fiala via lldb-commits
The reason you probably want this unbuffered is for cases where you crash.
When a dotest.py process crashes, the buffered content won't necessarily
get flushed.  So the session file may or may not contain the last thing
that happened in that case.

I think we want it unbuffered where we can.

-Todd

On Fri, Nov 6, 2015 at 5:08 PM, Zachary Turner via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: zturner
> Date: Fri Nov  6 19:08:15 2015
> New Revision: 252381
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252381&view=rev
> Log:
> Python 3 - Don't use unbuffered I/O in text mode.
>
> This is unsupported in Python 3.  This could also have been fixed
> by using "wb" instead of "w", but it doesn't seem like writing the
> session log absolutely *needs* to be unbuffered.
>
> Modified:
> lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=252381&r1=252380&r2=252381&view=diff
>
> ==
> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Nov  6
> 19:08:15 2015
> @@ -1413,8 +1413,8 @@ class Base(unittest2.TestCase):
>  self.log_basename = self.getLogBasenameForCurrentTest()
>
>  session_file = "{}.log".format(self.log_basename)
> -unbuffered = 0 # 0 is the constant for unbuffered
> -self.session = open(session_file, "w", unbuffered)
> +# Python 3 doesn't support unbuffered I/O in text mode.  Open
> buffered.
> +self.session = open(session_file, "w")
>
>  # Optimistically set __errored__, __failed__, __expected__ to
> False
>  # initially.  If the test errored/failed, the session info
>
>
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>



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


Re: [Lldb-commits] [PATCH] D14507: Make sure we use symbol flags to detect thumbness.

2015-11-09 Thread Greg Clayton via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

You should populate the m_address_class_map in ObjectFileELF::ParseSymbols() as 
this is where the m_address_class_map is already being populated. For ARM 
symbols, just check the flags and add an appropriate entry. Then this code 
doesn't need to exist here, but be moved into ObjectFileELF::ParseSymbols().


http://reviews.llvm.org/D14507



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


Re: [Lldb-commits] [PATCH] D14507: Make sure we use symbol flags to detect thumbness.

2015-11-09 Thread Greg Clayton via lldb-commits
clayborg added a comment.

See Inlined comment.



Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:975-997
@@ -974,5 +974,25 @@
 {
-// No entry in the address class map before the address. Return
-// default address class for an address in a code section.
-return eAddressClassCode;
+// No entry in the address class map before the address. Try finding
+// the address class by using symbol flags, otherwise return default
+// address class for an address in a code section.
+
+ArchSpec arch_spec;
+GetArchitecture(arch_spec);
+if (arch_spec.GetMachine() != llvm::Triple::arm)
+return res;
+
+auto symtab = GetSymtab();
+if (symtab == nullptr)
+return res;
+
+auto symbol = symtab->FindSymbolContainingFileAddress(file_addr);
+if (symbol == nullptr)
+return res;
+
+// Thumb symbols have the lower bit set in the flags field so we just 
check
+// for that.
+if (symbol->GetFlags() & ARM_ELF_SYM_IS_THUMB)
+res = eAddressClassCodeAlternateISA;
+
+return res;
 }

Remove this and move it to ObjectFileELF::ParseSymbols()


http://reviews.llvm.org/D14507



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


Re: [Lldb-commits] [lldb] r252381 - Python 3 - Don't use unbuffered I/O in text mode.

2015-11-09 Thread Zachary Turner via lldb-commits
Hmm, ok.  I'll loop back around to this when I get some cycles.  Still
working on Python 3 stuff so I don't think this will fall off my radar

On Mon, Nov 9, 2015 at 12:56 PM Todd Fiala  wrote:

> The reason you probably want this unbuffered is for cases where you
> crash.  When a dotest.py process crashes, the buffered content won't
> necessarily get flushed.  So the session file may or may not contain the
> last thing that happened in that case.
>
> I think we want it unbuffered where we can.
>
> -Todd
>
> On Fri, Nov 6, 2015 at 5:08 PM, Zachary Turner via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>> Author: zturner
>> Date: Fri Nov  6 19:08:15 2015
>> New Revision: 252381
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=252381&view=rev
>> Log:
>> Python 3 - Don't use unbuffered I/O in text mode.
>>
>> This is unsupported in Python 3.  This could also have been fixed
>> by using "wb" instead of "w", but it doesn't seem like writing the
>> session log absolutely *needs* to be unbuffered.
>>
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=252381&r1=252380&r2=252381&view=diff
>>
>> ==
>> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Nov  6
>> 19:08:15 2015
>> @@ -1413,8 +1413,8 @@ class Base(unittest2.TestCase):
>>  self.log_basename = self.getLogBasenameForCurrentTest()
>>
>>  session_file = "{}.log".format(self.log_basename)
>> -unbuffered = 0 # 0 is the constant for unbuffered
>> -self.session = open(session_file, "w", unbuffered)
>> +# Python 3 doesn't support unbuffered I/O in text mode.  Open
>> buffered.
>> +self.session = open(session_file, "w")
>>
>>  # Optimistically set __errored__, __failed__, __expected__ to
>> False
>>  # initially.  If the test errored/failed, the session info
>>
>>
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
>
>
>
> --
> -Todd
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D13073: Add an expression parser for Go

2015-11-09 Thread Dawn Perchik via lldb-commits
dawn added a subscriber: dawn.
dawn closed this revision.
dawn added a comment.

This was committed in svn r251820.


Repository:
  rL LLVM

http://reviews.llvm.org/D13073



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


Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.

2015-11-09 Thread Dawn Perchik via lldb-commits
dawn added a subscriber: dawn.
dawn added a reviewer: evgeny777.
dawn added a comment.

Eugene has been doing some work in this area - perhaps he can accept this patch 
for you.


http://reviews.llvm.org/D12809



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


[Lldb-commits] [lldb] r252516 - Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the ValueObject itself also gets a say in the process; NFC

2015-11-09 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  9 15:28:55 2015
New Revision: 252516

URL: http://llvm.org/viewvc/llvm-project?rev=252516&view=rev
Log:
Extend the TypeSystem's ShouldPrintAsOneLiner implementation so that the 
ValueObject itself also gets a say in the process; NFC

Modified:
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/DataFormatters/FormatManager.cpp
lldb/trunk/source/Symbol/CompilerType.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=252516&r1=252515&r2=252516&view=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Mon Nov  9 15:28:55 2015
@@ -470,7 +470,7 @@ public:
 GetTypeForFormatters () const;
 
 LazyBool
-ShouldPrintAsOneLiner () const;
+ShouldPrintAsOneLiner (ValueObject* valobj) const;
 
 bool
 IsMeaninglessWithoutDynamicResolution () const;

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=252516&r1=252515&r2=252516&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Mon Nov  9 15:28:55 2015
@@ -531,7 +531,7 @@ public:
 GetTypeForFormatters (void* type);
 
 virtual LazyBool
-ShouldPrintAsOneLiner (void* type);
+ShouldPrintAsOneLiner (void* type, ValueObject* valobj);
 
 // Type systems can have types that are placeholder types, which are meant 
to indicate
 // the presence of a type, but offer no actual information about said 
types, and leave

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=252516&r1=252515&r2=252516&view=diff
==
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Mon Nov  9 15:28:55 2015
@@ -568,7 +568,7 @@ FormatManager::ShouldPrintAsOneLiner (Va
 CompilerType compiler_type(valobj.GetCompilerType());
 if (compiler_type.IsValid())
 {
-switch (compiler_type.ShouldPrintAsOneLiner())
+switch (compiler_type.ShouldPrintAsOneLiner(&valobj))
 {
 case eLazyBoolNo:
 return false;
@@ -590,6 +590,23 @@ FormatManager::ShouldPrintAsOneLiner (Va
 // something is wrong here - bail out
 if (!child_sp)
 return false;
+
+// also ask the child's type if it has any opinion
+CompilerType child_compiler_type(child_sp->GetCompilerType());
+if (child_compiler_type.IsValid())
+{
+switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get()))
+{
+case eLazyBoolYes:
+// an opinion of yes is only binding for the child, so 
keep going
+case eLazyBoolCalculate:
+break;
+case eLazyBoolNo:
+// but if the child says no, then it's a veto on the whole 
thing
+return false;
+}
+}
+
 // if we decided to define synthetic children for a type, we probably 
care enough
 // to show them, but avoid nesting children in children
 if (child_sp->GetSyntheticChildren().get() != nullptr)

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=252516&r1=252515&r2=252516&view=diff
==
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Mon Nov  9 15:28:55 2015
@@ -870,10 +870,10 @@ CompilerType::GetTypeForFormatters () co
 }
 
 LazyBool
-CompilerType::ShouldPrintAsOneLiner () const
+CompilerType::ShouldPrintAsOneLiner (ValueObject* valobj) const
 {
 if (IsValid())
-return m_type_system->ShouldPrintAsOneLiner(m_type);
+return m_type_system->ShouldPrintAsOneLiner(m_type, valobj);
 return eLazyBoolCalculate;
 }
 

Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=252516&r1=252515&r2=252516&view=diff
==
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Mon Nov  9 15:28:55 2015
@@ -110,7 +110,7 @@ TypeSystem::GetTypeForFormatters (void*
 }
 
 LazyBool

Re: [Lldb-commits] [PATCH] D12809: Better scheme to lookup alternate mangled name when looking up function address.

2015-11-09 Thread Dawn Perchik via lldb-commits
dawn requested changes to this revision.
dawn added a reviewer: dawn.
dawn added a comment.
This revision now requires changes to proceed.

1. Please rebase again - this patch no longer applies cleanly, and fails to 
build after fixing merge conflicts.
2. Please add tests.


http://reviews.llvm.org/D12809



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


Re: [Lldb-commits] [lldb] r252381 - Python 3 - Don't use unbuffered I/O in text mode.

2015-11-09 Thread Todd Fiala via lldb-commits
Sounds good.

Not super critical, but I'd definitely rather it stay unbuffered where
possible.

On Mon, Nov 9, 2015 at 1:10 PM, Zachary Turner  wrote:

> Hmm, ok.  I'll loop back around to this when I get some cycles.  Still
> working on Python 3 stuff so I don't think this will fall off my radar
>
> On Mon, Nov 9, 2015 at 12:56 PM Todd Fiala  wrote:
>
>> The reason you probably want this unbuffered is for cases where you
>> crash.  When a dotest.py process crashes, the buffered content won't
>> necessarily get flushed.  So the session file may or may not contain the
>> last thing that happened in that case.
>>
>> I think we want it unbuffered where we can.
>>
>> -Todd
>>
>> On Fri, Nov 6, 2015 at 5:08 PM, Zachary Turner via lldb-commits <
>> lldb-commits@lists.llvm.org> wrote:
>>
>>> Author: zturner
>>> Date: Fri Nov  6 19:08:15 2015
>>> New Revision: 252381
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=252381&view=rev
>>> Log:
>>> Python 3 - Don't use unbuffered I/O in text mode.
>>>
>>> This is unsupported in Python 3.  This could also have been fixed
>>> by using "wb" instead of "w", but it doesn't seem like writing the
>>> session log absolutely *needs* to be unbuffered.
>>>
>>> Modified:
>>> lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>>>
>>> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=252381&r1=252380&r2=252381&view=diff
>>>
>>> ==
>>> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
>>> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Nov  6
>>> 19:08:15 2015
>>> @@ -1413,8 +1413,8 @@ class Base(unittest2.TestCase):
>>>  self.log_basename = self.getLogBasenameForCurrentTest()
>>>
>>>  session_file = "{}.log".format(self.log_basename)
>>> -unbuffered = 0 # 0 is the constant for unbuffered
>>> -self.session = open(session_file, "w", unbuffered)
>>> +# Python 3 doesn't support unbuffered I/O in text mode.  Open
>>> buffered.
>>> +self.session = open(session_file, "w")
>>>
>>>  # Optimistically set __errored__, __failed__, __expected__ to
>>> False
>>>  # initially.  If the test errored/failed, the session info
>>>
>>>
>>> ___
>>> lldb-commits mailing list
>>> lldb-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>>
>>
>>
>>
>> --
>> -Todd
>>
>


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


[Lldb-commits] [lldb] r252521 - Avoid sending bare '*' and '}' in an lldb-server packet

2015-11-09 Thread Tim Northover via lldb-commits
Author: tnorthover
Date: Mon Nov  9 16:05:05 2015
New Revision: 252521

URL: http://llvm.org/viewvc/llvm-project?rev=252521&view=rev
Log:
Avoid sending bare '*' and '}' in an lldb-server packet

They get treated as special RLE encoding symbols and packets get
corrupted. Most other packet types already know about this apparently,
but QEnvironment missed these two.

Should fix PR25300.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py

lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py?rev=252521&r1=252520&r2=252521&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/TestProcessLaunch.py
 Mon Nov  9 16:05:05 2015
@@ -178,3 +178,24 @@ class ProcessLaunchTestCase(TestBase):
 
 if not success:
 self.fail(err_msg)
+
+def test_environment_with_special_char (self):
+"""Test that environment variables containing '*' and '}' are 
communicated correctly to the lldb-server."""
+d = {'CXX_SOURCES' : 'print_env.cpp'}
+self.build(dictionary=d)
+self.setTearDownCleanup(d)
+exe = os.path.join (os.getcwd(), "a.out")
+
+evil_var = 'INIT*MIDDLE}TAIL'
+
+target = self.dbg.CreateTarget(exe)
+process = target.LaunchSimple(None, ['EVIL=' + evil_var], 
self.get_process_working_directory())
+self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+
+out = process.GetSTDOUT(len(evil_var))[:len(evil_var)]
+if out != evil_var:
+self.fail('The environment variable was mis-coded: %s\n' % 
repr(out))
+
+newline = process.GetSTDOUT(1)[0]
+if newline != '\r' and newline != '\n':
+self.fail('Garbage at end of environment variable')

Added: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp?rev=252521&view=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_launch/print_env.cpp
 Mon Nov  9 16:05:05 2015
@@ -0,0 +1,11 @@
+#include 
+#include 
+#include 
+
+int main (int argc, char **argv)
+{
+  char *evil = getenv("EVIL");
+  puts(evil);
+
+  return 0;
+}

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=252521&r1=252520&r2=252521&view=diff
==
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp 
Mon Nov  9 16:05:05 2015
@@ -1584,6 +1584,7 @@ GDBRemoteCommunicationClient::SendEnviro
 case '$':
 case '#':
 case '*':
+case '}':
 send_hex_encoding = true;
 break;
 default:


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


Re: [Lldb-commits] [PATCH] Fix for PR25300

2015-11-09 Thread Tim Northover via lldb-commits
On 3 November 2015 at 07:38, Pavel Labath  wrote:
> Looks good, but I'd like to avoid adding new "not remote ready" tests
> to the test suite. Your test looks like it should be easy to fix --
> the only problem there is the stdout redirection. If you *don't*
> redirect the output, you should be able to access the stdout via
> self.process.GetSTDOUT() and verify that.

Thanks Pavel, that made the test quite a bit simpler. I've committed
it in r252521.

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


[Lldb-commits] [lldb] r252529 - Rework the way in which ValueObjectChild decides how to update itself; this is a slight refactoring that I need as part of a larger master plan. As such, should be NFC

2015-11-09 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  9 17:07:55 2015
New Revision: 252529

URL: http://llvm.org/viewvc/llvm-project?rev=252529&view=rev
Log:
Rework the way in which ValueObjectChild decides how to update itself; this is 
a slight refactoring that I need as part of a larger master plan. As such, 
should be NFC

Modified:
lldb/trunk/include/lldb/Symbol/CompilerType.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/source/Core/ValueObjectChild.cpp
lldb/trunk/source/Symbol/CompilerType.cpp

Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=252529&r1=252528&r2=252529&view=diff
==
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Mon Nov  9 17:07:55 2015
@@ -179,6 +179,9 @@ public:
 
 bool
 IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = 
nullptr) const;
+
+bool
+ShouldTreatScalarValueAsAddress () const;
 
 bool
 IsScalarType () const;

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=252529&r1=252528&r2=252529&view=diff
==
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Mon Nov  9 17:07:55 2015
@@ -496,6 +496,12 @@ public:
 virtual bool
 IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType 
*pointee_type, bool* is_rvalue) = 0;
 
+virtual bool
+ShouldTreatScalarValueAsAddress (lldb::opaque_compiler_type_t type)
+{
+return IsPointerOrReferenceType(type, nullptr);
+}
+
 virtual UserExpression *
 GetUserExpression (const char *expr,
const char *expr_prefix,

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=252529&r1=252528&r2=252529&view=diff
==
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Mon Nov  9 17:07:55 2015
@@ -960,7 +960,8 @@ namespace lldb {
 eTypeIsInteger  = (1u << 18),
 eTypeIsFloat= (1u << 19),
 eTypeIsComplex  = (1u << 20),
-eTypeIsSigned   = (1u << 21)
+eTypeIsSigned   = (1u << 21),
+eTypeInstanceIsPointer  = (1u << 22)
 };
 
 FLAGS_ENUM(CommandFlags)

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=252529&r1=252528&r2=252529&view=diff
==
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Mon Nov  9 17:07:55 2015
@@ -146,7 +146,7 @@ ValueObjectChild::UpdateValue ()
 Value::ValueType value_type = parent->GetValue().GetValueType();
 m_value.SetValueType (value_type);
 
-if (parent->GetCompilerType().IsPointerOrReferenceType ())
+if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress())
 {
 lldb::addr_t addr = parent->GetPointerValue ();
 m_value.GetScalar() = addr;

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=252529&r1=252528&r2=252529&view=diff
==
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Mon Nov  9 17:07:55 2015
@@ -227,6 +227,14 @@ CompilerType::IsReferenceType (CompilerT
 }
 
 bool
+CompilerType::ShouldTreatScalarValueAsAddress () const
+{
+if (IsValid())
+return m_type_system->ShouldTreatScalarValueAsAddress(m_type);
+return false;
+}
+
+bool
 CompilerType::IsFloatingPointType (uint32_t &count, bool &is_complex) const
 {
 if (IsValid())


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


[Lldb-commits] [lldb] r252536 - Use PythonDataObjects in swig helper functions.

2015-11-09 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Nov  9 17:23:52 2015
New Revision: 252536

URL: http://llvm.org/viewvc/llvm-project?rev=252536&view=rev
Log:
Use PythonDataObjects in swig helper functions.

Relying on manual Python C API calls is error prone, especially
when trying to maintain compatibility with Python 2 and Python 3.

This patch additionally fixes what appears to be a potentially
serious memory leak, in that were were incref'ing two values
returned from the session dictionary but never decref'ing them.
There was a comment indicating that it was intentional, but the
reasoning was, I believe, faulty and it resulted in a legitimate
memory leak.

Switching everything to PythonObject based classes solves both
the compatibility issues as well as the resource leak issues.

Modified:
lldb/trunk/scripts/Python/python-wrapper.swig

Modified: lldb/trunk/scripts/Python/python-wrapper.swig
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-wrapper.swig?rev=252536&r1=252535&r2=252536&view=diff
==
--- lldb/trunk/scripts/Python/python-wrapper.swig (original)
+++ lldb/trunk/scripts/Python/python-wrapper.swig Mon Nov  9 17:23:52 2015
@@ -26,72 +26,70 @@ private:
 bool m_print;
 };
 
+// TODO(zturner): This should be part of a `PythonModule` class in
+// PythonDataObjects.hm and it should return a `PythonObject`
 static PyObject*
 ResolvePythonName(const char* name,
   PyObject* pmodule)
 {
+using namespace lldb_private;
 if (!name)
 return pmodule;
 
 PyErr_Cleaner pyerr_cleanup(true);  // show Python errors
 
-PyObject* main_dict;
+PythonDictionary main_dict(PyInitialValue::Invalid);
 
 if (!pmodule)
 {
 pmodule = PyImport_AddModule ("__main__");
 if (!pmodule)
-return NULL;
+return nullptr;
 }
 
 if (PyType_Check(pmodule))
-{
-main_dict = ((PyTypeObject*)pmodule)->tp_dict;
-if (!main_dict)
-return NULL;
-}
-else if (!PyDict_Check(pmodule))
-{
-main_dict = PyModule_GetDict (pmodule);
-if (!main_dict)
-return NULL;
-}
+main_dict.Reset(PyRefType::Borrowed, 
((PyTypeObject*)pmodule)->tp_dict);
+else if (PythonDictionary::Check(pmodule))
+main_dict.Reset(PyRefType::Borrowed, pmodule);
 else
-main_dict = pmodule;
+main_dict.Reset(PyRefType::Borrowed, PyModule_GetDict (pmodule));
+if (!main_dict.IsValid())
+return nullptr;
 
 const char* dot_pos = ::strchr(name, '.');
 
-PyObject *dest_object;
-PyObject *key, *value;
+PythonObject dest_object;
 Py_ssize_t pos = 0;
 
 if (!dot_pos)
 {
-dest_object = NULL;
-while (PyDict_Next (main_dict, &pos, &key, &value))
+PyObject *py_key;
+PyObject *py_value;
+// TODO(zturner): This should be conveniently wrapped by 
`PythonDictionary`.
+while (PyDict_Next(main_dict.get(), &pos, &py_key, &py_value))
 {
-// We have stolen references to the key and value objects in the 
dictionary; we need to increment
-// them now so that Python's garbage collector doesn't collect 
them out from under us.
-Py_INCREF (key);
-Py_INCREF (value);
-if (strcmp (PyString_AsString (key), name) == 0)
+PythonObject key(PyRefType::Borrowed, py_key);
+auto key_string = key.AsType();
+if (!key_string.IsAllocated())
+continue;
+
+std::string str(key_string.GetString().str());
+if (strcmp(str.c_str(), name) == 0)
 {
-dest_object = value;
+dest_object.Reset(PyRefType::Borrowed, py_value);
 break;
 }
 }
-if (!dest_object || dest_object == Py_None)
-return NULL;
-return dest_object;
+return dest_object.release();
 }
 else
 {
 size_t len = dot_pos - name;
 std::string piece(name,len);
-pmodule = ResolvePythonName(piece.c_str(), main_dict);
-if (!pmodule)
-return NULL;
-return ResolvePythonName(dot_pos+1,pmodule); // tail recursion.. 
should be optimized by the compiler
+PyObject *resolved_object = ResolvePythonName(piece.c_str(), 
main_dict.get());
+if (!resolved_object || resolved_object == Py_None)
+return nullptr;
+return ResolvePythonName(dot_pos+1,resolved_object); // tail 
recursion.. should be optimized by the compiler
 }
 }
 
@@ -101,6 +99,8 @@ FindSessionDictionary(const char *sessio
 return ResolvePythonName(session_dictionary_name, NULL);
 }
 
+// TODO(zturner): This entire class should be moved to PythonDataObjects.h
+// and properly abstracted and unit-tested.
 class PyCallable
 {
 public:


___
lldb-commits mail

[Lldb-commits] [lldb] r252553 - More rework of the updating logic for ValueObjectChild. Still just refactoring with no feature change

2015-11-09 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  9 17:59:53 2015
New Revision: 252553

URL: http://llvm.org/viewvc/llvm-project?rev=252553&view=rev
Log:
More rework of the updating logic for ValueObjectChild. Still just refactoring 
with no feature change

Modified:
lldb/trunk/source/Core/ValueObjectChild.cpp

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=252553&r1=252552&r2=252553&view=diff
==
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Mon Nov  9 17:59:53 2015
@@ -140,17 +140,21 @@ ValueObjectChild::UpdateValue ()
 if (parent->UpdateValueIfNeeded(false))
 {
 m_value.SetCompilerType(GetCompilerType());
-
+
+CompilerType parent_type(parent->GetCompilerType());
 // Copy the parent scalar value and the scalar value type
 m_value.GetScalar() = parent->GetValue().GetScalar();
 Value::ValueType value_type = parent->GetValue().GetValueType();
 m_value.SetValueType (value_type);
+
+Flags parent_type_flags(parent_type.GetTypeInfo());
+const bool is_instance_ptr_base = ((m_is_base_class == true) && 
(parent_type_flags.AnySet(lldb::eTypeInstanceIsPointer)));
 
 if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress())
 {
 lldb::addr_t addr = parent->GetPointerValue ();
 m_value.GetScalar() = addr;
-
+
 if (addr == LLDB_INVALID_ADDRESS)
 {
 m_error.SetErrorString ("parent address is invalid.");
@@ -167,16 +171,16 @@ ValueObjectChild::UpdateValue ()
 switch (addr_type)
 {
 case eAddressTypeFile:
-{
-lldb::ProcessSP process_sp (GetProcessSP());
-if (process_sp && process_sp->IsAlive() == 
true)
-m_value.SetValueType 
(Value::eValueTypeLoadAddress);
-else
-
m_value.SetValueType(Value::eValueTypeFileAddress);
-}
+{
+lldb::ProcessSP process_sp (GetProcessSP());
+if (process_sp && process_sp->IsAlive() == true)
+m_value.SetValueType 
(Value::eValueTypeLoadAddress);
+else
+
m_value.SetValueType(Value::eValueTypeFileAddress);
+}
 break;
 case eAddressTypeLoad:
-m_value.SetValueType 
(Value::eValueTypeLoadAddress);
+m_value.SetValueType (is_instance_ptr_base ? 
Value::eValueTypeScalar: Value::eValueTypeLoadAddress);
 break;
 case eAddressTypeHost:
 m_value.SetValueType(Value::eValueTypeHostAddress);
@@ -192,9 +196,9 @@ ValueObjectChild::UpdateValue ()
 {
 switch (value_type)
 {
-case Value::eValueTypeLoadAddress:
-case Value::eValueTypeFileAddress:
-case Value::eValueTypeHostAddress:
+case Value::eValueTypeLoadAddress:
+case Value::eValueTypeFileAddress:
+case Value::eValueTypeHostAddress:
 {
 lldb::addr_t addr = 
m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
 if (addr == LLDB_INVALID_ADDRESS)
@@ -212,27 +216,42 @@ ValueObjectChild::UpdateValue ()
 m_value.GetScalar() += GetByteOffset();
 }
 }
-break;
-
-case Value::eValueTypeScalar:
-// TODO: What if this is a register value? Do we try and
-// extract the child value from within the parent data?
-// Probably...
-default:
-m_error.SetErrorString ("parent has invalid value.");
-break;
+break;
+
+case Value::eValueTypeScalar:
+// try to extract the child value from the parent's 
scalar value
+{
+Scalar scalar(m_value.GetScalar());
+if (m_bitfield_bit_size)
+scalar.ExtractBitfield(m_bitfield_bit_size, 
m_bitfield_bit_offset);
+else
+scalar.ExtractBitfield(8*m_byt

[Lldb-commits] [lldb] r252560 - Code cleanup

2015-11-09 Thread Enrico Granata via lldb-commits
Author: enrico
Date: Mon Nov  9 18:21:10 2015
New Revision: 252560

URL: http://llvm.org/viewvc/llvm-project?rev=252560&view=rev
Log:
Code cleanup

Modified:
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/include/lldb/Core/ValueObjectVariable.h

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=252560&r1=252559&r2=252560&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Mon Nov  9 18:21:10 2015
@@ -1004,6 +1004,12 @@ public:
 virtual bool
 MightHaveChildren();
 
+virtual lldb::VariableSP
+GetVariable ()
+{
+return nullptr;
+}
+
 virtual bool
 IsRuntimeSupportValue ();
 

Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=252560&r1=252559&r2=252560&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Mon Nov  9 18:21:10 
2015
@@ -56,6 +56,14 @@ public:
 }
 
 bool
+IsBaseClass () override
+{
+if (m_parent)
+return m_parent->IsBaseClass();
+return false;
+}
+
+bool
 GetIsConstant() const override
 {
 return false;
@@ -98,6 +106,12 @@ public:
 TypeImpl
 GetTypeImpl() override;
 
+lldb::VariableSP
+GetVariable () override
+{
+return m_parent ? m_parent->GetVariable() : nullptr;
+}
+
 lldb::LanguageType
 GetPreferredDisplayLanguage() override;
 

Modified: lldb/trunk/include/lldb/Core/ValueObjectVariable.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectVariable.h?rev=252560&r1=252559&r2=252560&view=diff
==
--- lldb/trunk/include/lldb/Core/ValueObjectVariable.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectVariable.h Mon Nov  9 18:21:10 2015
@@ -69,6 +69,12 @@ public:
 bool
 SetData(DataExtractor &data, Error &error) override;
 
+virtual lldb::VariableSP
+GetVariable () override
+{
+return m_variable_sp;
+}
+
 protected:
 bool
 UpdateValue() override;
@@ -78,7 +84,7 @@ protected:
 
 lldb::VariableSP  m_variable_sp;  ///< The variable that this value object 
is based upon
 Value m_resolved_value;   ///< The value that DWARFExpression 
resolves this variable to before we patch it up
-
+
 private:
 ValueObjectVariable (ExecutionContextScope *exe_scope, const 
lldb::VariableSP &var_sp);
 //--


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


[Lldb-commits] [PATCH] D14524: Create a `PythonModule` class and add a root-level method for name lookup

2015-11-09 Thread Zachary Turner via lldb-commits
zturner created this revision.
zturner added reviewers: granata.enrico, clayborg, tfiala.
zturner added a subscriber: lldb-commits.

The goal here is to eventually replace some code in `python-wrapper.swig` with 
this code.  This way it can be properly unit tested and we can easily deal with 
Python version differences.

the first set of patches will focus on just getting the classes in with unit 
tests to confirm they work, and then I will replace the code in 
`python-wrapper.swig` with this code.

Note that the implementation of `ResolveName` here differs from the 
implementation of `ResolvePythonName` in `python-wrapper.swig`.  The two 
methods seem equivalent to me, with this one being more straightforward, 
generic, and efficient.

http://reviews.llvm.org/D14524

Files:
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -96,6 +96,66 @@
 EXPECT_EQ(original_refcnt + 1, borrowed_long.get()->ob_refcnt);
 }
 
+TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+EXPECT_TRUE(sys_module.IsAllocated());
+EXPECT_TRUE(PythonModule::Check(sys_module.get()));
+}
+
+TEST_F(PythonDataObjectsTest, TestModuleNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+PythonObject sys_path = sys_module.ResolveName("path");
+PythonObject sys_version_info = sys_module.ResolveName("version_info");
+EXPECT_TRUE(sys_path.IsAllocated());
+EXPECT_TRUE(sys_version_info.IsAllocated());
+
+EXPECT_TRUE(PythonList::Check(sys_path.get()));
+}
+
+TEST_F(PythonDataObjectsTest, TestTypeNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+PythonObject sys_version_info = sys_module.ResolveName("version_info");
+
+PythonObject version_info_type(PyRefType::Owned, PyObject_Type(sys_version_info.get()));
+EXPECT_TRUE(version_info_type.IsAllocated());
+PythonObject major_version_field = version_info_type.ResolveName("major");
+EXPECT_TRUE(major_version_field.IsAllocated());
+}
+
+TEST_F(PythonDataObjectsTest, TestInstanceNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+PythonObject sys_version_info = sys_module.ResolveName("version_info");
+PythonObject major_version_field = sys_version_info.ResolveName("major");
+PythonObject minor_version_field = sys_version_info.ResolveName("minor");
+
+EXPECT_TRUE(major_version_field.IsAllocated());
+EXPECT_TRUE(minor_version_field.IsAllocated());
+
+PythonInteger major_version_value = major_version_field.AsType();
+PythonInteger minor_version_value = minor_version_field.AsType();
+
+EXPECT_EQ(PY_MAJOR_VERSION, major_version_value.GetInteger());
+EXPECT_EQ(PY_MINOR_VERSION, minor_version_value.GetInteger());
+}
+
+TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionWithDot)
+{
+PythonObject sys_path = PythonObject::ResolveNameGlobal("sys.path");
+EXPECT_TRUE(sys_path.IsAllocated());
+EXPECT_TRUE(PythonList::Check(sys_path.get()));
+
+PythonInteger version_major = PythonObject::ResolveNameGlobal("sys.version_info.major").AsType();
+PythonInteger version_minor = PythonObject::ResolveNameGlobal("sys.version_info.minor").AsType();
+EXPECT_TRUE(version_major.IsAllocated());
+EXPECT_TRUE(version_minor.IsAllocated());
+EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
+EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+}
+
 TEST_F(PythonDataObjectsTest, TestPythonInteger)
 {
 // Test that integers behave correctly when wrapped by a PythonInteger.
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -69,6 +69,7 @@
 Dictionary,
 List,
 String,
+Module,
 File
 };
 
@@ -185,15 +186,6 @@
 return result;
 }
 
-PyObjectType
-GetObjectType() const;
-
-PythonString
-Repr ();
-
-PythonString
-Str ();
-
 PythonObject &
 operator=(const PythonObject &other)
 {
@@ -201,6 +193,17 @@
 return *this;
 }
 
+PyObjectType
+GetObjectType() const;
+
+PythonString Repr() const;
+
+PythonString Str() const;
+
+static PythonObject ResolveNameGlobal(llvm::StringRef name);
+
+PythonObject ResolveName(llvm::StringRef name) const;
+
 bool
 HasAttribute(llvm::StringR

Re: [Lldb-commits] [PATCH] D14524: Create a `PythonModule` class and add a root-level method for name lookup

2015-11-09 Thread Zachary Turner via lldb-commits
zturner updated this revision to Diff 39776.
zturner added a comment.

Fix some indentation


http://reviews.llvm.org/D14524

Files:
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
  source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
  unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Index: unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
===
--- unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
+++ unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
@@ -96,6 +96,66 @@
 EXPECT_EQ(original_refcnt + 1, borrowed_long.get()->ob_refcnt);
 }
 
+TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+EXPECT_TRUE(sys_module.IsAllocated());
+EXPECT_TRUE(PythonModule::Check(sys_module.get()));
+}
+
+TEST_F(PythonDataObjectsTest, TestModuleNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+PythonObject sys_path = sys_module.ResolveName("path");
+PythonObject sys_version_info = sys_module.ResolveName("version_info");
+EXPECT_TRUE(sys_path.IsAllocated());
+EXPECT_TRUE(sys_version_info.IsAllocated());
+
+EXPECT_TRUE(PythonList::Check(sys_path.get()));
+}
+
+TEST_F(PythonDataObjectsTest, TestTypeNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+PythonObject sys_version_info = sys_module.ResolveName("version_info");
+
+PythonObject version_info_type(PyRefType::Owned, PyObject_Type(sys_version_info.get()));
+EXPECT_TRUE(version_info_type.IsAllocated());
+PythonObject major_version_field = version_info_type.ResolveName("major");
+EXPECT_TRUE(major_version_field.IsAllocated());
+}
+
+TEST_F(PythonDataObjectsTest, TestInstanceNameResolutionNoDot)
+{
+PythonObject sys_module = PythonObject::ResolveNameGlobal("sys");
+PythonObject sys_version_info = sys_module.ResolveName("version_info");
+PythonObject major_version_field = sys_version_info.ResolveName("major");
+PythonObject minor_version_field = sys_version_info.ResolveName("minor");
+
+EXPECT_TRUE(major_version_field.IsAllocated());
+EXPECT_TRUE(minor_version_field.IsAllocated());
+
+PythonInteger major_version_value = major_version_field.AsType();
+PythonInteger minor_version_value = minor_version_field.AsType();
+
+EXPECT_EQ(PY_MAJOR_VERSION, major_version_value.GetInteger());
+EXPECT_EQ(PY_MINOR_VERSION, minor_version_value.GetInteger());
+}
+
+TEST_F(PythonDataObjectsTest, TestGlobalNameResolutionWithDot)
+{
+PythonObject sys_path = PythonObject::ResolveNameGlobal("sys.path");
+EXPECT_TRUE(sys_path.IsAllocated());
+EXPECT_TRUE(PythonList::Check(sys_path.get()));
+
+PythonInteger version_major = PythonObject::ResolveNameGlobal("sys.version_info.major").AsType();
+PythonInteger version_minor = PythonObject::ResolveNameGlobal("sys.version_info.minor").AsType();
+EXPECT_TRUE(version_major.IsAllocated());
+EXPECT_TRUE(version_minor.IsAllocated());
+EXPECT_EQ(PY_MAJOR_VERSION, version_major.GetInteger());
+EXPECT_EQ(PY_MINOR_VERSION, version_minor.GetInteger());
+}
+
 TEST_F(PythonDataObjectsTest, TestPythonInteger)
 {
 // Test that integers behave correctly when wrapped by a PythonInteger.
Index: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
===
--- source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -69,6 +69,7 @@
 Dictionary,
 List,
 String,
+Module,
 File
 };
 
@@ -185,15 +186,6 @@
 return result;
 }
 
-PyObjectType
-GetObjectType() const;
-
-PythonString
-Repr ();
-
-PythonString
-Str ();
-
 PythonObject &
 operator=(const PythonObject &other)
 {
@@ -201,6 +193,21 @@
 return *this;
 }
 
+PyObjectType
+GetObjectType() const;
+
+PythonString
+Repr() const;
+
+PythonString
+Str() const;
+
+static PythonObject
+ResolveNameGlobal(llvm::StringRef name);
+
+PythonObject
+ResolveName(llvm::StringRef name) const;
+
 bool
 HasAttribute(llvm::StringRef attribute) const;
 
@@ -224,7 +231,8 @@
 return T(PyRefType::Borrowed, m_py_obj);
 }
 
-StructuredData::ObjectSP CreateStructuredObject() const;
+StructuredData::ObjectSP
+CreateStructuredObject() const;
 
 protected:
 PyObject* m_py_obj;
@@ -338,6 +346,34 @@
 StructuredData::DictionarySP CreateStructuredDictionary() const;
 };
 
+class PythonModule : public PythonObject
+{
+  public:
+PythonModule();
+PythonModule(PyRefType type, PyObject *o);
+PythonModule(const PythonModule &dict);
+
+~PythonModule() override;
+
+static bool Check(PyObject *py_obj);
+
+static Pytho

Re: [Lldb-commits] [PATCH] D14524: Create a `PythonModule` class and add a root-level method for name lookup

2015-11-09 Thread Zachary Turner via lldb-commits
On Mon, Nov 9, 2015 at 5:22 PM Zachary Turner  wrote:

> zturner created this revision.
> zturner added reviewers: granata.enrico, clayborg, tfiala.
> zturner added a subscriber: lldb-commits.
>
> The goal here is to eventually replace some code in `python-wrapper.swig`
> with this code.  This way it can be properly unit tested and we can easily
> deal with Python version differences.
>
> the first set of patches will focus on just getting the classes in with
> unit tests to confirm they work, and then I will replace the code in
> `python-wrapper.swig` with this code.
>

Sorry, just to be clear -- first I will just get these enhancements to the
Python object classes in, and then I will replace the code in
`python-wrapper.swig` with *calls* to this code.  Not with a copy of the
code.  the swig wrapper stuff is already set up to be able to reuse all of
this code
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D14524: Create a `PythonModule` class and add a root-level method for name lookup

2015-11-09 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

This seems reasonable to me. I would wait for Greg to OK it, just to be safe.


http://reviews.llvm.org/D14524



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


[Lldb-commits] [lldb] r252581 - The MacOSXi386 ABI should be used for watchos simulator debug sessions.

2015-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Nov  9 21:21:59 2015
New Revision: 252581

URL: http://llvm.org/viewvc/llvm-project?rev=252581&view=rev
Log:
The MacOSXi386 ABI should be used for watchos simulator debug sessions.

Also, add an async error message if the dyld solib loaded callback function
can't find an ABI (which results in no solibs being loaded in the process).
This is a big error and we should call attention to it.

 

Modified:
lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=252581&r1=252580&r2=252581&view=diff
==
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Mon Nov  9 
21:21:59 2015
@@ -176,7 +176,7 @@ ABIMacOSX_i386::CreateInstance (const Ar
 {
 static ABISP g_abi_sp;
  if ((arch.GetTriple().getArch() == llvm::Triple::x86) &&
-  (arch.GetTriple().isMacOSX() || arch.GetTriple().isiOS()))
+  (arch.GetTriple().isMacOSX() || arch.GetTriple().isiOS() || 
arch.GetTriple().isWatchOS()))
  {
 if (!g_abi_sp)
 g_abi_sp.reset (new ABIMacOSX_i386);

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=252581&r1=252580&r2=252581&view=diff
==
--- 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp 
Mon Nov  9 21:21:59 2015
@@ -10,6 +10,7 @@
 #include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/DataBuffer.h"
 #include "lldb/Core/DataBufferHeap.h"
+#include "lldb/Core/Debugger.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
@@ -670,6 +671,10 @@ DynamicLoaderMacOSXDYLD::NotifyBreakpoin
 }
 }
 }
+else
+{
+process->GetTarget().GetDebugger().GetAsyncErrorStream()->Printf("No 
ABI plugin located for triple %s -- shared libraries will not be 
registered!\n", 
process->GetTarget().GetArchitecture().GetTriple().getTriple().c_str());
+}
 
 // Return true to stop the target, false to just let the target run
 return dyld_instance->GetStopWhenImagesChange();


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


Re: [Lldb-commits] [PATCH] D14524: Create a `PythonModule` class and add a root-level method for name lookup

2015-11-09 Thread Zachary Turner via lldb-commits
zturner added inline comments.


Comment at: source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h:369-374
@@ +368,8 @@
+
+template 
+T
+ResolveNameAs(llvm::StringRef name) const
+{
+return ResolveName(name).AsType();
+}
+};

I need to delete this method.  This was left in by accident.  The real 
implementation is in the base class.


http://reviews.llvm.org/D14524



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


[Lldb-commits] [lldb] r252583 - The other half of a change made by Enrico for trying to get a correct

2015-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Nov  9 22:11:37 2015
New Revision: 252583

URL: http://llvm.org/viewvc/llvm-project?rev=252583&view=rev
Log:
The other half of a change made by Enrico for trying to get a correct
triple for a process.  He writes, "Changes to the way setting the
triple works on a target so that if the target has passed a fully
specified triple, and the newly passed triple is not a revamp of
the current one, and the current one is fully specified, then do
not replace the existing triple."

Triple handling got a bit more complicated on mac with the addition
of ios/watchos/tvos and their simulators, and tracking the correct
os versions for them so expressions are compiled with the expected
APIs available to the user.

 

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

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=252583&r1=252582&r2=252583&view=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Nov  9 22:11:37 2015
@@ -1243,44 +1243,70 @@ bool
 Target::SetArchitecture (const ArchSpec &arch_spec)
 {
 Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
-if (m_arch.IsCompatibleMatch(arch_spec) || !m_arch.IsValid())
+bool missing_local_arch = (false == m_arch.IsValid());
+bool replace_local_arch = true;
+bool compatible_local_arch = false;
+ArchSpec other(arch_spec);
+
+if (!missing_local_arch)
+{
+if (m_arch.IsCompatibleMatch(arch_spec))
+{
+other.MergeFrom(m_arch);
+
+if (m_arch.IsCompatibleMatch(other))
+{
+compatible_local_arch = true;
+bool arch_changed, vendor_changed, os_changed, os_ver_changed, 
env_changed;
+
+m_arch.PiecewiseTripleCompare(other,
+  arch_changed,
+  vendor_changed,
+  os_changed,
+  os_ver_changed,
+  env_changed);
+
+if (!arch_changed && !vendor_changed && !os_changed)
+replace_local_arch = false;
+}
+}
+}
+
+if (compatible_local_arch || missing_local_arch)
 {
-// If we haven't got a valid arch spec, or the architectures are
-// compatible, so just update the architecture. Architectures can be
-// equal, yet the triple OS and vendor might change, so we need to do
-// the assignment here just in case.
-m_arch = arch_spec;
+// If we haven't got a valid arch spec, or the architectures are 
compatible
+// update the architecture, unless the one we already have is more 
specified
+if (replace_local_arch)
+m_arch = other;
 if (log)
-log->Printf ("Target::SetArchitecture setting architecture to %s 
(%s)", arch_spec.GetArchitectureName(), 
arch_spec.GetTriple().getTriple().c_str());
+log->Printf ("Target::SetArchitecture set architecture to %s 
(%s)", m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
 return true;
 }
-else
+
+// If we have an executable file, try to reset the executable to the 
desired architecture
+if (log)
+  log->Printf ("Target::SetArchitecture changing architecture to %s (%s)", 
arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str());
+m_arch = other;
+ModuleSP executable_sp = GetExecutableModule ();
+
+ClearModules(true);
+// Need to do something about unsetting breakpoints.
+
+if (executable_sp)
 {
-// If we have an executable file, try to reset the executable to the 
desired architecture
 if (log)
-  log->Printf ("Target::SetArchitecture changing architecture to %s 
(%s)", arch_spec.GetArchitectureName(), 
arch_spec.GetTriple().getTriple().c_str());
-m_arch = arch_spec;
-ModuleSP executable_sp = GetExecutableModule ();
-
-ClearModules(true);
-// Need to do something about unsetting breakpoints.
-
-if (executable_sp)
+  log->Printf("Target::SetArchitecture Trying to select executable 
file architecture %s (%s)", arch_spec.GetArchitectureName(), 
arch_spec.GetTriple().getTriple().c_str());
+ModuleSpec module_spec (executable_sp->GetFileSpec(), other);
+Error error = ModuleList::GetSharedModule (module_spec, 
+   executable_sp, 
+   &GetExecutableSearchPaths(),
+   NULL, 
+   NULL);
+  

[Lldb-commits] [lldb] r252584 - Upstream a small change from Greg Clayton for the REPL support:

2015-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Nov  9 22:18:12 2015
New Revision: 252584

URL: http://llvm.org/viewvc/llvm-project?rev=252584&view=rev
Log:
Upstream a small change from Greg Clayton for the REPL support:
"Modify internal breakpoints so they resolve just like external
breakpoints do. This allow you to set symbol and file + line internal
breakpoints and have them get updated correctly."



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

Modified: lldb/trunk/source/Target/Target.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=252584&r1=252583&r2=252584&view=diff
==
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Nov  9 22:18:12 2015
@@ -1371,7 +1371,10 @@ Target::ModuleUpdated (const ModuleList&
 {
 // A module is replacing an already added module
 if (m_valid)
+{
 m_breakpoint_list.UpdateBreakpointsWhenModuleIsReplaced(old_module_sp, 
new_module_sp);
+
m_internal_breakpoint_list.UpdateBreakpointsWhenModuleIsReplaced(old_module_sp, 
new_module_sp);
+}
 }
 
 void
@@ -1380,6 +1383,7 @@ Target::ModulesDidLoad (ModuleList &modu
 if (m_valid && module_list.GetSize())
 {
 m_breakpoint_list.UpdateBreakpoints (module_list, true, false);
+m_internal_breakpoint_list.UpdateBreakpoints (module_list, true, 
false);
 if (m_process_sp)
 {
 m_process_sp->ModulesDidLoad (module_list);
@@ -1404,6 +1408,7 @@ Target::SymbolsDidLoad (ModuleList &modu
 }
 
 m_breakpoint_list.UpdateBreakpoints (module_list, true, false);
+m_internal_breakpoint_list.UpdateBreakpoints (module_list, true, 
false);
 BroadcastEvent (eBroadcastBitSymbolsLoaded, new TargetEventData 
(this->shared_from_this(), module_list));
 }
 }
@@ -1415,6 +1420,7 @@ Target::ModulesDidUnload (ModuleList &mo
 {
 UnloadModuleSections (module_list);
 m_breakpoint_list.UpdateBreakpoints (module_list, false, 
delete_locations);
+m_internal_breakpoint_list.UpdateBreakpoints (module_list, false, 
delete_locations);
 BroadcastEvent (eBroadcastBitModulesUnloaded, new TargetEventData 
(this->shared_from_this(), module_list));
 }
 }


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


[Lldb-commits] [lldb] r252588 - Add support for tvos and watchos to ObjectFileMachO.

2015-11-09 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Nov  9 23:21:54 2015
New Revision: 252588

URL: http://llvm.org/viewvc/llvm-project?rev=252588&view=rev
Log:
Add support for tvos and watchos to ObjectFileMachO.
Add support for the new dyld shared cache format on
ios etc devices.
Small changes for classifying ObjC metadata symbols.


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

Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=252588&r1=252587&r2=252588&view=diff
==
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Mon Nov  9 23:21:54 2015
@@ -840,7 +840,11 @@ public:
 {
 return symbol_name.str();
 }
-
+
+static lldb::SymbolType
+GetSymbolTypeFromName (llvm::StringRef name,
+   lldb::SymbolType symbol_type_hint = 
lldb::eSymbolTypeUndefined);
+
 protected:
 //--
 // Member variables.

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=252588&r1=252587&r2=252588&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Mon Nov  9 
23:21:54 2015
@@ -62,6 +62,52 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace llvm::MachO;
 
+// Some structure definitions needed for parsing the dyld shared cache files
+// found on iOS devices.
+
+struct lldb_copy_dyld_cache_header_v1
+{
+charmagic[16];// e.g. "dyld_v0i386", "dyld_v1   
armv7", etc.
+uint32_tmappingOffset;// file offset to first 
dyld_cache_mapping_info
+uint32_tmappingCount; // number of dyld_cache_mapping_info 
entries
+uint32_timagesOffset;
+uint32_timagesCount;
+uint64_tdyldBaseAddress;
+uint64_tcodeSignatureOffset;
+uint64_tcodeSignatureSize;
+uint64_tslideInfoOffset;
+uint64_tslideInfoSize;
+uint64_tlocalSymbolsOffset;
+uint64_tlocalSymbolsSize;
+uint8_t uuid[16]; // v1 and above, also recorded in 
dyld_all_image_infos v13 and later
+};
+
+struct lldb_copy_dyld_cache_mapping_info
+{
+uint64_taddress;
+uint64_tsize;
+uint64_tfileOffset;
+uint32_tmaxProt;
+uint32_tinitProt;
+};
+
+struct lldb_copy_dyld_cache_local_symbols_info
+{
+uint32_tnlistOffset;
+uint32_tnlistCount;
+uint32_tstringsOffset;
+uint32_tstringsSize;
+uint32_tentriesOffset;
+uint32_tentriesCount;
+};
+struct lldb_copy_dyld_cache_local_symbols_entry
+{
+uint32_tdylibOffset;
+uint32_tnlistStartIndex;
+uint32_tnlistCount;
+};
+
+
 class RegisterContextDarwin_x86_64_Mach : public RegisterContextDarwin_x86_64
 {
 public:
@@ -1775,7 +1821,6 @@ ObjectFileMachO::CreateSections (Section
 static ConstString g_sect_name_data 
("__data");
 static ConstString g_sect_name_go_symtab 
("__gosymtab");
 
-
 if (section_name == 
g_sect_name_dwarf_debug_abbrev)
 sect_type = 
eSectionTypeDWARFDebugAbbrev;
 else if (section_name == 
g_sect_name_dwarf_debug_aranges)
@@ -2151,6 +2196,31 @@ ParseTrieEntries (DataExtractor &data,
 return true;
 }
 
+// Read the UUID out of a dyld_shared_cache file on-disk.
+UUID
+ObjectFileMachO::GetSharedCacheUUID (FileSpec dyld_shared_cache, const 
ByteOrder byte_order, const uint32_t addr_byte_size)
+{
+UUID dsc_uuid;
+DataBufferSP dsc_data_sp = 
dyld_shared_cache.MemoryMapFileContentsIfLocal(0, sizeof(struct 
lldb_copy_dyld_cache_header_v1));
+if (dsc_data_sp)
+{
+DataExtractor dsc_header_data (dsc_data_sp, byte_order, 
addr_byte_size);
+
+char version_str[7];
+lldb::offset_t offset = 0;
+memcpy (version_str, dsc_header_data.GetData (&offset, 6), 6);
+version_str[6] = '\0';
+if (strcmp (version_str, "dyld_v") == 0)
+{
+offset = offsetof (struct lldb_copy_dyld_cache_header_v1, uuid);
+uint8_t uuid_bytes[sizeof (uuid_t)];
+memcpy (uuid_bytes, dsc_header_data.GetData (&offset, sizeof 
(uuid_t)), sizeof (uuid_t));
+dsc_uuid.Set

Re: [Lldb-commits] [lldb] r252583 - The other half of a change made by Enrico for trying to get a correct

2015-11-09 Thread Zachary Turner via lldb-commits
This is really the kind of thing that would be good to write a unit test
for.  There's a lot of institutional knowledge hidden away in these kinds
of deep low level stuff, and a unit test is good documentation for it.

I suspect this is almost guaranteed to break at some point in the future
without an explicit test (especially since it's not immediately obvious why
a Target should behave that way)


It should be really easy to write one for this.  You'd need to make a
TargetUnitTests target, create an empty target, set the triple to one
thing, set it to another thing, and ensure it retains the original value.
 +todd in case you're interested in trying, he can probably help


On Mon, Nov 9, 2015 at 8:14 PM Jason Molenda via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: jmolenda
> Date: Mon Nov  9 22:11:37 2015
> New Revision: 252583
>
> URL: http://llvm.org/viewvc/llvm-project?rev=252583&view=rev
> Log:
> The other half of a change made by Enrico for trying to get a correct
> triple for a process.  He writes, "Changes to the way setting the
> triple works on a target so that if the target has passed a fully
> specified triple, and the newly passed triple is not a revamp of
> the current one, and the current one is fully specified, then do
> not replace the existing triple."
>
> Triple handling got a bit more complicated on mac with the addition
> of ios/watchos/tvos and their simulators, and tracking the correct
> os versions for them so expressions are compiled with the expected
> APIs available to the user.
>
> 
>
> Modified:
> lldb/trunk/source/Target/Target.cpp
>
> Modified: lldb/trunk/source/Target/Target.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=252583&r1=252582&r2=252583&view=diff
>
> ==
> --- lldb/trunk/source/Target/Target.cpp (original)
> +++ lldb/trunk/source/Target/Target.cpp Mon Nov  9 22:11:37 2015
> @@ -1243,44 +1243,70 @@ bool
>  Target::SetArchitecture (const ArchSpec &arch_spec)
>  {
>  Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
> -if (m_arch.IsCompatibleMatch(arch_spec) || !m_arch.IsValid())
> +bool missing_local_arch = (false == m_arch.IsValid());
> +bool replace_local_arch = true;
> +bool compatible_local_arch = false;
> +ArchSpec other(arch_spec);
> +
> +if (!missing_local_arch)
> +{
> +if (m_arch.IsCompatibleMatch(arch_spec))
> +{
> +other.MergeFrom(m_arch);
> +
> +if (m_arch.IsCompatibleMatch(other))
> +{
> +compatible_local_arch = true;
> +bool arch_changed, vendor_changed, os_changed,
> os_ver_changed, env_changed;
> +
> +m_arch.PiecewiseTripleCompare(other,
> +  arch_changed,
> +  vendor_changed,
> +  os_changed,
> +  os_ver_changed,
> +  env_changed);
> +
> +if (!arch_changed && !vendor_changed && !os_changed)
> +replace_local_arch = false;
> +}
> +}
> +}
> +
> +if (compatible_local_arch || missing_local_arch)
>  {
> -// If we haven't got a valid arch spec, or the architectures are
> -// compatible, so just update the architecture. Architectures can
> be
> -// equal, yet the triple OS and vendor might change, so we need
> to do
> -// the assignment here just in case.
> -m_arch = arch_spec;
> +// If we haven't got a valid arch spec, or the architectures are
> compatible
> +// update the architecture, unless the one we already have is
> more specified
> +if (replace_local_arch)
> +m_arch = other;
>  if (log)
> -log->Printf ("Target::SetArchitecture setting architecture to
> %s (%s)", arch_spec.GetArchitectureName(),
> arch_spec.GetTriple().getTriple().c_str());
> +log->Printf ("Target::SetArchitecture set architecture to %s
> (%s)", m_arch.GetArchitectureName(),
> m_arch.GetTriple().getTriple().c_str());
>  return true;
>  }
> -else
> +
> +// If we have an executable file, try to reset the executable to the
> desired architecture
> +if (log)
> +  log->Printf ("Target::SetArchitecture changing architecture to %s
> (%s)", arch_spec.GetArchitectureName(),
> arch_spec.GetTriple().getTriple().c_str());
> +m_arch = other;
> +ModuleSP executable_sp = GetExecutableModule ();
> +
> +ClearModules(true);
> +// Need to do something about unsetting breakpoints.
> +
> +if (executable_sp)
>  {
> -// If we have an executable file, try to reset the executable to
> the desired architecture
>  if (log)
> -  log->Printf ("Target::SetArchitec

[Lldb-commits] [PATCH] D14528: Allow to override python-config executable name from command line

2015-11-09 Thread Kamil Rytarowski via lldb-commits
krytarowski created this revision.
krytarowski added subscribers: joerg, lldb-commits, brucem.
krytarowski set the repository for this revision to rL LLVM.

pkgsrc (on NetBSD) ships with python2.7-config.

Repository:
  rL LLVM

http://reviews.llvm.org/D14528

Files:
  Makefile
  lib/Makefile
  scripts/Python/modules/readline/Makefile

Index: scripts/Python/modules/readline/Makefile
===
--- scripts/Python/modules/readline/Makefile
+++ scripts/Python/modules/readline/Makefile
@@ -20,7 +20,8 @@
 SHARED_LIBRARY = 1
 LOADABLE_MODULE = 1
 
-PYTHON_INC_DIR = $(shell python-config --includes)
+PYTHON_CONFIG?=python-config
+PYTHON_INC_DIR = $(shell $(PYTHON_CONFIG) --includes)
 
 # Include all archives in the shared lib
 USEDLIBS :=
Index: lib/Makefile
===
--- lib/Makefile
+++ lib/Makefile
@@ -18,7 +18,8 @@
 SHARED_LIBRARY = 1
 
 ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
-PYTHON_BUILD_FLAGS = $(shell python-config --ldflags)
+PYTHON_CONFIG?=python-config
+PYTHON_BUILD_FLAGS = $(shell $(PYTHON_CONFIG) --ldflags)
 endif
 
 # Include all archives in liblldb.so file
Index: Makefile
===
--- Makefile
+++ Makefile
@@ -46,7 +46,8 @@
 
 ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
 # Set Python include directory
-PYTHON_INC_DIR = $(shell python-config --includes)
+PYTHON_CONFIG?=python-config
+PYTHON_INC_DIR = $(shell $(PYTHON_CONFIG) --includes)
 CPP.Flags +=   $(PYTHON_INC_DIR)
 endif
 


Index: scripts/Python/modules/readline/Makefile
===
--- scripts/Python/modules/readline/Makefile
+++ scripts/Python/modules/readline/Makefile
@@ -20,7 +20,8 @@
 SHARED_LIBRARY = 1
 LOADABLE_MODULE = 1
 
-PYTHON_INC_DIR = $(shell python-config --includes)
+PYTHON_CONFIG?=	python-config
+PYTHON_INC_DIR = $(shell $(PYTHON_CONFIG) --includes)
 
 # Include all archives in the shared lib
 USEDLIBS :=
Index: lib/Makefile
===
--- lib/Makefile
+++ lib/Makefile
@@ -18,7 +18,8 @@
 SHARED_LIBRARY = 1
 
 ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
-PYTHON_BUILD_FLAGS = $(shell python-config --ldflags)
+PYTHON_CONFIG?=	python-config
+PYTHON_BUILD_FLAGS = $(shell $(PYTHON_CONFIG) --ldflags)
 endif
 
 # Include all archives in liblldb.so file
Index: Makefile
===
--- Makefile
+++ Makefile
@@ -46,7 +46,8 @@
 
 ifeq (,$(findstring -DLLDB_DISABLE_PYTHON,$(CXXFLAGS)))
 # Set Python include directory
-PYTHON_INC_DIR = $(shell python-config --includes)
+PYTHON_CONFIG?=	python-config
+PYTHON_INC_DIR = $(shell $(PYTHON_CONFIG) --includes)
 CPP.Flags +=   $(PYTHON_INC_DIR)
 endif
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D14529: Use library discovery for curses and panel

2015-11-09 Thread Kamil Rytarowski via lldb-commits
krytarowski created this revision.
krytarowski added subscribers: lldb-commits, joerg, brucem.
krytarowski set the repository for this revision to rL LLVM.

This approach is tunable with custom paths for curses library.

It also detects whether there are requirements met.

I make use of it on NetBSD.

Repository:
  rL LLVM

http://reviews.llvm.org/D14529

Files:
  cmake/LLDBDependencies.cmake
  cmake/modules/LLDBConfig.cmake

Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -309,7 +309,7 @@
   find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS 
"/System/Library/PrivateFrameworks")
 
   add_definitions( -DLIBXML2_DEFINED )
-  list(APPEND system_libs xml2 ncurses panel)
+  list(APPEND system_libs xml2 ${CURSES_LIBRARIES})
   list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
   ${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
   ${DEBUG_SYMBOLS_LIBRARY})
@@ -395,3 +395,18 @@
 else()
 set(LLDB_CAN_USE_DEBUGSERVER 0)
 endif()
+
+if (NOT LLDB_DISABLE_CURSES)
+find_package(Curses REQUIRED)
+
+find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel 
library")
+if (NOT CURSES_PANEL_LIBRARY)
+message(FATAL_ERROR "A required curses' panel library not found.")
+endif ()
+
+# Add panels to the library path
+set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY})
+
+list(APPEND system_libs ${CURSES_LIBRARIES})
+include_directories(${CURSES_INCLUDE_DIR})
+endif ()
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -146,7 +146,7 @@
 list(APPEND LLDB_SYSTEM_LIBS edit)
   endif()
   if (NOT LLDB_DISABLE_CURSES)
-list(APPEND LLDB_SYSTEM_LIBS panel ncurses)
+list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
 if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
   list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
 endif()


Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -309,7 +309,7 @@
   find_library(DEBUG_SYMBOLS_LIBRARY DebugSymbols PATHS "/System/Library/PrivateFrameworks")
 
   add_definitions( -DLIBXML2_DEFINED )
-  list(APPEND system_libs xml2 ncurses panel)
+  list(APPEND system_libs xml2 ${CURSES_LIBRARIES})
   list(APPEND system_libs ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY}
   ${CORE_FOUNDATION_LIBRARY} ${CORE_SERVICES_LIBRARY} ${SECURITY_LIBRARY}
   ${DEBUG_SYMBOLS_LIBRARY})
@@ -395,3 +395,18 @@
 else()
 set(LLDB_CAN_USE_DEBUGSERVER 0)
 endif()
+
+if (NOT LLDB_DISABLE_CURSES)
+find_package(Curses REQUIRED)
+
+find_library(CURSES_PANEL_LIBRARY NAMES panel DOC "The curses panel library")
+if (NOT CURSES_PANEL_LIBRARY)
+message(FATAL_ERROR "A required curses' panel library not found.")
+endif ()
+
+# Add panels to the library path
+set (CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_PANEL_LIBRARY})
+
+list(APPEND system_libs ${CURSES_LIBRARIES})
+include_directories(${CURSES_INCLUDE_DIR})
+endif ()
Index: cmake/LLDBDependencies.cmake
===
--- cmake/LLDBDependencies.cmake
+++ cmake/LLDBDependencies.cmake
@@ -146,7 +146,7 @@
 list(APPEND LLDB_SYSTEM_LIBS edit)
   endif()
   if (NOT LLDB_DISABLE_CURSES)
-list(APPEND LLDB_SYSTEM_LIBS panel ncurses)
+list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
 if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
   list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D14530: Plug-in PlatformNetBSD initializer and terminator

2015-11-09 Thread Kamil Rytarowski via lldb-commits
krytarowski created this revision.
krytarowski added subscribers: brucem, lldb-commits, joerg.
krytarowski set the repository for this revision to rL LLVM.

Other platform parts needed to build this code are already merged.

Repository:
  rL LLVM

http://reviews.llvm.org/D14530

Files:
  source/Initialization/SystemInitializerCommon.cpp

Index: source/Initialization/SystemInitializerCommon.cpp
===
--- source/Initialization/SystemInitializerCommon.cpp
+++ source/Initialization/SystemInitializerCommon.cpp
@@ -115,6 +115,7 @@
 DynamicLoaderWindowsDYLD::Initialize();
 platform_freebsd::PlatformFreeBSD::Initialize();
 platform_linux::PlatformLinux::Initialize();
+platform_netbsd::PlatformNetBSD::Initialize();
 PlatformWindows::Initialize();
 PlatformKalimba::Initialize();
 platform_android::PlatformAndroid::Initialize();
@@ -162,6 +163,7 @@
 DynamicLoaderWindowsDYLD::Terminate();
 platform_freebsd::PlatformFreeBSD::Terminate();
 platform_linux::PlatformLinux::Terminate();
+platform_netbsd::PlatformNetBSD::Terminate();
 PlatformWindows::Terminate();
 PlatformKalimba::Terminate();
 platform_android::PlatformAndroid::Terminate();


Index: source/Initialization/SystemInitializerCommon.cpp
===
--- source/Initialization/SystemInitializerCommon.cpp
+++ source/Initialization/SystemInitializerCommon.cpp
@@ -115,6 +115,7 @@
 DynamicLoaderWindowsDYLD::Initialize();
 platform_freebsd::PlatformFreeBSD::Initialize();
 platform_linux::PlatformLinux::Initialize();
+platform_netbsd::PlatformNetBSD::Initialize();
 PlatformWindows::Initialize();
 PlatformKalimba::Initialize();
 platform_android::PlatformAndroid::Initialize();
@@ -162,6 +163,7 @@
 DynamicLoaderWindowsDYLD::Terminate();
 platform_freebsd::PlatformFreeBSD::Terminate();
 platform_linux::PlatformLinux::Terminate();
+platform_netbsd::PlatformNetBSD::Terminate();
 PlatformWindows::Terminate();
 PlatformKalimba::Terminate();
 platform_android::PlatformAndroid::Terminate();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits