[Lldb-commits] [PATCH] D12079: [MIPS] microMIPS breakpoints, disassembly and compressed addresses

2015-08-17 Thread Jaydeep Patil via lldb-commits
jaydeep created this revision.
jaydeep added a reviewer: clayborg.
jaydeep added subscribers: lldb-commits, bhushan, sagar, mohit.bhakkad, 
nitesh.jain.
jaydeep set the repository for this revision to rL LLVM.

This patch enables setting of breakpoints and disassembly for microMIPS 
applications running on bare-iron targets like IASim.

MIPS uses bit #0 (ISA bit) of an address for ISA mode (1 for microMIPS/MIPS16 
and 0 for MIPS). The resulting address is called as compressed address when ISA 
bit is set. This allows processor to switch between microMIPS and MIPS without 
any need for special mode-control register. This bit is then cleared by the 
processor while fetching the instruction from memory. However, apart from 
.debug_line, none of the ELF/DWARF sections set the ISA bit. 

In this patch:
1)  The symbol table is recorded in the form of compressed address for 
microMIPS symbols, so that corresponding debug_line can be decoded properly.
2)  Memory read/write of compressed address has been handled


Repository:
  rL LLVM

http://reviews.llvm.org/D12079

Files:
  source/Core/Disassembler.cpp
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1273,6 +1273,51 @@
 
 assert(func_type == NULL || func_type != DIE_IS_BEING_PARSED);
 
+/*
+ * MIPS:
+ * The bit #0 of an address is used for ISA mode (1 for microMIPS, 0 for MIPS).
+ * This allows processer to switch between microMIPS and MIPS without any need
+ * for special mode-control register. However, apart from .debug_line, none of
+ * the ELF/DWARF sections set the ISA bit (for symbol or section).
+ *
+ * Find first symbol with name func_name and type FUNC. If this is a microMIPS
+ * symbol then adjust func_range accordingly.
+*/
+ArchSpec arch;
+GetObjectFile()->GetArchitecture(arch);
+
+if (arch.GetMachine() == llvm::Triple::mips64
+|| arch.GetMachine() == llvm::Triple::mips64el
+|| arch.GetMachine() == llvm::Triple::mips
+|| arch.GetMachine() == llvm::Triple::mipsel)
+{
+Symbol *microsym = NULL;
+if (m_obj_file)
+{
+Symtab *symtab = m_obj_file->GetSymtab ();
+if (symtab)
+{
+lldb::LanguageType language = ParseCompileUnitLanguage(sc);
+microsym = symtab->FindFirstSymbolWithNameAndType (func_name.GetDemangledName(language),
+   eSymbolTypeCode,
+   Symtab::eDebugNo,
+   Symtab::eVisibilityAny);
+
+if (microsym != NULL)
+{
+lldb::addr_t addr = microsym->GetFileAddress();
+
+// If address is compressed then it is a microMIPS symbol
+if (addr & 1)
+{
+Address &compressed_addr = func_range.GetBaseAddress();
+compressed_addr.SetOffset (compressed_addr.GetOffset() | 1);
+}
+}
+}
+}
+}
+
 if (FixupAddress (func_range.GetBaseAddress()))
 {
 const user_id_t func_user_id = MakeUserID(die->GetOffset());
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3169,7 +3169,8 @@
 user_id_t site_id = bp_site->GetID();
 
 // Get the breakpoint address
-const addr_t addr = bp_site->GetLoadAddress();
+const addr_t load_addr = bp_site->GetLoadAddress();
+addr_t addr = load_addr;
 
 // Log that a breakpoint was requested
 if (log)
@@ -3183,6 +3184,24 @@
 return error;
 }
 
+/*
+ * MIPS:
+ * If bit #0 of an address (ISA bit) is set, then this is microMIPS or MIPS16 address.
+ * Processor clears this bit before fetching the instruction from memory. Set this
+ * breakpoint at uncompressed address.
+*/
+const ArchSpec target_arch = GetTarget().GetArchitecture();
+if (target_arch.GetMachine() == llvm::Triple::mips |

[Lldb-commits] [PATCH] D12083: [LLGS] Avoid misrepresenting log lines as inferior output

2015-08-17 Thread Pavel Labath via lldb-commits
labath created this revision.
labath added reviewers: clayborg, ovyalov.
labath added subscribers: lldb-commits, dean.

in case we are logging to stdout, any log lines from the forked child can be 
misconstrued to be
inferior output. To avoid this, we disable all logging immediately after 
forking.

I also fix the implementatoion of DisableAllLogChannels, which was a no-op 
before this commit.

http://reviews.llvm.org/D12083

Files:
  source/Core/Log.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp

Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -560,8 +560,11 @@
 // Child process.
 if (pid == 0)
 {
+// First, make sure we disable all logging. If we are logging to 
stdout, our logs can be
+// mistaken for interior output.
+Log::DisableAllLogChannels(nullptr);
 // FIXME consider opening a pipe between parent/child and have this 
forked child
-// send log info to parent re: launch status, in place of the log 
lines removed here.
+// send log info to parent re: launch status.
 
 // Start tracing this child that is about to exec.
 error = PtraceWrapper(PTRACE_TRACEME, 0);
Index: source/Core/Log.cpp
===
--- source/Core/Log.cpp
+++ source/Core/Log.cpp
@@ -449,7 +449,7 @@
 {
 CallbackMap &callback_map = GetCallbackMap ();
 CallbackMapIter pos, end = callback_map.end();
-const char *categories[1] = {NULL};
+const char *categories[] = {"all", nullptr};
 
 for (pos = callback_map.begin(); pos != end; ++pos)
 pos->second.disable (categories, feedback_strm);


Index: source/Plugins/Process/Linux/NativeProcessLinux.cpp
===
--- source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -560,8 +560,11 @@
 // Child process.
 if (pid == 0)
 {
+// First, make sure we disable all logging. If we are logging to stdout, our logs can be
+// mistaken for interior output.
+Log::DisableAllLogChannels(nullptr);
 // FIXME consider opening a pipe between parent/child and have this forked child
-// send log info to parent re: launch status, in place of the log lines removed here.
+// send log info to parent re: launch status.
 
 // Start tracing this child that is about to exec.
 error = PtraceWrapper(PTRACE_TRACEME, 0);
Index: source/Core/Log.cpp
===
--- source/Core/Log.cpp
+++ source/Core/Log.cpp
@@ -449,7 +449,7 @@
 {
 CallbackMap &callback_map = GetCallbackMap ();
 CallbackMapIter pos, end = callback_map.end();
-const char *categories[1] = {NULL};
+const char *categories[] = {"all", nullptr};
 
 for (pos = callback_map.begin(); pos != end; ++pos)
 pos->second.disable (categories, feedback_strm);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12044: Fix resolution conflict between global and class static variables in C++.

2015-08-17 Thread Greg Clayton via lldb-commits
clayborg added a comment.

Please make sure that the following works after your changes:

  (lldb) r
  Process 35421 launched: '/private/tmp/a.out' (x86_64)
  Process 35421 stopped
  * thread #1: tid = 0xb659be, 0x00010f9d a.out main + 13, stop reason 
= breakpoint 1.1, queue = com.apple.main-thread
  frame #0: 0x00010f9d a.out main + 13 at main.cpp:24
 21 
 22 int main()
 23 {
  -> 24 return 0; // break here
 25 }
  (lldb) target variable 
  Global variables for /tmp/main.cpp in /private/tmp/a.out:
  (int) A::a = 
  (int) B::a = 
  (int) C::a = 
  (int) ::a = 


http://reviews.llvm.org/D12044



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


Re: [Lldb-commits] [PATCH] D12044: Fix resolution conflict between global and class static variables in C++.

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

See inlined comments.



Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:7389
@@ -7388,3 +7388,3 @@
 {
-VariableSP var_sp (ParseVariableDIE(sc, dwarf_cu, 
die, LLDB_INVALID_ADDRESS));
+VariableSP var_sp (ParseGlobalVariableDIE(sc, 
dwarf_cu, die, LLDB_INVALID_ADDRESS));
 if (var_sp)

I would do this as:

```
const DWARFDebugInfoEntry *parent_die = 
GetDeclContextDIEContainingDIE(dwarf_cu, die);
if (parent_die->Tag() != DW_TAG_class_type && parent_die->Tag() != 
DW_TAG_structure_type)
{
VariableSP var_sp (ParseVariableDIE(sc, dwarf_cu, die, 
LLDB_INVALID_ADDRESS));
if (var_sp)
{
variables->AddVariableIfUnique (var_sp);
++vars_added;
}
```

This will avoid parsing extra global variables by figuring out we don't need it 
_before_ we go and parse a global variable. 

I would rather not have the SymbolFileDWARF::ParseGlobalVariableDIE(...) 
function because it doesn't make sense at as global variables can exist in 
classes and structures and I would expect a function named 
SymbolFileDWARF::ParseGlobalVariableDIE(...) to parse that variable, but 
SymbolFileDWARF:: ParseVariableDIE(...) already does this so there is really no 
need for SymbolFileDWARF::ParseGlobalVariableDIE().


Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:7413-7437
@@ -7412,2 +7412,27 @@
 
+VariableSP
+SymbolFileDWARF::ParseGlobalVariableDIE
+(
+const SymbolContext& sc,
+DWARFCompileUnit* dwarf_cu,
+const DWARFDebugInfoEntry *die,
+const lldb::addr_t func_low_pc
+)
+{
+assert(sc.function == NULL);
+assert(sc.comp_unit != NULL);
+
+VariableSP var_sp(ParseVariableDIE(sc, dwarf_cu, die, func_low_pc)); 
+
+if (var_sp) 
+{
+const DWARFDebugInfoEntry *parent_die = 
GetDeclContextDIEContainingDIE(dwarf_cu, die);
+if (parent_die->Tag() != DW_TAG_class_type && parent_die->Tag() != 
DW_TAG_structure_type)
+return var_sp;
+else
+return VariableSP();
+}
+
+return var_sp;
+}
 

Remove this. See inlined comment above.


Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h:325-330
@@ -324,2 +324,8 @@
 
+lldb::VariableSPParseGlobalVariableDIE(
+const lldb_private::SymbolContext& sc,
+DWARFCompileUnit* dwarf_cu,
+const DWARFDebugInfoEntry *die,
+const lldb::addr_t func_low_pc);
+
 size_t  ParseVariables(

Remove this.


http://reviews.llvm.org/D12044



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


Re: [Lldb-commits] [PATCH] D12077: [MIPS] Move is 'or' instead of 'addu'.

2015-08-17 Thread Greg Clayton via lldb-commits
clayborg resigned from this revision.
clayborg removed a reviewer: clayborg.
clayborg added a comment.

I don't think I am the right person to review this as this is in LLVM.


http://reviews.llvm.org/D12077



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


[Lldb-commits] [PATCH] D12077: [MIPS] Move is 'or' instead of 'addu'.

2015-08-17 Thread Simon Dardis via lldb-commits
sdardis created this revision.
sdardis added a reviewer: clayborg.
sdardis added a subscriber: lldb-commits.

Change move encoding in PLTs and tests to be 'or' instead of 'addu'.

http://reviews.llvm.org/D12077

Files:
  lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
  test/elf/Mips/plt-entry-mixed-1.test
  test/elf/Mips/plt-entry-r6-be.test
  test/elf/Mips/plt-entry-r6.test
  test/elf/Mips/plt-header-be.test
  test/elf/Mips/plt-header-mixed.test
  test/elf/Mips/plt-header.test
  test/elf/Mips/rel-dynamic-01.test
  test/elf/Mips/rel-dynamic-03.test

Index: test/elf/Mips/rel-dynamic-03.test
===
--- test/elf/Mips/rel-dynamic-03.test
+++ test/elf/Mips/rel-dynamic-03.test
@@ -24,7 +24,7 @@
 # PLT-NEXT:   400164:  00 20 99 8f  lw  $25, 8192($gp)
 # PLT-NEXT:   400168:  00 20 9c 27  addiu   $gp, $gp, 8192
 # PLT-NEXT:   40016c:  23 c0 1c 03  subu$24, $24, $gp
-# PLT-NEXT:   400170:  21 78 e0 03  move$15, $ra
+# PLT-NEXT:   400170:  25 78 e0 03  move$15, $ra
 # PLT-NEXT:   400174:  82 c0 18 00  srl $24, $24, 2
 # PLT-NEXT:   400178:  09 f8 20 03  jalr$25
 # PLT-NEXT:   40017c:  fe ff 18 27  addiu   $24, $24, -2
Index: test/elf/Mips/rel-dynamic-01.test
===
--- test/elf/Mips/rel-dynamic-01.test
+++ test/elf/Mips/rel-dynamic-01.test
@@ -23,7 +23,7 @@
 # PLT-NEXT:   4001f4:  00 20 99 8f  lw  $25, 8192($gp)
 # PLT-NEXT:   4001f8:  00 20 9c 27  addiu   $gp, $gp, 8192
 # PLT-NEXT:   4001fc:  23 c0 1c 03  subu$24, $24, $gp
-# PLT-NEXT:   400200:  21 78 e0 03  move$15, $ra
+# PLT-NEXT:   400200:  25 78 e0 03  move$15, $ra
 # PLT-NEXT:   400204:  82 c0 18 00  srl $24, $24, 2
 # PLT-NEXT:   400208:  09 f8 20 03  jalr$25
 # PLT-NEXT:   40020c:  fe ff 18 27  addiu   $24, $24, -2
Index: test/elf/Mips/plt-header.test
===
--- test/elf/Mips/plt-header.test
+++ test/elf/Mips/plt-header.test
@@ -19,7 +19,7 @@
 # EXE-NEXT:   400164:  00 20 99 8f  lw  $25, 8192($gp)
 # EXE-NEXT:   400168:  00 20 9c 27  addiu   $gp, $gp, 8192
 # EXE-NEXT:   40016c:  23 c0 1c 03  subu$24, $24, $gp
-# EXE-NEXT:   400170:  21 78 e0 03  move$15, $ra
+# EXE-NEXT:   400170:  25 78 e0 03  move$15, $ra
 # EXE-NEXT:   400174:  82 c0 18 00  srl $24, $24, 2
 # EXE-NEXT:   400178:  09 f8 20 03  jalr$25
 # EXE-NEXT:   40017c:  fe ff 18 27  addiu   $24, $24, -2
Index: test/elf/Mips/plt-header-mixed.test
===
--- test/elf/Mips/plt-header-mixed.test
+++ test/elf/Mips/plt-header-mixed.test
@@ -20,7 +20,7 @@
 # DIS-NEXT:   400174:  00 20 99 8f   lw  $25, 8192($gp)
 # DIS-NEXT:   400178:  00 20 9c 27   addiu   $gp, $gp, 8192
 # DIS-NEXT:   40017c:  23 c0 1c 03   subu$24, $24, $gp
-# DIS-NEXT:   400180:  21 78 e0 03   move $15, $ra
+# DIS-NEXT:   400180:  25 78 e0 03   move$15, $ra
 # DIS-NEXT:   400184:  82 c0 18 00   srl $24, $24, 2
 # DIS-NEXT:   400188:  09 f8 20 03   jalr$25
 # DIS-NEXT:   40018c:  fe ff 18 27   addiu   $24, $24, -2
Index: test/elf/Mips/plt-header-be.test
===
--- test/elf/Mips/plt-header-be.test
+++ test/elf/Mips/plt-header-be.test
@@ -17,7 +17,7 @@
 # CHECK-NEXT:  400164:   8f 99 20 00 lw  $25, 8192($gp)
 # CHECK-NEXT:  400168:   27 9c 20 00 addiu   $gp, $gp, 8192
 # CHECK-NEXT:  40016c:   03 1c c0 23 subu$24, $24, $gp
-# CHECK-NEXT:  400170:   03 e0 78 21 move $15, $ra
+# CHECK-NEXT:  400170:   03 e0 78 25 move$15, $ra
 # CHECK-NEXT:  400174:   00 18 c0 82 srl $24, $24, 2
 # CHECK-NEXT:  400178:   03 20 f8 09 jalr$25
 # CHECK-NEXT:  40017c:   27 18 ff fe addiu   $24, $24, -2
Index: test/elf/Mips/plt-entry-r6.test
===
--- test/elf/Mips/plt-entry-r6.test
+++ test/elf/Mips/plt-entry-r6.test
@@ -17,7 +17,7 @@
 # CHECK-NEXT:   400164:   00 20 99 8f   lw  $25, 8192($gp)
 # CHECK-NEXT:   400168:   00 20 9c 27   addiu   $gp, $gp, 8192
 # CHECK-NEXT:   40016c:   23 c0 1c 03   subu$24, $24, $gp
-# CHECK-NEXT:   400170:   21 78 e0 03   move$15, $ra
+# CHECK-NEXT:   400170:   25 78 e0 03   move$15, $ra
 # CHECK-NEXT:   400174:   82 c0 18 00   srl $24, $24, 2
 # CHECK-NEXT:   400178:   09 f8 20 03   jalr$25
 # CHECK-NEXT:   40017c:   fe ff 18 27   addiu   $24, $24, -2
Index: test/elf/Mips/plt-entry-r6-be.test
===
--- test/elf/Mips/plt-entry-r6-be.test
+++ test/elf/Mips/plt-entry-r6-be.test
@@ -17,7 +17,7 @@
 # CHECK-NEXT:   400164:   8f 99 20 00   lw  $25, 8192($gp)
 # CHECK-NEXT:   400168:   27 9c 20 00   addiu   $gp, $gp, 8192
 # CHECK-NEXT:   40016c:   03 1c c0 23   subu$24, $24, $gp
-# CHECK-NEXT:   400170:   03 e0 78 21   move$15,

Re: [Lldb-commits] [PATCH] D12079: [MIPS] microMIPS breakpoints, disassembly and compressed addresses

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

Many changes. See inlined comments.



Comment at: source/Core/Disassembler.cpp:1169-1187
@@ +1168,21 @@
+
+/*
+ * MIPS:
+ * The bit #0 of an address is used for ISA mode (1 for microMIPS, 0 
for MIPS).
+ * This allows processer to switch between microMIPS and MIPS without 
any need
+ * for special mode-control register. If the address specified in the 
'range'
+ * is a microMIPS address then clear bit #0 and fetch opcode from the 
memory.
+*/
+Address compressed_addr = range.GetBaseAddress();
+if (m_arch.GetMachine() == llvm::Triple::mips64
+|| m_arch.GetMachine() == llvm::Triple::mips64el
+|| m_arch.GetMachine() == llvm::Triple::mips
+|| m_arch.GetMachine() == llvm::Triple::mipsel)
+{
+if ((m_arch.GetFlags() | ArchSpec::eMIPSAse_micromips) == 
ArchSpec::eMIPSAse_micromips
+|| (m_arch.GetFlags() | ArchSpec::eMIPSAse_mips16) == 
ArchSpec::eMIPSAse_mips16)
+{
+compressed_addr.SetOffset (compressed_addr.GetOffset() & (~1));
+}
+}
+

This kind of address snipping is going to be needed in many different places 
and this should be done in:

lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) 
const;

You will note there is already similar functionality for ARM:

```
lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) 
const
{
addr_t opcode_addr = load_addr;
switch (m_arch.GetMachine())
{
case llvm::Triple::arm:
case llvm::Triple::thumb:
switch (addr_class)
{
case eAddressClassData:
case eAddressClassDebug:
return LLDB_INVALID_ADDRESS;

case eAddressClassInvalid:
case eAddressClassUnknown:
case eAddressClassCode:
case eAddressClassCodeAlternateISA:
case eAddressClassRuntime:
opcode_addr &= ~(1ull);
break;
}
break;

default:
break;
}
return opcode_addr;
}
```

Then you would typically access this via "Address::GetCallableLoadAddress 
(Target *target, bool is_indirect) const".

We should probably add a new method to Address:

```
Address 
Address::GetCallableAddress(Target *target, bool is_indirect) const
{
SectionSP section_sp (GetSection());
if (section_sp)
{
ModuleSP module_sp = section_sp->GetModule();
if (module_sp)
{
lldb::addr_t callable_file_addr = target->GetCallableLoadAddress 
(GetFileAddress(), GetAddressClass());
Address callable_addr;
if (module_sp->ResolveFileAddress (callable_file_addr, 
callable_addr))
return callable_addr;
}
}
return *this;
}
```

Then you should use this here:

```
const size_t bytes_read = target->ReadMemory 
(range.GetBaseAddress().GetCallableAddress(target, false),
```


Comment at: source/Core/Disassembler.cpp:1189
@@ -1169,1 +1188,3 @@
+
+const size_t bytes_read = target->ReadMemory 
(compressed_addr.GetFileAddress(),
   prefer_file_cache, 

This is incorrect. You can't pass a file address to target->ReadMemory(...) as 
this will do the wrong thing if you are running. The story goes like this:

lldb_private::Address is a section offset based address that says an address is 
".text + 0x1000". When target->ReadMemory() tries to read memory from this 
address, it can see if "prefer_file_cache" is set and if so, it will grab the 
section from the the address that is passed as the first parameter and then be 
able to get the module from that section and read data from the cached .text 
section contents from the object file in the module.

If you call Target::ReadMemory() with "compressed_addr.GetFileAddress()", it 
will get the file address (the unslid address) of 0x1000 and convert that to a 
Address object.

So just pass your fixed up address, in this case it will be "compressed_addr".


Comment at: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:2098-2112
@@ -2093,1 +2097,17 @@
 
+/*
+ * MIPS:
+ * The bit #0 of an address is used for ISA mode (1 for microMIPS, 0 
for MIPS).
+ * This allows processer to switch between microMIPS and MIPS without 
any need
+ * for special mode-control register. However, apart from .debug_line, 
none of
+ * the ELF/DWARF sections set the ISA bit (for symbol or section). Use 
st_other
+ * flag to check whether the symbol is microMIPS and then set the ISA 
bit
+ * accordingly.
+*/
+if (IS_MICROMIPS(symbol.st_other) &&
+(arch.GetMachine() == llvm::Trip

Re: [Lldb-commits] [PATCH] D12079: [MIPS] microMIPS breakpoints, disassembly and compressed addresses

2015-08-17 Thread Greg Clayton via lldb-commits
clayborg added a comment.

The main thing is, we don't want to be like other debuggers that have all this 
code in many many places that check address bits by checking the Architecture 
and litter the code with bit strips and adding bits where needed. We want to 
support addresses correctly by knowing that a Address has a special address 
class. So we use:

  addr_t
  Address::GetCallableLoadAddress (Target *target, bool is_indirect) const

and

  lldb::addr_t
  Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass 
addr_class) const

Target also has a counterpart that does the actual check since the target has 
the ArchSpec that tells us the architecture. Also if you ever need make a 
special address that needs to have bit zero set, there is:

  lldb::addr_t
  Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass 
addr_class) const


Repository:
  rL LLVM

http://reviews.llvm.org/D12079



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


Re: [Lldb-commits] [PATCH] D12083: [LLGS] Avoid misrepresenting log lines as inferior output

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

Looks good.


http://reviews.llvm.org/D12083



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


[Lldb-commits] [lldb] r245234 - Convert all use of pthreads in tests to c++11 threads.

2015-08-17 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Mon Aug 17 15:12:04 2015
New Revision: 245234

URL: http://llvm.org/viewvc/llvm-project?rev=245234&view=rev
Log:
Convert all use of pthreads in tests to c++11 threads.

This eliminates portability issues among platforms that don't have
a pthreads implementation.

Differential Revision: http://reviews.llvm.org/D12043
Reviewed By: Greg Clayton

Added:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.cpp
lldb/trunk/test/functionalities/thread/thread_specific_break/main.cpp
Removed:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c
lldb/trunk/test/functionalities/thread/thread_specific_break/main.c
Modified:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
lldb/trunk/test/functionalities/thread/create_during_step/main.cpp
lldb/trunk/test/functionalities/thread/exit_during_break/main.cpp
lldb/trunk/test/functionalities/thread/exit_during_step/main.cpp
lldb/trunk/test/functionalities/thread/multi_break/main.cpp
lldb/trunk/test/functionalities/thread/step_out/main.cpp
lldb/trunk/test/functionalities/thread/thread_exit/main.cpp
lldb/trunk/test/functionalities/thread/thread_specific_break/Makefile

lldb/trunk/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py

Modified: lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile?rev=245234&r1=245233&r2=245234&view=diff
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile (original)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile Mon Aug 17 
15:12:04 2015
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-C_SOURCES := locking.c
+CXX_SOURCES := locking.cpp
 ENABLE_THREADS := YES
 
 include $(LEVEL)/Makefile.rules

Modified: 
lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py?rev=245234&r1=245233&r2=245234&view=diff
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py 
(original)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py 
Mon Aug 17 15:12:04 2015
@@ -44,7 +44,7 @@ class ExprDoesntDeadlockTestCase(TestBas
 
 # Now create a breakpoint at source line before call_me_to_get_lock 
gets called.
 
-main_file_spec = lldb.SBFileSpec ("locking.c")
+main_file_spec = lldb.SBFileSpec ("locking.cpp")
 breakpoint = target.BreakpointCreateBySourceRegex('Break here', 
main_file_spec)
 if self.TraceOn():
 print "breakpoint:", breakpoint

Removed: lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c?rev=245233&view=auto
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c (original)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c (removed)
@@ -1,80 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-
-pthread_mutex_t contended_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-pthread_mutex_t control_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t  control_condition;
-
-pthread_mutex_t thread_started_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t  thread_started_condition;
-
-// This function runs in a thread.  The locking dance is to make sure that 
-// by the time the main thread reaches the pthread_join below, this thread
-// has for sure acquired the contended_mutex.  So then the call_me_to_get_lock
-// function will block trying to get the mutex, and only succeed once it
-// signals this thread, then lets it run to wake up from the cond_wait and
-// release the mutex.
-
-void *
-lock_acquirer_1 (void *input)
-{
-  pthread_mutex_lock (&contended_mutex);
-  
-  // Grab this mutex, that will ensure that the main thread
-  // is in its cond_wait for it (since that's when it drops the mutex.
-
-  pthread_mutex_lock (&thread_started_mutex);
-  pthread_mutex_unlock(&thread_started_mutex);
-
-  // Now signal the main thread that it can continue, we have the contended 
lock
-  // so the call to call_me_to_get_lock won't make any progress till  this
-  // thread gets a chance to run.
-
-  pthread_mutex_lock (&control_mutex);
-
-  pthread_cond_signal (&thread_started_condition);
-
-  pthread_cond_wait (&control_condition, &control_mutex);
-
-  pthread_mutex_unlock (&contended_mutex);
-  return NULL;
-}
-
-int
-call_me_to_get_lock ()
-{
-  pthread_cond_signal (&control_condition);
-  pthread_mutex_lock (&contended_mutex);
-  

Re: [Lldb-commits] [lldb] r245217 - [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 mode support

2015-08-17 Thread Hans Wennborg via lldb-commits
I'm OK with it if Greg approves.

 - Hans

On Mon, Aug 17, 2015 at 7:07 AM,   wrote:
> Hi Hans,
>
> Could you please also merge r245217 in the release branch.
>
> Thanks,
> Sagar
>
>  -Original Message-
> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of
> Sagar Thakur via lldb-commits
> Sent: 17 August 2015 19:10
> To: lldb-commits@lists.llvm.org
> Subject: [Lldb-commits] [lldb] r245217 - [LLDB][MIPS] Fix offsets of all
> register sets and add MSA regset and FRE=1 mode support
>
> Author: slthakur
> Date: Mon Aug 17 08:40:17 2015
> New Revision: 245217
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245217&view=rev
> Log:
> [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1
> mode support
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r245216 - [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

2015-08-17 Thread Hans Wennborg via lldb-commits
+lldb-commits

On Mon, Aug 17, 2015 at 1:25 PM, Hans Wennborg  wrote:
> I'm OK with it if Greg approves.
>
>  - Hans
>
> On Mon, Aug 17, 2015 at 7:06 AM,   wrote:
>> Hi Hans,
>>
>> Could you please merge r245216 in the release branch?
>>
>> Thanks,
>> Sagar
>>
>> -Original Message-
>> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of
>> Sagar Thakur via lldb-commits
>> Sent: 17 August 2015 17:36
>> To: lldb-commits@lists.llvm.org
>> Subject: [Lldb-commits] [lldb] r245216 - [LLDB] Use llvm::APInt and
>> llvm::APFloat in Scalar and RegisterValue
>>
>> Author: slthakur
>> Date: Mon Aug 17 07:05:31 2015
>> New Revision: 245216
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=245216&view=rev
>> Log:
>> [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r245217 - [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 mode support

2015-08-17 Thread Greg Clayton via lldb-commits
Ok to merge.
> On Aug 17, 2015, at 1:26 PM, Hans Wennborg  wrote:
> 
> I'm OK with it if Greg approves.
> 
> - Hans
> 
> On Mon, Aug 17, 2015 at 7:07 AM,   wrote:
>> Hi Hans,
>> 
>> Could you please also merge r245217 in the release branch.
>> 
>> Thanks,
>> Sagar
>> 
>> -Original Message-
>> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of
>> Sagar Thakur via lldb-commits
>> Sent: 17 August 2015 19:10
>> To: lldb-commits@lists.llvm.org
>> Subject: [Lldb-commits] [lldb] r245217 - [LLDB][MIPS] Fix offsets of all
>> register sets and add MSA regset and FRE=1 mode support
>> 
>> Author: slthakur
>> Date: Mon Aug 17 08:40:17 2015
>> New Revision: 245217
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=245217&view=rev
>> Log:
>> [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1
>> mode support

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


Re: [Lldb-commits] [lldb] r245216 - [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

2015-08-17 Thread Greg Clayton via lldb-commits
Ok to merge.
> On Aug 17, 2015, at 1:27 PM, Hans Wennborg  wrote:
> 
> +lldb-commits
> 
> On Mon, Aug 17, 2015 at 1:25 PM, Hans Wennborg  wrote:
>> I'm OK with it if Greg approves.
>> 
>> - Hans
>> 
>> On Mon, Aug 17, 2015 at 7:06 AM,   wrote:
>>> Hi Hans,
>>> 
>>> Could you please merge r245216 in the release branch?
>>> 
>>> Thanks,
>>> Sagar
>>> 
>>> -Original Message-
>>> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of
>>> Sagar Thakur via lldb-commits
>>> Sent: 17 August 2015 17:36
>>> To: lldb-commits@lists.llvm.org
>>> Subject: [Lldb-commits] [lldb] r245216 - [LLDB] Use llvm::APInt and
>>> llvm::APFloat in Scalar and RegisterValue
>>> 
>>> Author: slthakur
>>> Date: Mon Aug 17 07:05:31 2015
>>> New Revision: 245216
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=245216&view=rev
>>> Log:
>>> [LLDB] Use llvm::APInt and llvm::APFloat in Scalar and RegisterValue

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


[Lldb-commits] [lldb] r245237 - Make sure to save the types we parse in our SymbolFile's type list so they don't get deleted.

2015-08-17 Thread Greg Clayton via lldb-commits
Author: gclayton
Date: Mon Aug 17 15:31:46 2015
New Revision: 245237

URL: http://llvm.org/viewvc/llvm-project?rev=245237&view=rev
Log:
Make sure to save the types we parse in our SymbolFile's type list so they 
don't get deleted.


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

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=245237&r1=245236&r2=245237&view=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Aug 17 
15:31:46 2015
@@ -3789,15 +3789,23 @@ SymbolFileDWARF::FindDefinitionTypeForDW
 TypeSP
 SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* 
dwarf_cu, const DWARFDebugInfoEntry *die, bool *type_is_new_ptr)
 {
+TypeSP type_sp;
+
 TypeSystem *type_system = 
GetTypeSystemForLanguage(dwarf_cu->GetLanguageType());
 
 if (type_system)
 {
 Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
-return type_system->ParseTypeFromDWARF (sc, this, dwarf_cu, die, log, 
type_is_new_ptr);
+type_sp = type_system->ParseTypeFromDWARF (sc, this, dwarf_cu, die, 
log, type_is_new_ptr);
+if (type_sp)
+{
+TypeList* type_list = GetTypeList();
+if (type_list)
+type_list->Insert(type_sp);
+}
 }
-else
-return TypeSP();
+
+return type_sp;
 }
 
 size_t


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


Re: [Lldb-commits] [lldb] r245217 - [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1 mode support

2015-08-17 Thread Hans Wennborg via lldb-commits
Merged to 3.7 in r245240. There was a conflicts because r245141 isn't
on the branch. Please check that I got it right:
http://llvm.org/viewvc/llvm-project?rev=245240&view=rev

Thanks,
Hans

On Mon, Aug 17, 2015 at 1:28 PM, Greg Clayton  wrote:
> Ok to merge.
>> On Aug 17, 2015, at 1:26 PM, Hans Wennborg  wrote:
>>
>> I'm OK with it if Greg approves.
>>
>> - Hans
>>
>> On Mon, Aug 17, 2015 at 7:07 AM,   wrote:
>>> Hi Hans,
>>>
>>> Could you please also merge r245217 in the release branch.
>>>
>>> Thanks,
>>> Sagar
>>>
>>> -Original Message-
>>> From: lldb-commits [mailto:lldb-commits-boun...@lists.llvm.org] On Behalf Of
>>> Sagar Thakur via lldb-commits
>>> Sent: 17 August 2015 19:10
>>> To: lldb-commits@lists.llvm.org
>>> Subject: [Lldb-commits] [lldb] r245217 - [LLDB][MIPS] Fix offsets of all
>>> register sets and add MSA regset and FRE=1 mode support
>>>
>>> Author: slthakur
>>> Date: Mon Aug 17 08:40:17 2015
>>> New Revision: 245217
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=245217&view=rev
>>> Log:
>>> [LLDB][MIPS] Fix offsets of all register sets and add MSA regset and FRE=1
>>> mode support
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12044: Fix resolution conflict between global and class static variables in C++.

2015-08-17 Thread Paul Herman via lldb-commits
paulherman updated this revision to Diff 32345.
paulherman added a comment.

Fix resolution conflict between global and class static variables in C++


http://reviews.llvm.org/D12044

Files:
  include/lldb/Symbol/Variable.h
  include/lldb/Symbol/VariableList.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Symbol/Variable.cpp
  source/Symbol/VariableList.cpp
  source/Target/StackFrame.cpp
  test/lang/cpp/scope/Makefile
  test/lang/cpp/scope/TestCppScope.py
  test/lang/cpp/scope/main.cpp

Index: test/lang/cpp/scope/main.cpp
===
--- /dev/null
+++ test/lang/cpp/scope/main.cpp
@@ -0,0 +1,25 @@
+class A {
+public:
+static int a;
+int b;
+};
+
+class B {
+public:
+static int a;
+int b;
+};
+
+struct C {
+static int a;
+};
+
+int A::a = ;
+int B::a = ;
+int C::a = ;
+int a = ;
+
+int main() // break here
+{
+return 0;
+}
Index: test/lang/cpp/scope/TestCppScope.py
===
--- /dev/null
+++ test/lang/cpp/scope/TestCppScope.py
@@ -0,0 +1,83 @@
+"""
+Test scopes in C++.
+"""
+import lldb
+from lldbtest import *
+import lldbutil
+
+class TestCppScopes(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipUnlessDarwin
+@dsym_test
+def test_with_dsym_and_run_command(self):
+self.buildDsym()
+self.check()
+
+@dwarf_test
+def test_with_dwarf_and_run_command(self):
+self.buildDwarf()
+self.check()
+
+def setUp(self):
+TestBase.setUp(self)
+
+def check(self):
+# Get main source file
+src_file = "main.cpp"
+src_file_spec = lldb.SBFileSpec(src_file)
+self.assertTrue(src_file_spec.IsValid(), "Main source file")
+
+# Get the path of the executable
+cwd = os.getcwd() 
+exe_file = "a.out"
+exe_path  = os.path.join(cwd, exe_file)
+
+# Load the executable
+target = self.dbg.CreateTarget(exe_path)
+self.assertTrue(target.IsValid(), VALID_TARGET)
+
+# Break on main function
+main_breakpoint = target.BreakpointCreateBySourceRegex("// break here", src_file_spec)
+self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+
+# Launch the process
+args = None
+env = None
+process = target.LaunchSimple(args, env, cwd)
+self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
+
+# Get the thread of the process
+self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+
+# Get current fream of the thread at the breakpoint 
+frame = thread.GetSelectedFrame()
+
+# Test result for scopes of variables 
+
+global_variables = frame.GetVariables(True, True, True, False)
+global_variables_assert = { 
+'A::a': ,
+'B::a': ,
+'C::a': ,
+'::a': ,
+'a': 
+}
+
+self.assertTrue(global_variables.GetSize() == 4, "target variable returns all variables")
+for variable in global_variables:
+name = variable.GetName() 
+self.assertTrue(name in global_variables_assert, "target variable returns wrong variable " + name)
+
+for name in global_variables_assert:
+value = frame.EvaluateExpression(name)
+assert_value = global_variables_assert[name]
+self.assertTrue(value.IsValid() and value.GetValueAsSigned() == assert_value, name + " = " + str(assert_value))
+
+if __name__ == '__main__':
+import atexit
+lldb.SBDebugger.Initialize()
+atexit.register(lambda: lldb.SBDebugger.Terminate())
+unittest2.main()
Index: test/lang/cpp/scope/Makefile
===
--- /dev/null
+++ test/lang/cpp/scope/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
Index: source/Target/StackFrame.cpp
===
--- source/Target/StackFrame.cpp
+++ source/Target/StackFrame.cpp
@@ -659,7 +659,7 @@
 else
 name_const_string.SetCStringWithLength (var_path.c_str(), separator_idx);
 
-var_sp = variable_list->FindVariable(name_const_string);
+var_sp = variable_list->FindVariable(name_const_string, false);
 
 bool synthetically_added_instance_object = false;
 
Index: source/Symbol/VariableList.cpp
===
--- source/Symbol/VariableList.cpp
+++ source/Symbol/VariableList.cpp
@@ -100,32 +100,38 @@
 }
 
 VariableSP
-VariableList::FindVariable(const ConstString& name)
+VariableList::FindVariable(const

Re: [Lldb-commits] [PATCH] D12083: [LLGS] Avoid misrepresenting log lines as inferior output

2015-08-17 Thread Oleksiy Vyalov via lldb-commits
ovyalov accepted this revision.
ovyalov added a comment.

LGTM


http://reviews.llvm.org/D12083



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


[Lldb-commits] Moderator needed

2015-08-17 Thread Tanya Lattner via lldb-commits
Hello! I am looking for 1-2 volunteers to help moderate the lldb-dev and 
lldb-commits mailing lists. Please let me know if you can help!

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


[Lldb-commits] [PATCH] D12092: [ValueObjectSynthetic] Override GetDeclaration.

2015-08-17 Thread Siva Chandra via lldb-commits
sivachandra created this revision.
sivachandra added reviewers: clayborg, granata.enrico.
sivachandra added a subscriber: lldb-commits.

Returns the declaration of the non-sythetic value.

http://reviews.llvm.org/D12092

Files:
  include/lldb/Core/ValueObjectSyntheticFilter.h
  source/Core/ValueObjectSyntheticFilter.cpp
  test/python_api/formatters/TestFormattersSBAPI.py

Index: test/python_api/formatters/TestFormattersSBAPI.py
===
--- test/python_api/formatters/TestFormattersSBAPI.py
+++ test/python_api/formatters/TestFormattersSBAPI.py
@@ -169,6 +169,7 @@
 
 foo_var = 
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
 self.assertTrue(foo_var.IsValid(), 'could not find foo')
+self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration 
is invalid')
 
 self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has 
wrong number of child items (synth)')
 
self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 
'foo_synth.X has wrong value (synth)')
Index: source/Core/ValueObjectSyntheticFilter.cpp
===
--- source/Core/ValueObjectSyntheticFilter.cpp
+++ source/Core/ValueObjectSyntheticFilter.cpp
@@ -314,3 +314,12 @@
 this->ValueObject::SetFormat(format);
 this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
 }
+
+bool
+ValueObjectSynthetic::GetDeclaration (Declaration &decl)
+{
+if (m_parent)
+return m_parent->GetDeclaration(decl);
+
+return ValueObject::GetDeclaration(decl);
+}
Index: include/lldb/Core/ValueObjectSyntheticFilter.h
===
--- include/lldb/Core/ValueObjectSyntheticFilter.h
+++ include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -152,6 +152,9 @@
 virtual void
 SetFormat (lldb::Format format);
 
+virtual bool
+GetDeclaration (Declaration &decl);
+
 protected:
 virtual bool
 UpdateValue ();


Index: test/python_api/formatters/TestFormattersSBAPI.py
===
--- test/python_api/formatters/TestFormattersSBAPI.py
+++ test/python_api/formatters/TestFormattersSBAPI.py
@@ -169,6 +169,7 @@
 
 foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
 self.assertTrue(foo_var.IsValid(), 'could not find foo')
+self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration is invalid')
 
 self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (synth)')
 self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 'foo_synth.X has wrong value (synth)')
Index: source/Core/ValueObjectSyntheticFilter.cpp
===
--- source/Core/ValueObjectSyntheticFilter.cpp
+++ source/Core/ValueObjectSyntheticFilter.cpp
@@ -314,3 +314,12 @@
 this->ValueObject::SetFormat(format);
 this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
 }
+
+bool
+ValueObjectSynthetic::GetDeclaration (Declaration &decl)
+{
+if (m_parent)
+return m_parent->GetDeclaration(decl);
+
+return ValueObject::GetDeclaration(decl);
+}
Index: include/lldb/Core/ValueObjectSyntheticFilter.h
===
--- include/lldb/Core/ValueObjectSyntheticFilter.h
+++ include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -152,6 +152,9 @@
 virtual void
 SetFormat (lldb::Format format);
 
+virtual bool
+GetDeclaration (Declaration &decl);
+
 protected:
 virtual bool
 UpdateValue ();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D12092: [ValueObjectSynthetic] Override GetDeclaration.

2015-08-17 Thread Enrico Granata via lldb-commits
granata.enrico added a comment.

That looks reasonable

Does ValueObjectDynamic need the same change? You could have dynamic+synthetic 
combinations (e.g. NSArray/NSDictionary on Mac OS X) where the synthetic value 
sits on top of the dynamic value


http://reviews.llvm.org/D12092



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


Re: [Lldb-commits] [PATCH] D12044: Fix resolution conflict between global and class static variables in C++.

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

Looks fine.


http://reviews.llvm.org/D12044



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


[Lldb-commits] [lldb] r245261 - Remove unintentional ;'s.

2015-08-17 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Mon Aug 17 19:21:24 2015
New Revision: 245261

URL: http://llvm.org/viewvc/llvm-project?rev=245261&view=rev
Log:
Remove unintentional ;'s.

Modified:
lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp

Modified: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp?rev=245261&r1=245260&r2=245261&view=diff
==
--- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp Mon Aug 
17 19:21:24 2015
@@ -328,9 +328,9 @@ DynamicRegisterInfo::SetRegisterInfo(con
 reg_info.kinds[lldb::eRegisterKindStabs] = i;
 uint32_t eh_frame_regno = LLDB_INVALID_REGNUM;
 reg_info_dict->GetValueForKeyAsInteger("gcc", eh_frame_regno, 
LLDB_INVALID_REGNUM);
-if (eh_frame_regno == LLDB_INVALID_REGNUM);
+if (eh_frame_regno == LLDB_INVALID_REGNUM)
 reg_info_dict->GetValueForKeyAsInteger("ehframe", eh_frame_regno, 
LLDB_INVALID_REGNUM);
-if (eh_frame_regno == LLDB_INVALID_REGNUM);
+if (eh_frame_regno == LLDB_INVALID_REGNUM)
 reg_info_dict->GetValueForKeyAsInteger("eh_frame", eh_frame_regno, 
LLDB_INVALID_REGNUM);
 reg_info.kinds[lldb::eRegisterKindEHFrame] = eh_frame_regno;
 reg_info_dict->GetValueForKeyAsInteger("dwarf", 
reg_info.kinds[lldb::eRegisterKindDWARF], LLDB_INVALID_REGNUM);


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


[Lldb-commits] [lldb] r245262 - Revert part of "Convert all use of pthreads in tests to c++11 threads."

2015-08-17 Thread Chaoren Lin via lldb-commits
Author: chaoren
Date: Mon Aug 17 19:27:08 2015
New Revision: 245262

URL: http://llvm.org/viewvc/llvm-project?rev=245262&view=rev
Log:
Revert part of "Convert all use of pthreads in tests to c++11 threads."

TestExprDoesntBlock started failing because deadlocks behave differently with
pthread_mutex and std::mutex.

This reverts part of commit r245234.

Added:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c
Removed:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.cpp
Modified:
lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py

Modified: lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile?rev=245262&r1=245261&r2=245262&view=diff
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile (original)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile Mon Aug 17 
19:27:08 2015
@@ -1,6 +1,6 @@
 LEVEL = ../../make
 
-CXX_SOURCES := locking.cpp
+C_SOURCES := locking.c
 ENABLE_THREADS := YES
 
 include $(LEVEL)/Makefile.rules

Modified: 
lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py?rev=245262&r1=245261&r2=245262&view=diff
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py 
(original)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py 
Mon Aug 17 19:27:08 2015
@@ -44,7 +44,7 @@ class ExprDoesntDeadlockTestCase(TestBas
 
 # Now create a breakpoint at source line before call_me_to_get_lock 
gets called.
 
-main_file_spec = lldb.SBFileSpec ("locking.cpp")
+main_file_spec = lldb.SBFileSpec ("locking.c")
 breakpoint = target.BreakpointCreateBySourceRegex('Break here', 
main_file_spec)
 if self.TraceOn():
 print "breakpoint:", breakpoint

Added: lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c?rev=245262&view=auto
==
--- lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c (added)
+++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c Mon Aug 17 
19:27:08 2015
@@ -0,0 +1,80 @@
+#include 
+#include 
+#include 
+#include 
+
+pthread_mutex_t contended_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+pthread_mutex_t control_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t  control_condition;
+
+pthread_mutex_t thread_started_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t  thread_started_condition;
+
+// This function runs in a thread.  The locking dance is to make sure that 
+// by the time the main thread reaches the pthread_join below, this thread
+// has for sure acquired the contended_mutex.  So then the call_me_to_get_lock
+// function will block trying to get the mutex, and only succeed once it
+// signals this thread, then lets it run to wake up from the cond_wait and
+// release the mutex.
+
+void *
+lock_acquirer_1 (void *input)
+{
+  pthread_mutex_lock (&contended_mutex);
+  
+  // Grab this mutex, that will ensure that the main thread
+  // is in its cond_wait for it (since that's when it drops the mutex.
+
+  pthread_mutex_lock (&thread_started_mutex);
+  pthread_mutex_unlock(&thread_started_mutex);
+
+  // Now signal the main thread that it can continue, we have the contended 
lock
+  // so the call to call_me_to_get_lock won't make any progress till  this
+  // thread gets a chance to run.
+
+  pthread_mutex_lock (&control_mutex);
+
+  pthread_cond_signal (&thread_started_condition);
+
+  pthread_cond_wait (&control_condition, &control_mutex);
+
+  pthread_mutex_unlock (&contended_mutex);
+  return NULL;
+}
+
+int
+call_me_to_get_lock ()
+{
+  pthread_cond_signal (&control_condition);
+  pthread_mutex_lock (&contended_mutex);
+  return 567;
+}
+
+int main ()
+{
+  pthread_t thread_1;
+
+  pthread_cond_init (&control_condition, NULL);
+  pthread_cond_init (&thread_started_condition, NULL);
+
+  pthread_mutex_lock (&thread_started_mutex);
+
+  pthread_create (&thread_1, NULL, lock_acquirer_1, NULL);
+  
+  pthread_cond_wait (&thread_started_condition, &thread_started_mutex);
+
+  pthread_mutex_lock (&control_mutex);
+  pthread_mutex_unlock (&control_mutex);
+
+  // Break here.  At this point the other thread will have the contended_mutex,
+  // and be sitting in its cond_wait for the control condition.  So there is
+  // no way that our by-hand calling of call_me_to_get_lock will proceed
+  // without running the first thread at least 

Re: [Lldb-commits] [PATCH] D12092: [ValueObjectSynthetic] Override GetDeclaration.

2015-08-17 Thread Siva Chandra via lldb-commits
sivachandra updated this revision to Diff 32362.
sivachandra added a comment.

Override GetDeclaration in ValueObjectDynamicValue as well.


http://reviews.llvm.org/D12092

Files:
  include/lldb/Core/ValueObjectDynamicValue.h
  include/lldb/Core/ValueObjectSyntheticFilter.h
  source/Core/ValueObjectDynamicValue.cpp
  source/Core/ValueObjectSyntheticFilter.cpp
  test/python_api/formatters/TestFormattersSBAPI.py

Index: test/python_api/formatters/TestFormattersSBAPI.py
===
--- test/python_api/formatters/TestFormattersSBAPI.py
+++ test/python_api/formatters/TestFormattersSBAPI.py
@@ -169,6 +169,7 @@
 
 foo_var = 
self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
 self.assertTrue(foo_var.IsValid(), 'could not find foo')
+self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration 
is invalid')
 
 self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has 
wrong number of child items (synth)')
 
self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 
'foo_synth.X has wrong value (synth)')
Index: source/Core/ValueObjectSyntheticFilter.cpp
===
--- source/Core/ValueObjectSyntheticFilter.cpp
+++ source/Core/ValueObjectSyntheticFilter.cpp
@@ -314,3 +314,12 @@
 this->ValueObject::SetFormat(format);
 this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
 }
+
+bool
+ValueObjectSynthetic::GetDeclaration (Declaration &decl)
+{
+if (m_parent)
+return m_parent->GetDeclaration(decl);
+
+return ValueObject::GetDeclaration(decl);
+}
Index: source/Core/ValueObjectDynamicValue.cpp
===
--- source/Core/ValueObjectDynamicValue.cpp
+++ source/Core/ValueObjectDynamicValue.cpp
@@ -421,3 +421,12 @@
 SetNeedsUpdate();
 return ret_val;
 }
+
+bool
+ValueObjectDynamicValue::GetDeclaration (Declaration &decl)
+{
+if (m_parent)
+return m_parent->GetDeclaration(decl);
+
+return ValueObject::GetDeclaration(decl);
+}
Index: include/lldb/Core/ValueObjectSyntheticFilter.h
===
--- include/lldb/Core/ValueObjectSyntheticFilter.h
+++ include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -152,6 +152,9 @@
 virtual void
 SetFormat (lldb::Format format);
 
+virtual bool
+GetDeclaration (Declaration &decl);
+
 protected:
 virtual bool
 UpdateValue ();
Index: include/lldb/Core/ValueObjectDynamicValue.h
===
--- include/lldb/Core/ValueObjectDynamicValue.h
+++ include/lldb/Core/ValueObjectDynamicValue.h
@@ -85,7 +85,7 @@
 {
 return m_parent->GetSP();
 }
-
+
 void
 SetOwningSP (lldb::ValueObjectSP &owning_sp)
 {
@@ -105,6 +105,9 @@
 virtual TypeImpl
 GetTypeImpl ();
 
+virtual bool
+GetDeclaration (Declaration &decl);
+
 protected:
 virtual bool
 UpdateValue ();


Index: test/python_api/formatters/TestFormattersSBAPI.py
===
--- test/python_api/formatters/TestFormattersSBAPI.py
+++ test/python_api/formatters/TestFormattersSBAPI.py
@@ -169,6 +169,7 @@
 
 foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
 self.assertTrue(foo_var.IsValid(), 'could not find foo')
+self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration is invalid')
 
 self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (synth)')
 self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 'foo_synth.X has wrong value (synth)')
Index: source/Core/ValueObjectSyntheticFilter.cpp
===
--- source/Core/ValueObjectSyntheticFilter.cpp
+++ source/Core/ValueObjectSyntheticFilter.cpp
@@ -314,3 +314,12 @@
 this->ValueObject::SetFormat(format);
 this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
 }
+
+bool
+ValueObjectSynthetic::GetDeclaration (Declaration &decl)
+{
+if (m_parent)
+return m_parent->GetDeclaration(decl);
+
+return ValueObject::GetDeclaration(decl);
+}
Index: source/Core/ValueObjectDynamicValue.cpp
===
--- source/Core/ValueObjectDynamicValue.cpp
+++ source/Core/ValueObjectDynamicValue.cpp
@@ -421,3 +421,12 @@
 SetNeedsUpdate();
 return ret_val;
 }
+
+bool
+ValueObjectDynamicValue::GetDeclaration (Declaration &decl)
+{
+if (m_parent)
+return m_parent->GetDeclaration(decl);
+
+return ValueObject::GetDeclaration(decl);
+}
Index: include/lldb/Core/ValueObjectSyntheticFilter.h
=

Re: [Lldb-commits] [PATCH] D12092: [ValueObjectSynthetic and ValueObjectDynamicValue] Override GetDeclaration

2015-08-17 Thread Enrico Granata via lldb-commits
granata.enrico accepted this revision.
granata.enrico added a comment.
This revision is now accepted and ready to land.

Assuming it passes the test suite, LGTM


http://reviews.llvm.org/D12092



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


Re: [Lldb-commits] [lldb] r245262 - Revert part of "Convert all use of pthreads in tests to c++11 threads."

2015-08-17 Thread Zachary Turner via lldb-commits
Strange, I'll take a look tomorrow.  Thanks for catching this

On Mon, Aug 17, 2015 at 5:28 PM Chaoren Lin via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: chaoren
> Date: Mon Aug 17 19:27:08 2015
> New Revision: 245262
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245262&view=rev
> Log:
> Revert part of "Convert all use of pthreads in tests to c++11 threads."
>
> TestExprDoesntBlock started failing because deadlocks behave differently
> with
> pthread_mutex and std::mutex.
>
> This reverts part of commit r245234.
>
> Added:
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c
> Removed:
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.cpp
> Modified:
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
>
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
>
> Modified: lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile?rev=245262&r1=245261&r2=245262&view=diff
>
> ==
> --- lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile
> (original)
> +++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/Makefile Mon Aug
> 17 19:27:08 2015
> @@ -1,6 +1,6 @@
>  LEVEL = ../../make
>
> -CXX_SOURCES := locking.cpp
> +C_SOURCES := locking.c
>  ENABLE_THREADS := YES
>
>  include $(LEVEL)/Makefile.rules
>
> Modified:
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py?rev=245262&r1=245261&r2=245262&view=diff
>
> ==
> ---
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
> (original)
> +++
> lldb/trunk/test/functionalities/expr-doesnt-deadlock/TestExprDoesntBlock.py
> Mon Aug 17 19:27:08 2015
> @@ -44,7 +44,7 @@ class ExprDoesntDeadlockTestCase(TestBas
>
>  # Now create a breakpoint at source line before
> call_me_to_get_lock gets called.
>
> -main_file_spec = lldb.SBFileSpec ("locking.cpp")
> +main_file_spec = lldb.SBFileSpec ("locking.c")
>  breakpoint = target.BreakpointCreateBySourceRegex('Break here',
> main_file_spec)
>  if self.TraceOn():
>  print "breakpoint:", breakpoint
>
> Added: lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c?rev=245262&view=auto
>
> ==
> --- lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c (added)
> +++ lldb/trunk/test/functionalities/expr-doesnt-deadlock/locking.c Mon Aug
> 17 19:27:08 2015
> @@ -0,0 +1,80 @@
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +pthread_mutex_t contended_mutex = PTHREAD_MUTEX_INITIALIZER;
> +
> +pthread_mutex_t control_mutex = PTHREAD_MUTEX_INITIALIZER;
> +pthread_cond_t  control_condition;
> +
> +pthread_mutex_t thread_started_mutex = PTHREAD_MUTEX_INITIALIZER;
> +pthread_cond_t  thread_started_condition;
> +
> +// This function runs in a thread.  The locking dance is to make sure that
> +// by the time the main thread reaches the pthread_join below, this thread
> +// has for sure acquired the contended_mutex.  So then the
> call_me_to_get_lock
> +// function will block trying to get the mutex, and only succeed once it
> +// signals this thread, then lets it run to wake up from the cond_wait and
> +// release the mutex.
> +
> +void *
> +lock_acquirer_1 (void *input)
> +{
> +  pthread_mutex_lock (&contended_mutex);
> +
> +  // Grab this mutex, that will ensure that the main thread
> +  // is in its cond_wait for it (since that's when it drops the mutex.
> +
> +  pthread_mutex_lock (&thread_started_mutex);
> +  pthread_mutex_unlock(&thread_started_mutex);
> +
> +  // Now signal the main thread that it can continue, we have the
> contended lock
> +  // so the call to call_me_to_get_lock won't make any progress till  this
> +  // thread gets a chance to run.
> +
> +  pthread_mutex_lock (&control_mutex);
> +
> +  pthread_cond_signal (&thread_started_condition);
> +
> +  pthread_cond_wait (&control_condition, &control_mutex);
> +
> +  pthread_mutex_unlock (&contended_mutex);
> +  return NULL;
> +}
> +
> +int
> +call_me_to_get_lock ()
> +{
> +  pthread_cond_signal (&control_condition);
> +  pthread_mutex_lock (&contended_mutex);
> +  return 567;
> +}
> +
> +int main ()
> +{
> +  pthread_t thread_1;
> +
> +  pthread_cond_init (&control_condition, NULL);
> +  pthread_cond_init (&thread_started_condition, NULL);
> +
> +  pthread_mutex_lock (&thread_started_mutex);
> +
> +  pthread_create (&thread_1, NULL, lock_acquirer_1, NULL);
> +
> +  pthread_cond_wait (&thread_