[Lldb-commits] [PATCH] D84402: [lldb/DWARF] Add more line table validation

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath marked an inline comment as done.
labath added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1044
   for (const llvm::DWARFDebugLine::Sequence  : line_table->Sequences) {
+if (!list.ContainsFileAddressRange(seq.LowPC, seq.HighPC - seq.LowPC))
+  continue;

clayborg wrote:
> dblaikie wrote:
> > Could you specifically look for/propagate tombstones here, to reduce the 
> > risk of large functions overlapping with the valid address range, even when 
> > they're tombstoned to zero? (because zero+large function size could still 
> > end up overlapping with valid code)
> > 
> > To do that well, I guess it'd have to be implemented at a lower-layer, 
> > inside the line table state machine - essentially dropping all lines 
> > derived from a "set address" operation that specifies a tombstone.
> Just checking if the section lists contains an address doesn't help weed out 
> addresses that were tombstoned to zero since our PT_LOAD[0] will almost 
> always contain zero for shared libraries. It might be nice to make a list of 
> addresses that come from sections with read + execute permissions and store 
> that in SymbolFileDWARF one time at startup. Then these searches will be 
> faster as we are looking in less ranges, and most likely will not contain 
> address zero. This code will catch the -1 and -2 tombstones, but most linkers 
> I have run into use zero and the tombstone. 
> 
> If our algorithm only checks sections with no subsections and then makes a 
> list of file addresses for and section ranges for those, we should have a 
> great list. The entire PT_LOAD[0] will usually be mapped read + execute, so 
> we can't just check top level sections for ELF. Mach-o also has this issue 
> __TEXT in mac is also mapped read + execute and usually contains zero for 
> shared libraries, but since the sections must come after the mach-o header, 
> the sections within the __TEXT segment have correct permissions and would 
> work, just like they would for ELF.
You're right -- this would not handle shared libraries with base zero.

I am slightly uneasy about requiring executable permissions for all line 
tables. While it does not seem terribly useful to have line tables for 
non-executable code, if someone does have a line table for it for whatever 
reason (maybe he wants to make it executable at runtime?) it would be a shame 
not to display it. Also the choice of using section rather than segment 
permissions feels slightly arbitrary (although I could make a case for it), as 
it's the segment permissions which will actually define the runtime memory 
permissions.

Since this is really about filtering out (near) zero addresses, how about we 
make that explicit? Find the lowest executable (section) address and reject 
anything below that? Additionally, I'd also reject all addresses which are 
completely outside of the module range, as those not going to get used for 
anything, and they are generating bogus line-table dumps.

What do you think?

David: The -1 tombstones are already sort of handled in llvm (and in lldb since 
D83957). They are "handled" in the sense that the all sequences with and end PC 
lower than the start PC are rejected (and line sequences starting with 
(unsigned)-1 will definitely wrap). This is trying to do something about the 
zero tombstones.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84402/new/

https://reviews.llvm.org/D84402



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


[Lldb-commits] [PATCH] D84257: [lldb] Don't use hardware index to determine whether a breakpoint site is hardware

2020-07-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

I went further than just moving m_hardware_index from StoppointLocation. 
Please, take a look at D84527  and let me know 
what you think about that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84257/new/

https://reviews.llvm.org/D84257



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


[Lldb-commits] [PATCH] D84401: [lldb] Add SectionList::ContainsFileAddressRange

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath planned changes to this revision.
labath added a comment.

Waiting for the resolution of the discussion in the follow-up patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84401/new/

https://reviews.llvm.org/D84401



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


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-07-24 Thread Shu Anzai via Phabricator via lldb-commits
gedatsu217 added a comment.

Yes, I'm testing it on Mac.

By the way, I checked its output on the error message. When the test failed, 
the characters, `buffer (last 100 chars) : ~~~`, are displayed as an error 
message.  I thought it was pexpect's output, possibly it is not that output?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001



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


[Lldb-commits] [PATCH] D84501: NativeThreadLinux invalidate register cache on stop

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Yep, looks good.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84501/new/

https://reviews.llvm.org/D84501



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


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D81001#2170570 , @gedatsu217 wrote:

> I checked what's the sequence that actually gets output, and it was like 
> below.
>
>   h\x1b[2melp frame\x1b[0m\x1b[1Ghe\x1b[2mlp frame\x1b[0m\x1b[1Gel\x1b[2mp 
> frame\x1b[0m\x1b[1Gl
>
>
> Is it not good to check these characters in `expect_exact`?


The problem with that is that it might make the test too strict and susceptible 
to changes in libedit behavior (either due to different versions or different 
timings). There are many ways to achieve the same thing after all.
So, I would stick to the tail of the sequence which is printed after `l` is 
"pressed".

That said, are you sure this is the right sequence? `\x1b[1Gl` seems like it 
should print the `l` at column one, which does not sound right...

The sequence I got in this test was `l\x1b[2mp frame\x1b[0m\x1b[1G\r\x1b[9Cl`, 
which seems more believable. If I am decoding that correctly, it does:

- `l` - `l` is "pressed" and printed
- `\x1b[2mp frame\x1b[0m` - lldb prints "p frame" in faint
- `\x1b[1G` - libedit moves cursor to column 1
- `\r` - moves cursor to column 1 again (not sure why, probably to work around 
some terminal bugs)
- `\x1b[9C` - moves cursor 9 characters forward (`strlen("(lldb) he")`)
- `l` - redraws `l`

If that sequence works for you, then this is what I'd suggest putting in the 
test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001



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


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D81001#2171999 , @gedatsu217 wrote:

> > That said, are you sure this is the right sequence? \x1b[1Gl seems like it 
> > should print the l at column one, which does not sound right...
>
> I thought it did not add up too, but pexpect probably actually outputs these 
> characters.
>
> > The sequence I got in this test was l\x1b[2mp 
> > frame\x1b[0m\x1b[1G\r\x1b[9Cl, which seems more believable.
>
> It did not go well...  However,  `"l" + faint_color + "p frame" + reset + 
> "\x1b[1G" + "l"` passed the test.
>  This test ensure that the cursor is behind "l", but I do not understand what 
> role "\x1b[1G" plays...
>
> What do you think about this test?


I think it won't pass on my machine because that's not the sequence I am 
getting. :(

I can see how different libedit versions could produce different sequences, but 
I do not understand how can the one you're seeing be "right".

Are you testing this on a mac? Lemme try what I get there...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001



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


[Lldb-commits] [PATCH] D84501: NativeThreadLinux invalidate register cache on stop

2020-07-24 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 280374.
omjavaid added a comment.

Corrected a typo.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84501/new/

https://reviews.llvm.org/D84501

Files:
  lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp


Index: lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -241,9 +241,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
reinterpret_cast(data));
 }
@@ -265,9 +262,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   // If hardware single-stepping is not supported, we just do a continue. The
   // breakpoint on the next instruction has been setup in
   // NativeProcessLinux::Resume.
@@ -325,6 +319,9 @@
   if (m_state == StateType::eStateStepping)
 m_step_workaround.reset();
 
+  // On every stop, clear any cached register data structures
+  GetRegisterContext().InvalidateAllRegisters();
+
   const StateType new_state = StateType::eStateStopped;
   MaybeLogStateChange(new_state);
   m_state = new_state;


Index: lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -241,9 +241,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
reinterpret_cast(data));
 }
@@ -265,9 +262,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   // If hardware single-stepping is not supported, we just do a continue. The
   // breakpoint on the next instruction has been setup in
   // NativeProcessLinux::Resume.
@@ -325,6 +319,9 @@
   if (m_state == StateType::eStateStepping)
 m_step_workaround.reset();
 
+  // On every stop, clear any cached register data structures
+  GetRegisterContext().InvalidateAllRegisters();
+
   const StateType new_state = StateType::eStateStopped;
   MaybeLogStateChange(new_state);
   m_state = new_state;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84528: [lldb][NFC] Use a StringRef for AddRegexCommand::AddRegexCommand parameters

2020-07-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added a subscriber: JDevlieghere.

This way we can get rid of this 1024 char buffer workaround.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D84528

Files:
  lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Interpreter/CommandObjectRegexCommand.cpp


Index: lldb/source/Interpreter/CommandObjectRegexCommand.cpp
===
--- lldb/source/Interpreter/CommandObjectRegexCommand.cpp
+++ lldb/source/Interpreter/CommandObjectRegexCommand.cpp
@@ -69,14 +69,13 @@
   return false;
 }
 
-bool CommandObjectRegexCommand::AddRegexCommand(const char *re_cstr,
-const char *command_cstr) {
+bool CommandObjectRegexCommand::AddRegexCommand(llvm::StringRef re_cstr,
+llvm::StringRef command_cstr) {
   m_entries.resize(m_entries.size() + 1);
   // Only add the regular expression if it compiles
-  m_entries.back().regex =
-  RegularExpression(llvm::StringRef::withNullAsEmpty(re_cstr));
+  m_entries.back().regex = RegularExpression(re_cstr);
   if (m_entries.back().regex.IsValid()) {
-m_entries.back().command.assign(command_cstr);
+m_entries.back().command = command_cstr.str();
 return true;
   }
   // The regex didn't compile...
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -631,15 +631,10 @@
   if (tbreak_regex_cmd_up) {
 bool success = true;
 for (size_t i = 0; i < num_regexes; i++) {
-  // If you add a resultant command string longer than 1024 characters be
-  // sure to increase the size of this buffer.
-  char buffer[1024];
-  int num_printed =
-  snprintf(buffer, 1024, "%s %s", break_regexes[i][1], "-o 1");
-  lldbassert(num_printed < 1024);
-  UNUSED_IF_ASSERT_DISABLED(num_printed);
+  std::string command = break_regexes[i][1];
+  command += " -o 1";
   success =
-  tbreak_regex_cmd_up->AddRegexCommand(break_regexes[i][0], buffer);
+  tbreak_regex_cmd_up->AddRegexCommand(break_regexes[i][0], command);
   if (!success)
 break;
 }
Index: lldb/source/Commands/CommandObjectCommands.cpp
===
--- lldb/source/Commands/CommandObjectCommands.cpp
+++ lldb/source/Commands/CommandObjectCommands.cpp
@@ -970,7 +970,7 @@
   std::string subst(std::string(regex_sed.substr(
   second_separator_char_pos + 1,
   third_separator_char_pos - second_separator_char_pos - 1)));
-  m_regex_cmd_up->AddRegexCommand(regex.c_str(), subst.c_str());
+  m_regex_cmd_up->AddRegexCommand(regex, subst);
 }
 return error;
   }
Index: lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h
===
--- lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h
+++ lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h
@@ -30,7 +30,7 @@
 
   bool IsRemovable() const override { return m_is_removable; }
 
-  bool AddRegexCommand(const char *re_cstr, const char *command_cstr);
+  bool AddRegexCommand(llvm::StringRef re_cstr, llvm::StringRef command_cstr);
 
   bool HasRegexEntries() const { return !m_entries.empty(); }
 


Index: lldb/source/Interpreter/CommandObjectRegexCommand.cpp
===
--- lldb/source/Interpreter/CommandObjectRegexCommand.cpp
+++ lldb/source/Interpreter/CommandObjectRegexCommand.cpp
@@ -69,14 +69,13 @@
   return false;
 }
 
-bool CommandObjectRegexCommand::AddRegexCommand(const char *re_cstr,
-const char *command_cstr) {
+bool CommandObjectRegexCommand::AddRegexCommand(llvm::StringRef re_cstr,
+llvm::StringRef command_cstr) {
   m_entries.resize(m_entries.size() + 1);
   // Only add the regular expression if it compiles
-  m_entries.back().regex =
-  RegularExpression(llvm::StringRef::withNullAsEmpty(re_cstr));
+  m_entries.back().regex = RegularExpression(re_cstr);
   if (m_entries.back().regex.IsValid()) {
-m_entries.back().command.assign(command_cstr);
+m_entries.back().command = command_cstr.str();
 return true;
   }
   // The regex didn't compile...
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -631,15 +631,10 @@
   if (tbreak_regex_cmd_up) {
 bool success = true;
 for (size_t i = 0; i < num_regexes; 

[Lldb-commits] [PATCH] D84257: [lldb] Don't use hardware index to determine whether a breakpoint site is hardware

2020-07-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha updated this revision to Diff 280448.
tatyana-krasnukha added a comment.

@omjavaid, thank you for verifying this!

Added the checks that IsHardware is consistent with m_hardware_index.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84257/new/

https://reviews.llvm.org/D84257

Files:
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Breakpoint/StoppointLocation.h
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/Watchpoint.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  
lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

Index: lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
===
--- lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
+++ lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py
@@ -17,27 +17,6 @@
 def does_not_support_hw_breakpoints(self):
 return not super().supports_hw_breakpoints()
 
-# LLDB on linux supports hardware breakpoints for arm and aarch64
-# architectures.
-@skipUnlessPlatform(oslist=['linux'])
-@skipTestIfFn(does_not_support_hw_breakpoints)
-def test_hw_break_set_delete_multi_thread_linux(self):
-self.build()
-self.setTearDownCleanup()
-self.break_multi_thread('delete', False) # llvm.org/PR44659
-
-# LLDB on linux supports hardware breakpoints for arm and aarch64
-# architectures.
-@skipUnlessPlatform(oslist=['linux'])
-@skipTestIfFn(does_not_support_hw_breakpoints)
-def test_hw_break_set_disable_multi_thread_linux(self):
-self.build()
-self.setTearDownCleanup()
-self.break_multi_thread('disable', False) # llvm.org/PR44659
-
-# LLDB on darwin supports hardware breakpoints for x86_64 and i386
-# architectures.
-@skipUnlessDarwin
 @skipIfOutOfTreeDebugserver
 @skipTestIfFn(does_not_support_hw_breakpoints)
 def test_hw_break_set_delete_multi_thread_macos(self):
@@ -45,9 +24,6 @@
 self.setTearDownCleanup()
 self.break_multi_thread('delete')
 
-# LLDB on darwin supports hardware breakpoints for x86_64 and i386
-# architectures.
-@skipUnlessDarwin
 @skipIfOutOfTreeDebugserver
 @skipTestIfFn(does_not_support_hw_breakpoints)
 def test_hw_break_set_disable_multi_thread_macos(self):
@@ -55,7 +31,6 @@
 self.setTearDownCleanup()
 self.break_multi_thread('disable')
 
-
 def setUp(self):
 # Call super's setUp().
 TestBase.setUp(self)
@@ -65,7 +40,7 @@
 self.first_stop = line_number(
 self.source, 'Starting thread creation with hardware breakpoint set')
 
-def break_multi_thread(self, removal_type, check_hw_bp=True):
+def break_multi_thread(self, removal_type):
 """Test that lldb hardware breakpoints work for multiple threads."""
 self.runCmd("file " + self.getBuildArtifact("a.out"),
 CURRENT_EXECUTABLE_SET)
@@ -109,10 +84,9 @@
 # Continue the loop and test that we are stopped 4 times.
 count += 1
 
-if check_hw_bp:
-# Check the breakpoint list.
-self.expect("breakpoint list", substrs=['hw_break_function', 'hardware'])
-self.expect("breakpoint list -v", substrs=['function = hw_break_function', 'hardware = true'])
+# Check the breakpoint list.
+self.expect("breakpoint list", substrs=['hw_break_function', 'hardware'])
+self.expect("breakpoint list -v", substrs=['function = hw_break_function', 'hardware = true'])
 
 if removal_type == 'delete':
 self.runCmd("settings set auto-confirm true")
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3204,14 +3204,8 @@
   break;
 
 case BreakpointSite::eExternal: {
-  GDBStoppointType stoppoint_type;
-  if (bp_site->IsHardware())
-stoppoint_type = eBreakpointHardware;
-  else
-stoppoint_type = eBreakpointSoftware;
-
-  if (m_gdb_comm.SendGDBStoppointTypePacket(stoppoint_type, false, addr,
-bp_op_size))
+  if (m_gdb_comm.SendGDBStoppointTypePacket(eBreakpointSoftware, false,
+addr, bp_op_size))
 error.SetErrorToGenericError();
 } break;
 }
Index: 

[Lldb-commits] [PATCH] D84501: NativeThreadLinux invalidate register cache on stop

2020-07-24 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
omjavaid added a reviewer: labath.
Herald added a reviewer: rengolin.

In our discussion D79699  SVE ptrace register 
access support we decide to
invalidate register context cached data on every stop instead of doing
at before Step/Resume.

  

InvalidateAllRegisters was added to facilitate flushing of SVE register
context configuration and cached register values. It now makes more
sense to move invalidation after every stop where we initiate SVE
configuration update if needed by calling ConfigureRegisterContext.


https://reviews.llvm.org/D84501

Files:
  lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp


Index: lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -241,9 +241,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
reinterpret_cast(data));
 }
@@ -265,9 +262,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   // If hardware single-stepping is not supported, we just do a continue. The
   // breakpoint on the next instruction has been setup in
   // NativeProcessLinux::Resume.
@@ -325,6 +319,9 @@
   if (m_state == StateType::eStateStepping)
 m_step_workaround.reset();
 
+  // Before thread resumes, clear any cached register data structures
+  GetRegisterContext().InvalidateAllRegisters();
+
   const StateType new_state = StateType::eStateStopped;
   MaybeLogStateChange(new_state);
   m_state = new_state;


Index: lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
+++ lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
@@ -241,9 +241,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   return NativeProcessLinux::PtraceWrapper(PTRACE_CONT, GetID(), nullptr,
reinterpret_cast(data));
 }
@@ -265,9 +262,6 @@
   if (signo != LLDB_INVALID_SIGNAL_NUMBER)
 data = signo;
 
-  // Before thread resumes, clear any cached register data structures
-  GetRegisterContext().InvalidateAllRegisters();
-
   // If hardware single-stepping is not supported, we just do a continue. The
   // breakpoint on the next instruction has been setup in
   // NativeProcessLinux::Resume.
@@ -325,6 +319,9 @@
   if (m_state == StateType::eStateStepping)
 m_step_workaround.reset();
 
+  // Before thread resumes, clear any cached register data structures
+  GetRegisterContext().InvalidateAllRegisters();
+
   const StateType new_state = StateType::eStateStopped;
   MaybeLogStateChange(new_state);
   m_state = new_state;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-07-24 Thread Shu Anzai via Phabricator via lldb-commits
gedatsu217 added a comment.

> That said, are you sure this is the right sequence? \x1b[1Gl seems like it 
> should print the l at column one, which does not sound right...

I thought it did not add up too, but pexpect probably actually outputs these 
characters.

> The sequence I got in this test was l\x1b[2mp frame\x1b[0m\x1b[1G\r\x1b[9Cl, 
> which seems more believable.

It did not go well...  However,  `"l" + faint_color + "p frame" + reset + 
"\x1b[1G" + "l"` passed the test.
This test ensure that the cursor is behind "l", but I do not understand what 
role "\x1b[1G" plays...

What do you think about this test?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001



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


[Lldb-commits] [PATCH] D84527: Rename StoppointLocation to StoppointSite and drop its relationship with BreakpointLocation

2020-07-24 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha created this revision.
Herald added subscribers: lldb-commits, yaxunl, mgorny.
Herald added a project: LLDB.

Working on the patch  D84257  I noticed that 
both BreakpointLocation and BreakpointSite were inherited from 
StoppointLocation. Also, I noticed that they have not so much in common, except 
the //id// and hit counting logic.
There is no polymorphic code that uses a pointer/reference to StoppointLocation 
to handle one of BreakpointLocation and BreakpointSite either.

The patch renames  StoppointLocation to StoppointSite and stops 
BreakpointLocation's inheriting from it.
Hit counting is encapsulated into StoppointHitCounter which is re-used it in 
StoppointSite, BreakpointLocation, and Breakpoint.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84527

Files:
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/include/lldb/Breakpoint/BreakpointLocation.h
  lldb/include/lldb/Breakpoint/BreakpointSite.h
  lldb/include/lldb/Breakpoint/StoppointHitCounter.h
  lldb/include/lldb/Breakpoint/StoppointLocation.h
  lldb/include/lldb/Breakpoint/StoppointSite.h
  lldb/include/lldb/Breakpoint/Watchpoint.h
  lldb/source/Breakpoint/Breakpoint.cpp
  lldb/source/Breakpoint/BreakpointLocation.cpp
  lldb/source/Breakpoint/BreakpointSite.cpp
  lldb/source/Breakpoint/CMakeLists.txt
  lldb/source/Breakpoint/StoppointLocation.cpp
  lldb/source/Breakpoint/StoppointSite.cpp
  lldb/source/Breakpoint/Watchpoint.cpp
  lldb/source/Target/Target.cpp

Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1233,7 +1233,7 @@
 if (!wp_sp)
   return false;
 
-wp_sp->ResetHitCount();
+wp_sp->m_hit_counter.Reset();
   }
   return true; // Success!
 }
Index: lldb/source/Breakpoint/Watchpoint.cpp
===
--- lldb/source/Breakpoint/Watchpoint.cpp
+++ lldb/source/Breakpoint/Watchpoint.cpp
@@ -25,7 +25,7 @@
 
 Watchpoint::Watchpoint(Target , lldb::addr_t addr, uint32_t size,
const CompilerType *type, bool hardware)
-: StoppointLocation(0, addr, size, hardware), m_target(target),
+: StoppointSite(0, addr, size, hardware), m_target(target),
   m_enabled(false), m_is_hardware(hardware), m_is_watch_variable(false),
   m_is_ephemeral(false), m_disabled_count(0), m_watch_read(0),
   m_watch_write(0), m_watch_was_read(0), m_watch_was_written(0),
@@ -93,8 +93,6 @@
   m_watch_spec_str = str;
 }
 
-// Override default impl of StoppointLocation::IsHardware() since m_is_hardware
-// member field is more accurate.
 bool Watchpoint::IsHardware() const {
   lldbassert(m_is_hardware || GetHardwareIndex() == LLDB_INVALID_INDEX32);
   lldbassert(m_is_hardware || !HardwareRequired());
@@ -127,12 +125,12 @@
 void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() {
   ++m_false_alarms;
   if (m_false_alarms) {
-if (m_hit_count >= m_false_alarms) {
-  m_hit_count -= m_false_alarms;
+if (m_hit_counter.GetValue() >= m_false_alarms) {
+  m_hit_counter.Decrement(m_false_alarms);
   m_false_alarms = 0;
 } else {
-  m_false_alarms -= m_hit_count;
-  m_hit_count = 0;
+  m_false_alarms -= m_hit_counter.GetValue();
+  m_hit_counter.Reset();
 }
   }
 }
@@ -141,7 +139,7 @@
 // should continue.
 
 bool Watchpoint::ShouldStop(StoppointCallbackContext *context) {
-  IncrementHitCount();
+  m_hit_counter.Increment();
 
   return IsEnabled();
 }
Index: lldb/source/Breakpoint/StoppointSite.cpp
===
--- /dev/null
+++ lldb/source/Breakpoint/StoppointSite.cpp
@@ -0,0 +1,24 @@
+//===-- StoppointSite.cpp -===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Breakpoint/StoppointSite.h"
+
+
+using namespace lldb;
+using namespace lldb_private;
+
+// StoppointSite constructor
+StoppointSite::StoppointSite(break_id_t id, addr_t addr, bool hardware)
+: m_id(id), m_addr(addr), m_is_hardware_required(hardware),
+  m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(0), m_hit_counter() {}
+
+StoppointSite::StoppointSite(break_id_t id, addr_t addr,
+ uint32_t byte_size, bool hardware)
+: m_id(id), m_addr(addr), m_is_hardware_required(hardware),
+  m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(byte_size),
+  m_hit_counter() {}
Index: lldb/source/Breakpoint/StoppointLocation.cpp
===
--- lldb/source/Breakpoint/StoppointLocation.cpp
+++ /dev/null
@@ -1,32 +0,0 @@

[Lldb-commits] [PATCH] D79699: Add ptrace register access for AArch64 SVE registers

2020-07-24 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid updated this revision to Diff 280373.
omjavaid added a comment.

In this update I have moved ConfigureRegisterContext insider 
InvalidateAllRegisters in light of D84501  
where we move InvalidateAllRegisters on every stop rather than doing so before 
step/resume


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79699/new/

https://reviews.llvm.org/D79699

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.h
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
  lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/Makefile
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
  
lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c

Index: lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c
===
--- /dev/null
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/main.c
@@ -0,0 +1,5 @@
+int main() {
+  asm volatile("ptrue p0.s\n\t");
+  asm volatile("fcpy  z0.s, p0/m, #5.\n\t");
+  return 0; // Set a break point here.
+}
\ No newline at end of file
Index: lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
===
--- /dev/null
+++ lldb/test/API/commands/register/register/aarch64_sve_registers/rw_access_static_config/TestSVERegisters.py
@@ -0,0 +1,144 @@
+"""
+Test the AArch64 SVE registers.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class RegisterCommandsTestCase(TestBase):
+
+def check_sve_register_size(self, set, name, expected):
+reg_value = set.GetChildMemberWithName(name)
+self.assertTrue(reg_value.IsValid(),
+'Verify we have a register named "%s"' % (name))
+self.assertEqual(reg_value.GetByteSize(), expected,
+ 'Verify "%s" == %i' % (name, expected))
+
+mydir = TestBase.compute_mydir(__file__)
+
+@no_debug_info_test
+@skipIf(archs=no_match(["aarch64"]))
+@skipIf(oslist=no_match(['linux']))
+def test_sve_registers_configuration(self):
+"""Test AArch64 SVE registers size configuration."""
+self.build()
+self.line = line_number('main.c', '// Set a break point here.')
+
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(
+self, "main.c", self.line, num_expected_locations=1)
+self.runCmd("run", RUN_SUCCEEDED)
+
+self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
+substrs=["stop reason = breakpoint 1."])
+
+target = self.dbg.GetSelectedTarget()
+process = target.GetProcess()
+thread = process.GetThreadAtIndex(0)
+currentFrame = thread.GetFrameAtIndex(0)
+
+has_sve = False
+for registerSet in currentFrame.GetRegisters():
+if 'Scalable Vector Extension Registers' in registerSet.GetName():
+has_sve = True
+
+if not has_sve:
+self.skipTest('SVE registers must be supported.')
+
+registerSets = process.GetThreadAtIndex(
+0).GetFrameAtIndex(0).GetRegisters()
+
+sve_registers = registerSets.GetValueAtIndex(2)
+
+vg_reg = sve_registers.GetChildMemberWithName("vg")
+
+vg_reg_value = sve_registers.GetChildMemberWithName(
+"vg").GetValueAsUnsigned()
+
+z_reg_size = vg_reg_value * 8
+
+p_reg_size = z_reg_size / 8
+
+for i in range(32):
+self.check_sve_register_size(
+sve_registers, 'z%i' % (i), z_reg_size)
+
+for i in range(16):
+self.check_sve_register_size(
+sve_registers, 'p%i' % (i), p_reg_size)
+
+self.check_sve_register_size(sve_registers, 'ffr', p_reg_size)
+
+@no_debug_info_test
+@skipIf(archs=no_match(["aarch64"]))
+@skipIf(oslist=no_match(['linux']))
+def test_sve_registers_read_write(self):
+"""Test AArch64 SVE registers read and write."""
+self.build()
+self.line = line_number('main.c', '// Set a break point here.')
+
+exe = self.getBuildArtifact("a.out")
+self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+lldbutil.run_break_set_by_file_and_line(
+self, "main.c", self.line, num_expected_locations=1)
+self.runCmd("run", 

[Lldb-commits] [PATCH] D84475: [lldb] Inform every language runtime of the modified modules

2020-07-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

(Mea culpa, I thought the Swift recognizers would be as trivial to fix as the 
upstream ones)


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84475/new/

https://reviews.llvm.org/D84475



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


[Lldb-commits] [PATCH] D84530: [lldb] Modernize away some snprintf calls

2020-07-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added a subscriber: JDevlieghere.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D84530

Files:
  lldb/source/Commands/CommandObjectProcess.cpp
  lldb/source/Core/Communication.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/SourceManager.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Core/ValueObjectChild.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp

Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1982,10 +1982,7 @@
 if (value_type != OptionParser::eOptionalArgument)
   new_args.AppendArgument(value);
 else {
-  char buffer[255];
-  ::snprintf(buffer, sizeof(buffer), "%s%s", option.c_str(),
- value.c_str());
-  new_args.AppendArgument(llvm::StringRef(buffer));
+  new_args.AppendArgument(option + value);
 }
 
   } else if (static_cast(index) >= cmd_args.GetArgumentCount()) {
@@ -2007,10 +2004,7 @@
 if (value_type != OptionParser::eOptionalArgument)
   new_args.AppendArgument(cmd_args.GetArgumentAtIndex(index));
 else {
-  char buffer[255];
-  ::snprintf(buffer, sizeof(buffer), "%s%s", option.c_str(),
- cmd_args.GetArgumentAtIndex(index));
-  new_args.AppendArgument(buffer);
+  new_args.AppendArgument(option + cmd_args.GetArgumentAtIndex(index));
 }
 used[index] = true;
   }
Index: lldb/source/Core/ValueObjectChild.cpp
===
--- lldb/source/Core/ValueObjectChild.cpp
+++ lldb/source/Core/ValueObjectChild.cpp
@@ -57,15 +57,8 @@
 
 static void AdjustForBitfieldness(ConstString ,
   uint8_t bitfield_bit_size) {
-  if (name && bitfield_bit_size) {
-const char *compiler_type_name = name.AsCString();
-if (compiler_type_name) {
-  std::vector bitfield_type_name(strlen(compiler_type_name) + 32, 0);
-  ::snprintf(_type_name.front(), bitfield_type_name.size(),
- "%s:%u", compiler_type_name, bitfield_bit_size);
-  name.SetCString(_type_name.front());
-}
-  }
+  if (name && bitfield_bit_size)
+name.SetString(llvm::formatv("{0}:{1}", name, bitfield_bit_size).str());
 }
 
 ConstString ValueObjectChild::GetTypeName() {
Index: lldb/source/Core/ValueObject.cpp
===
--- lldb/source/Core/ValueObject.cpp
+++ lldb/source/Core/ValueObject.cpp
@@ -1702,8 +1702,7 @@
bool can_create) {
   ValueObjectSP synthetic_child_sp;
   if (IsPointerType() || IsArrayType()) {
-char index_str[64];
-snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index);
+std::string index_str = llvm::formatv("[{0}]", index);
 ConstString index_const_str(index_str);
 // Check if we have already created a synthetic array member in this valid
 // object. If we have we will re-use it.
@@ -1730,8 +1729,7 @@
  bool can_create) {
   ValueObjectSP synthetic_child_sp;
   if (IsScalarType()) {
-char index_str[64];
-snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to);
+std::string index_str = llvm::formatv("[{0}-{1}]", from, to);
 ConstString index_const_str(index_str);
 // Check if we have already created a synthetic array member in this valid
 // object. If we have we will re-use it.
@@ -1768,9 +1766,7 @@
   ValueObjectSP synthetic_child_sp;
 
   if (name_const_str.IsEmpty()) {
-char name_str[64];
-snprintf(name_str, sizeof(name_str), "@%i", offset);
-name_const_str.SetCString(name_str);
+name_const_str.SetString("@" + std::to_string(offset));
   }
 
   // Check if we have already created a synthetic array member in this valid
Index: lldb/source/Core/SourceManager.cpp
===
--- lldb/source/Core/SourceManager.cpp
+++ lldb/source/Core/SourceManager.cpp
@@ -183,14 +183,14 @@
 break;
   }
 
-  char prefix[32] = "";
+  std::string prefix;
   if (bp_locs) {
 uint32_t bp_count = bp_locs->NumLineEntriesWithLine(line);
 
 if (bp_count > 0)
-  ::snprintf(prefix, sizeof(prefix), "[%u] ", bp_count);
+  prefix = llvm::formatv("[{0}]", bp_count);
 else
-  ::snprintf(prefix, sizeof(prefix), "");
+  prefix = "";
   }
 
   char buffer[3];
@@ -206,7 +206,8 @@
 .str());
   }
 
-  s->Printf("%s%s %-4u\t", prefix, current_line_highlight.c_str(), line);
+  s->Printf("%s%s %-4u\t", prefix.c_str(), current_line_highlight.c_str(),
+line);
 
   // So 

[Lldb-commits] [PATCH] D84537: [lldb/AppleSimulator] Always provide a -simulator environment

2020-07-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp:270
+static const ArchSpec platform_arch(
+HostInfo::GetArchitecture(HostInfo::eArchKind64));
+arch = platform_arch;

I guess I should really know this... does this construct create a static 
initializer? If yes, isn't that something we generally want to avoid in LLVM?

I checked: HostInfo::GetArchitecture() caches the result anyway, so there is no 
need to cache it again here.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h:59
+  llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;
+  llvm::ArrayRef m_supported_triples = {};
+

If the StringRef is supposed to be a triple, we might want to store an array of 
llvm::Triple instead? They are basically std::strings.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp:81
+case llvm::Triple::aarch64:
 case llvm::Triple::x86_64: {
   const llvm::Triple  = arch->GetTriple();

at some point we should factor out all the common code in the simulator 
platforms ...



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp:159
+  static const llvm::StringRef supported_triples[] = {
+  "x86_64-apple-tvos-simulator",
+  };

I'm probably missing something: Instead of declaring the static list of 
supported triples here and then manually adding the host architecture, why not 
create the list on-the-fly in GetSupportedArchitectureAtIndex()? Is 
`m_supported_triples` used directly somewhere?

Something like:

```
switch (i) {
#ifdef __APPLE__
#if __arm64__
case 0:  return  "arm64-apple-tvos-simulator";
case 1:  return  "x86_64-apple-tvos-simulator";
case 2: return "x86_64h-apple-tvos-simulator",
  };
#else
if (is_haswell)
switch (i) {
case 0: return "x86_64h-apple-tvos-simulator";
case 1: return "x86_64-apple-tvos-simulator";
}
else  return "x86_64-apple-tvos-simulator"
```




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84537/new/

https://reviews.llvm.org/D84537



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


[Lldb-commits] [PATCH] D84537: [lldb/AppleSimulator] Always provide a -simulator environment

2020-07-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added inline comments.



Comment at: lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp:72
+  }
+}
+

Does this explicitly test that platform[0] == HostInfo::GetArchitecture()?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84537/new/

https://reviews.llvm.org/D84537



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


[Lldb-commits] [PATCH] D84475: [lldb] Inform every language runtime of the modified modules

2020-07-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

LGTM with a few nits that can be fixed if needed




Comment at: lldb/source/Target/Process.cpp:5762-5764
   if (sys_runtime) {
 sys_runtime->ModulesDidLoad(module_list);
   }

remove braces?



Comment at: lldb/source/Target/Process.cpp:5772-5774
+  for (auto  : m_instrumentation_runtimes) {
+runtime.second->ModulesDidLoad(module_list);
   }

remove braces now that this is just a single line


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84475/new/

https://reviews.llvm.org/D84475



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


[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Petr Hosek via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d09ecf36175: [CMake] Simplify CMake handling for zlib 
(authored by phosek).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79219/new/

https://reviews.llvm.org/D79219

Files:
  clang/CMakeLists.txt
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/test/lit.common.configured.in
  lld/CMakeLists.txt
  lld/test/CMakeLists.txt
  lld/test/lit.site.cfg.py.in
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/CRC.cpp
  llvm/lib/Support/Compression.cpp
  llvm/test/CMakeLists.txt
  llvm/test/lit.site.cfg.py.in
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -21,7 +21,7 @@
 
 namespace {
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 
 void TestZlibCompression(StringRef Input, int Level) {
   SmallString<32> Compressed;
Index: llvm/test/lit.site.cfg.py.in
===
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -33,7 +33,7 @@
 config.host_ldflags = '@HOST_LDFLAGS@'
 config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = @HAVE_LIBZ@
+config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.have_libxar = @HAVE_LIBXAR@
 config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
 config.enable_ffi = @LLVM_ENABLE_FFI@
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -1,12 +1,12 @@
 llvm_canonicalize_cmake_booleans(
   BUILD_SHARED_LIBS
   HAVE_LIBXAR
-  HAVE_LIBZ
   HAVE_OCAMLOPT
   HAVE_OCAML_OUNIT
   LLVM_ENABLE_DIA_SDK
   LLVM_ENABLE_FFI
   LLVM_ENABLE_THREADS
+  LLVM_ENABLE_ZLIB
   LLVM_INCLUDE_GO_TESTS
   LLVM_LIBXML2_ENABLED
   LLVM_LINK_LLVM_DYLIB
Index: llvm/lib/Support/Compression.cpp
===
--- llvm/lib/Support/Compression.cpp
+++ llvm/lib/Support/Compression.cpp
@@ -17,13 +17,13 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H
+#if LLVM_ENABLE_ZLIB
 #include 
 #endif
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 static Error createError(StringRef Err) {
   return make_error(Err, inconvertibleErrorCode());
 }
Index: llvm/lib/Support/CRC.cpp
===
--- llvm/lib/Support/CRC.cpp
+++ llvm/lib/Support/CRC.cpp
@@ -25,7 +25,7 @@
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H
+#if !LLVM_ENABLE_ZLIB
 
 static const uint32_t CRCTable[256] = {
 0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
Index: llvm/lib/Support/CMakeLists.txt
===
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -1,7 +1,7 @@
-set(system_libs)
-if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
-  set(system_libs ${system_libs} ${ZLIB_LIBRARIES})
+if(LLVM_ENABLE_ZLIB)
+  set(imported_libs ZLIB::ZLIB)
 endif()
+
 if( MSVC OR MINGW )
   # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
   # advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
@@ -194,10 +194,34 @@
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
   ${Backtrace_INCLUDE_DIRS}
-  LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES}
+  LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES}
   )
 
-set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
+set(llvm_system_libs ${system_libs})
+
+if(LLVM_ENABLE_ZLIB)
+  string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
+  get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
+  if(NOT zlib_library)
+get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
+  endif()
+  get_filename_component(zlib_library ${zlib_library} NAME)
+  if(CMAKE_STATIC_LIBRARY_PREFIX AND zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*")
+STRING(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
+  endif()
+  if(CMAKE_STATIC_LIBRARY_SUFFIX AND zlib_library MATCHES ".*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
+STRING(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
+  endif()
+  if(CMAKE_SHARED_LIBRARY_PREFIX AND 

[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-07-24 Thread Shu Anzai via Phabricator via lldb-commits
gedatsu217 added a comment.

I do not intend for this feature to work with colors disabled.

I found that pexpect output the below sequence, and this passed the test.

  self.child.expect_exact("\x1b[" + str(len("(lldb) he") + 1) + "G" + "l" + 
"\x1b[2m" + "p frame" + "\x1b[0m\x1b[1G" + "l" + "\x1b[1G\x1b[2m" + "(lldb) " + 
"\x1b[22m\x1b[" + str(len("(lldb) hel") + 1) + "G")

Probably, "(lldb)" is redisplayed every time a character is typed. On the other 
hand, the character is placed in the designated position.

However, there are two strange points.

1. When a character is typed, it is placed in the designated position, but 
later, it is placed again in column one and overwritten by "(lldb)".
2. About "\x1b[22m". I think this is equal to "\x1b[0m", but the test failed 
when I replace "\x1b[22m" with "\x1b[0m".

Do you think this is a valid test?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001



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


[Lldb-commits] [lldb] 58d84eb - debugserver: Support ios simulator load command disambiguation in qProcessInfo

2020-07-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-07-24T09:49:16-07:00
New Revision: 58d84eb534252747115b358c890a1b79c65d4ad4

URL: 
https://github.com/llvm/llvm-project/commit/58d84eb534252747115b358c890a1b79c65d4ad4
DIFF: 
https://github.com/llvm/llvm-project/commit/58d84eb534252747115b358c890a1b79c65d4ad4.diff

LOG: debugserver: Support ios simulator load command disambiguation in 
qProcessInfo

This patch basically moves the disambiguation code from a place where
it was complicated to implement straight to where the load command is
parsed, which has the neat side affect of actually supporting all call
sites!

rdar://problem/66011909

Differential Revision: https://reviews.llvm.org/D84480

Added: 


Modified: 
lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
lldb/tools/debugserver/source/DNB.cpp
lldb/tools/debugserver/source/MacOSX/MachProcess.h
lldb/tools/debugserver/source/MacOSX/MachProcess.mm

Removed: 




diff  --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py 
b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
index 6e67fdc879be..824cb9eee295 100644
--- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
+++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
@@ -27,18 +27,28 @@ def check_debugserver(self, log, expected_platform, 
expected_version):
 """scan the debugserver packet log"""
 logfile = open(log, "r")
 dylib_info = None
-response = False
+process_info_ostype = None
+expect_dylib_info_response = False
+expect_process_info_response = False
 for line in logfile:
-if response:
+if expect_dylib_info_response:
 while line[0] != '$':
 line = line[1:]
 line = line[1:]
 # Unescape '}'.
 dylib_info = json.loads(line.replace('}]','}')[:-4])
-response = False
+expect_dylib_info_response = False
 if 'send packet: $jGetLoadedDynamicLibrariesInfos:{' in line:
-response = True
-
+expect_dylib_info_response = True
+if expect_process_info_response:
+for pair in line.split(';'):
+keyval = pair.split(':')
+if len(keyval) == 2 and keyval[0] == 'ostype':
+process_info_ostype = keyval[1]
+if 'send packet: $qProcessInfo#' in line:
+expect_process_info_response = True
+
+self.assertEquals(process_info_ostype, expected_platform)
 self.assertTrue(dylib_info)
 aout_info = None
 for image in dylib_info['images']:

diff  --git a/lldb/tools/debugserver/source/DNB.cpp 
b/lldb/tools/debugserver/source/DNB.cpp
index af13a8f8208b..0830ea36a91a 100644
--- a/lldb/tools/debugserver/source/DNB.cpp
+++ b/lldb/tools/debugserver/source/DNB.cpp
@@ -1393,7 +1393,10 @@ const char *DNBGetDeploymentInfo(nub_process_t pid,
  uint32_t& patch_version) {
   MachProcessSP procSP;
   if (GetProcessSP(pid, procSP)) {
-// FIXME: This doesn't correct for older ios simulator and macCatalyst.
+// FIXME: This doesn't return the correct result when xctest (a
+// macOS binary) is loaded with the macCatalyst dyld platform
+// override. The image info corrects for this, but qProcessInfo
+// will return what is in the binary.
 auto info = procSP->GetDeploymentInfo(lc, load_command_address);
 major_version = info.major_version;
 minor_version = info.minor_version;

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.h 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
index c749dd8426c5..9d712390ac2a 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -236,9 +236,6 @@ class MachProcess {
 operator bool() { return platform > 0; }
 /// The Mach-O platform type;
 unsigned char platform = 0;
-/// Pre-LC_BUILD_VERSION files don't disambiguate between ios and ios
-/// simulator.
-bool maybe_simulator = false;
 uint32_t major_version = 0;
 uint32_t minor_version = 0;
 uint32_t patch_version = 0;

diff  --git a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm 
b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
index 8a35f605daa3..10eaf38ea435 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -617,7 +617,28 @@ static bool FBSAddEventDataToOptions(NSMutableDictionary 
*options,
 info.major_version = vers_cmd.version >> 16;
 info.minor_version = (vers_cmd.version >> 8) & 0xffu;
 info.patch_version = vers_cmd.version & 0xffu;
-info.maybe_simulator = true;
+
+// Disambiguate legacy simulator platforms.
+#if (defined(__x86_64__) || defined(__i386__))
+// If 

[Lldb-commits] [PATCH] D84527: Rename StoppointLocation to StoppointSite and drop its relationship with BreakpointLocation

2020-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Some nits but overall this looks good.




Comment at: lldb/include/lldb/Breakpoint/Breakpoint.h:657
   bool m_resolve_indirect_symbols;
-  uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been
-// hit.  This is kept
+  StoppointHitCounter m_hit_counter; // Number of times this breakpoint has 
been
+ // hit. This is kept

Please make this a Doxygen comment `///` above the variable. 



Comment at: lldb/include/lldb/Breakpoint/StoppointHitCounter.h:37
+private:
+  uint32_t m_hit_count = 0; ///< Number of times this breakpoint/watchpoint has
+///< been hit.

With the 80 col limit the trailing comments are really hard to read and 
maintain. Please put them above the variable.



Comment at: lldb/include/lldb/Breakpoint/StoppointSite.h:20
+public:
+  // Constructors and Destructors
+  StoppointSite(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);

I'm slowly getting rid of these (rather useless) comments, so let's not add any 
new ones :-) 



Comment at: lldb/include/lldb/Breakpoint/StoppointSite.h:52
+protected:
+  lldb::break_id_t m_id; ///< Stoppoint site ID.
+  lldb::addr_t m_addr; ///< The load address of this stop point.

Same comment as earlier. 



Comment at: lldb/include/lldb/Breakpoint/StoppointSite.h:66
+private:
+  // For StoppointSite only
+  StoppointSite(const StoppointSite &) = delete;

Private already conveys that. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84527/new/

https://reviews.llvm.org/D84527



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


[Lldb-commits] [PATCH] D84537: [lldb/AppleSimulator] Always provide a -simulator environment

2020-07-24 Thread Frederic Riss via Phabricator via lldb-commits
friss created this revision.
friss added a reviewer: aprantl.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

This commit is somewhat NFC-ish today as the environment of triples
is not considered when comparing s if one of them is
not set (I plan to change that).

We have made simulator triples unambiguous these days, but the
simulator platforms still advertise triples without the
environment. This wasn't an issue when the sims ran only on
a very different architecure than the real device, but this
has changed with Apple Silicon.

This patch simplifies the way GetSupportedArchitectureAtIndex
is implemented for the sim platforms and adds the environment.
It also trivially adds support for Apple Silicon to those
platforms.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84537

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
  lldb/unittests/Platform/CMakeLists.txt
  lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp

Index: lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
===
--- /dev/null
+++ lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
@@ -0,0 +1,74 @@
+//===-- PlatformAppleSimulatorTest.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
+#include "TestingSupport/SubsystemRAII.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Target/Platform.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+class PlatformAppleSimulatorTest : public ::testing::Test {
+  SubsystemRAII
+  subsystems;
+};
+
+#ifdef __APPLE__
+
+static void testSimPlatformArchHasSimEnvironment(llvm::StringRef name) {
+  Status error;
+  auto platform_sp = Platform::Create(ConstString(name), error);
+  ASSERT_TRUE(platform_sp);
+  int num_arches = 0;
+
+  while (true) {
+ArchSpec arch;
+if (!platform_sp->GetSupportedArchitectureAtIndex(num_arches, arch))
+  break;
+EXPECT_EQ(arch.GetTriple().getEnvironment(), llvm::Triple::Simulator);
+num_arches++;
+  }
+
+  EXPECT_GT(num_arches, 0);
+}
+
+TEST_F(PlatformAppleSimulatorTest, TestSimHasSimEnvionament) {
+  testSimPlatformArchHasSimEnvironment("ios-simulator");
+  testSimPlatformArchHasSimEnvironment("tvos-simulator");
+  testSimPlatformArchHasSimEnvironment("watchos-simulator");
+}
+
+TEST_F(PlatformAppleSimulatorTest, TestHostPlatformToSim) {
+  static const ArchSpec platform_arch(
+  HostInfo::GetArchitecture(HostInfo::eArchKindDefault));
+
+  const llvm::Triple::OSType sim_platforms[] = {
+  llvm::Triple::IOS,
+  llvm::Triple::TvOS,
+  llvm::Triple::WatchOS,
+  };
+
+  for (auto sim : sim_platforms) {
+ArchSpec arch = platform_arch;
+arch.GetTriple().setOS(sim);
+arch.GetTriple().setEnvironment(llvm::Triple::Simulator);
+
+Status error;
+auto platform_sp = Platform::Create(arch, nullptr, error);
+EXPECT_TRUE(platform_sp);
+  }
+}
+
+#endif
Index: lldb/unittests/Platform/CMakeLists.txt
===
--- lldb/unittests/Platform/CMakeLists.txt
+++ lldb/unittests/Platform/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(LLDBPlatformTests
+  PlatformAppleSimulatorTest.cpp
   PlatformDarwinTest.cpp
 
   LINK_LIBS
Index: lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
@@ -64,9 +64,6 @@
   FindProcesses(const lldb_private::ProcessInstanceInfoMatch _info,
 lldb_private::ProcessInstanceInfoList _infos) override;
 
-  bool GetSupportedArchitectureAtIndex(uint32_t idx,
-   lldb_private::ArchSpec ) override;
-
   void
   AddClangModuleCompilationOptions(lldb_private::Target *target,
std::vector ) override {
Index: 

[Lldb-commits] [PATCH] D84402: [lldb/DWARF] Add more line table validation

2020-07-24 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1044
   for (const llvm::DWARFDebugLine::Sequence  : line_table->Sequences) {
+if (!list.ContainsFileAddressRange(seq.LowPC, seq.HighPC - seq.LowPC))
+  continue;

labath wrote:
> clayborg wrote:
> > dblaikie wrote:
> > > Could you specifically look for/propagate tombstones here, to reduce the 
> > > risk of large functions overlapping with the valid address range, even 
> > > when they're tombstoned to zero? (because zero+large function size could 
> > > still end up overlapping with valid code)
> > > 
> > > To do that well, I guess it'd have to be implemented at a lower-layer, 
> > > inside the line table state machine - essentially dropping all lines 
> > > derived from a "set address" operation that specifies a tombstone.
> > Just checking if the section lists contains an address doesn't help weed 
> > out addresses that were tombstoned to zero since our PT_LOAD[0] will almost 
> > always contain zero for shared libraries. It might be nice to make a list 
> > of addresses that come from sections with read + execute permissions and 
> > store that in SymbolFileDWARF one time at startup. Then these searches will 
> > be faster as we are looking in less ranges, and most likely will not 
> > contain address zero. This code will catch the -1 and -2 tombstones, but 
> > most linkers I have run into use zero and the tombstone. 
> > 
> > If our algorithm only checks sections with no subsections and then makes a 
> > list of file addresses for and section ranges for those, we should have a 
> > great list. The entire PT_LOAD[0] will usually be mapped read + execute, so 
> > we can't just check top level sections for ELF. Mach-o also has this issue 
> > __TEXT in mac is also mapped read + execute and usually contains zero for 
> > shared libraries, but since the sections must come after the mach-o header, 
> > the sections within the __TEXT segment have correct permissions and would 
> > work, just like they would for ELF.
> You're right -- this would not handle shared libraries with base zero.
> 
> I am slightly uneasy about requiring executable permissions for all line 
> tables. While it does not seem terribly useful to have line tables for 
> non-executable code, if someone does have a line table for it for whatever 
> reason (maybe he wants to make it executable at runtime?) it would be a shame 
> not to display it. Also the choice of using section rather than segment 
> permissions feels slightly arbitrary (although I could make a case for it), 
> as it's the segment permissions which will actually define the runtime memory 
> permissions.
> 
> Since this is really about filtering out (near) zero addresses, how about we 
> make that explicit? Find the lowest executable (section) address and reject 
> anything below that? Additionally, I'd also reject all addresses which are 
> completely outside of the module range, as those not going to get used for 
> anything, and they are generating bogus line-table dumps.
> 
> What do you think?
> 
> David: The -1 tombstones are already sort of handled in llvm (and in lldb 
> since D83957). They are "handled" in the sense that the all sequences with 
> and end PC lower than the start PC are rejected (and line sequences starting 
> with (unsigned)-1 will definitely wrap). This is trying to do something about 
> the zero tombstones.
> Since this is really about filtering out (near) zero addresses, how about we 
> make that explicit? Find the lowest executable (section) address and reject 
> anything below that? Additionally, I'd also reject all addresses which are 
> completely outside of the module range, as those not going to get used for 
> anything, and they are generating bogus line-table dumps.
> 
> What do you think?

That will work for me. My main goal is to get anything that should have been 
dead stripped out from appearing in results for line lookups or function 
lookups. The quicker we can short circuit these cases the better for 
performance. We can also use this when we try to lookup functions and don't 
return any matches for functions whose start address falls below this value.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84402/new/

https://reviews.llvm.org/D84402



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


[Lldb-commits] [lldb] 22c1636 - [lldb/ObjectFileMachO] Correctly account for resolver symbols

2020-07-24 Thread Fred Riss via lldb-commits

Author: Fred Riss
Date: 2020-07-24T09:19:17-07:00
New Revision: 22c16360dd00230987fee5f6f3c57f8071144cc1

URL: 
https://github.com/llvm/llvm-project/commit/22c16360dd00230987fee5f6f3c57f8071144cc1
DIFF: 
https://github.com/llvm/llvm-project/commit/22c16360dd00230987fee5f6f3c57f8071144cc1.diff

LOG: [lldb/ObjectFileMachO] Correctly account for resolver symbols

Summary:
The resolver addresses stored in the dyld trie are relative to the base
of the __TEXT segment. This is usually 0 in a dylib, so this was never
noticed, but it is not 0 for most dylibs integrated in the shared cache.
As we started using the shared cache images recently as symbol source,
this causes LLDB to fail to resolve symbols which go through a runtime
resolver.

Reviewers: jasonmolenda, jingham

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D84083

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/test/API/macosx/indirect_symbol/Makefile

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index ab1a6a8bb5f3..338c798e6cef 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1990,6 +1990,8 @@ static bool ParseTrieEntries(DataExtractor , 
lldb::offset_t offset,
   if (e.entry.flags & EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER) {
 e.entry.other = data.GetULEB128();
 uint64_t resolver_addr = e.entry.other;
+if (text_seg_base_addr != LLDB_INVALID_ADDRESS)
+  resolver_addr += text_seg_base_addr;
 if (is_arm)
   resolver_addr &= THUMB_ADDRESS_BIT_MASK;
 resolver_addresses.insert(resolver_addr);

diff  --git a/lldb/test/API/macosx/indirect_symbol/Makefile 
b/lldb/test/API/macosx/indirect_symbol/Makefile
index 929ed58f7575..9069302b39c4 100644
--- a/lldb/test/API/macosx/indirect_symbol/Makefile
+++ b/lldb/test/API/macosx/indirect_symbol/Makefile
@@ -8,7 +8,8 @@ include Makefile.rules
 
 build-libindirect: indirect.c
$(MAKE) -f $(MAKEFILE_RULES) \
-   DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES
+   DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES \
+   LD_EXTRAS="-Wl,-image_base,0x2"
 
 build-libreepxoprt: reexport.c
$(MAKE) -f $(MAKEFILE_RULES) \



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


[Lldb-commits] [PATCH] D84475: [lldb] Inform every language runtime of the modified modules

2020-07-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84475/new/

https://reviews.llvm.org/D84475



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


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D81001#2172035 , @labath wrote:

> In D81001#2171999 , @gedatsu217 
> wrote:
>
> > > That said, are you sure this is the right sequence? \x1b[1Gl seems like 
> > > it should print the l at column one, which does not sound right...
> >
> > I thought it did not add up too, but pexpect probably actually outputs 
> > these characters.
> >
> > > The sequence I got in this test was l\x1b[2mp 
> > > frame\x1b[0m\x1b[1G\r\x1b[9Cl, which seems more believable.
> >
> > It did not go well...  However,  `"l" + faint_color + "p frame" + reset + 
> > "\x1b[1G" + "l"` passed the test.
> >  This test ensure that the cursor is behind "l", but I do not understand 
> > what role "\x1b[1G" plays...
> >
> > What do you think about this test?
>
>
> I think it won't pass on my machine because that's not the sequence I am 
> getting. :(
>
> I can see how different libedit versions could produce different sequences, 
> but I do not understand how can the one you're seeing be "right".
>
> Are you testing this on a mac? Lemme try what I get there...


Ok, so I was able to confirm what you are seeing on a mac. I don't fully 
understand what is happening but the problem is related to the use-color 
setting. Our pexpect harness starts lldb with colors disabled, and this seems 
to be causing lldb (or libedit) to go berserk. Indeed if you start lldb without 
colors manually (`lldb --no-use-color`), you will see that this feature (on a 
mac) misbehaves -- the cursor gets moved to the first column just like we 
expected based on the ansi sequences. On linux everything seems to be working 
fine even without colors.

Now the question is what to do about it? Did you actually intend for your 
feature to work with colors disabled? If yes, then we'll need to figure out why 
things don't work on a mac. If no, then we'll need to customize our test 
harness to enable launching lldb with colors for the autosuggestion tests. And 
then we'll need to find the right sequence to expect...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81001/new/

https://reviews.llvm.org/D81001



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


[Lldb-commits] [PATCH] D84480: debugserver: Support ios simulator load command disambiguation in qProcessInfo

2020-07-24 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG58d84eb53425: debugserver: Support ios simulator load 
command disambiguation in qProcessInfo (authored by aprantl).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D84480?vs=280307=280505#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84480/new/

https://reviews.llvm.org/D84480

Files:
  lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
  lldb/tools/debugserver/source/DNB.cpp
  lldb/tools/debugserver/source/MacOSX/MachProcess.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm

Index: lldb/tools/debugserver/source/MacOSX/MachProcess.mm
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -617,7 +617,28 @@
 info.major_version = vers_cmd.version >> 16;
 info.minor_version = (vers_cmd.version >> 8) & 0xffu;
 info.patch_version = vers_cmd.version & 0xffu;
-info.maybe_simulator = true;
+
+// Disambiguate legacy simulator platforms.
+#if (defined(__x86_64__) || defined(__i386__))
+// If we are running on Intel macOS, it is safe to assume this is
+// really a back-deploying simulator binary.
+switch (info.platform) {
+case PLATFORM_IOS:
+  info.platform = PLATFORM_IOSSIMULATOR;
+  break;
+case PLATFORM_TVOS:
+  info.platform = PLATFORM_TVOSSIMULATOR;
+  break;
+case PLATFORM_WATCHOS:
+  info.platform = PLATFORM_WATCHOSSIMULATOR;
+  break;
+}
+#else
+// On an Apple Silicon macOS host, there is no ambiguity. The only
+// binaries that use legacy load commands are back-deploying
+// native iOS binaries. All simulator binaries use the newer,
+// unambiguous LC_BUILD_VERSION load commands.
+#endif
   };
   switch (cmd) {
   case LC_VERSION_MIN_IPHONEOS:
@@ -778,34 +799,6 @@
 uuid_copy(inf.uuid, uuidcmd.uuid);
 }
 if (DeploymentInfo deployment_info = GetDeploymentInfo(lc, load_cmds_p)) {
-  // Simulator support. If the platform is ambiguous, use the dyld info.
-  if (deployment_info.maybe_simulator) {
-if (deployment_info.maybe_simulator) {
-#if (defined(__x86_64__) || defined(__i386__))
-  // If dyld doesn't return a platform, use a heuristic.
-  // If we are running on Intel macOS, it is safe to assume
-  // this is really a back-deploying simulator binary.
-  switch (deployment_info.platform) {
-  case PLATFORM_IOS:
-deployment_info.platform = PLATFORM_IOSSIMULATOR;
-break;
-  case PLATFORM_TVOS:
-deployment_info.platform = PLATFORM_TVOSSIMULATOR;
-break;
-  case PLATFORM_WATCHOS:
-deployment_info.platform = PLATFORM_WATCHOSSIMULATOR;
-break;
-  }
-#else
-  // On an Apple Silicon macOS host, there is no
-  // ambiguity. The only binaries that use legacy load
-  // commands are back-deploying native iOS binaries. All
-  // simulator binaries use the newer, unambiguous
-  // LC_BUILD_VERSION load commands.
-  deployment_info.maybe_simulator = false;
-#endif
-}
-  }
   const char *lc_platform = GetPlatformString(deployment_info.platform);
   // macCatalyst support.
   //
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.h
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.h
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.h
@@ -236,9 +236,6 @@
 operator bool() { return platform > 0; }
 /// The Mach-O platform type;
 unsigned char platform = 0;
-/// Pre-LC_BUILD_VERSION files don't disambiguate between ios and ios
-/// simulator.
-bool maybe_simulator = false;
 uint32_t major_version = 0;
 uint32_t minor_version = 0;
 uint32_t patch_version = 0;
Index: lldb/tools/debugserver/source/DNB.cpp
===
--- lldb/tools/debugserver/source/DNB.cpp
+++ lldb/tools/debugserver/source/DNB.cpp
@@ -1393,7 +1393,10 @@
  uint32_t& patch_version) {
   MachProcessSP procSP;
   if (GetProcessSP(pid, procSP)) {
-// FIXME: This doesn't correct for older ios simulator and macCatalyst.
+// FIXME: This doesn't return the correct result when xctest (a
+// macOS binary) is loaded with the macCatalyst dyld platform
+// override. The image info corrects for this, but qProcessInfo
+// will return what is in the binary.
 auto info = procSP->GetDeploymentInfo(lc, load_command_address);
 major_version = info.major_version;
 minor_version = info.minor_version;
Index: lldb/test/API/macosx/simulator/TestSimulatorPlatform.py

[Lldb-commits] [PATCH] D84530: [lldb] Modernize away some snprintf calls

2020-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

Nice


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84530/new/

https://reviews.llvm.org/D84530



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


Re: [Lldb-commits] [lldb] 0d5fc82 - [lldb] Eliminate unneeded value parameters in Utility (NFC)

2020-07-24 Thread Adrian Prantl via lldb-commits
Honestly, a sentence in the class Doxygen comment that this is supposed to be 
passed by value works just as well :-)

-- adrian

> On Jul 24, 2020, at 12:31 AM, Raphael “Teemperor” Isemann 
>  wrote:
> 
> We could make a custom attribute for types that should be always passed by 
> value and then maybe have Clang handle that. The problem seems generic enough 
> that maybe other people could find this useful.
> 
> - Raphael
> 
>> On 24 Jul 2020, at 09:27, Pavel Labath via lldb-commits 
>>  wrote:
>> 
>> On 23/07/2020 18:24, Adrian Prantl wrote:
>>> Is there some clever C++ way to prohibit taking an object's address 
>>> (similar to how you can delete a copy constructor)?
>>> 
>>> -- adrian
>> 
>> You could =delete the address-of operator, but redefining unary & is
>> generally frowned upon and I am not sure it will achieve what you want
>> -- it would not prevent anyone from binding a reference to an existing
>> object.
>> 
>> I don't think there's any way to prevent that, and even if it were, it
>> would likely break too much generic code which expects to accept objects
>> by const&.
>> 
>> pl
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 

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


[Lldb-commits] [PATCH] D84527: Rename StoppointLocation to StoppointSite and drop its relationship with BreakpointLocation

2020-07-24 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

This overall change makes sense to me.

It seems a little awkward that Target has to know that Watchpoints have a 
m_hit_counter.  It's also a little weird that we're clearing watchpoint hit 
counts when a process dies, but not breakpoint hit counts.  If we do one we 
should do the other...  That isn't your doing, but if you need to have Target 
resetting both the WP & BP hit counts, it might be nicer to do this with an API.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84527/new/

https://reviews.llvm.org/D84527



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


[Lldb-commits] [lldb] 0db2934 - [ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we always the ImportDeclContext one we start the definition

2020-07-24 Thread via lldb-commits

Author: shafik
Date: 2020-07-24T13:15:08-07:00
New Revision: 0db2934b0fa9e00ac98e2cb168adba96f6bcd0da

URL: 
https://github.com/llvm/llvm-project/commit/0db2934b0fa9e00ac98e2cb168adba96f6bcd0da
DIFF: 
https://github.com/llvm/llvm-project/commit/0db2934b0fa9e00ac98e2cb168adba96f6bcd0da.diff

LOG: [ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we 
always the ImportDeclContext one we start the definition

Once we start the definition of an ObjCInterfaceDecl we won't attempt to 
ImportDeclContext
later on. Unlike RecordDecl case which uses DefinitionCompleter to force 
completeDefinition
we don't seem to have a similar mechanism for ObjCInterfaceDecl.

This fix was needed due to a bug we see in LLDB expression parsing where an 
initial expression
cause an ObjCInterfaceDecl to be defined and subsequent expressions during 
import do not call
ImportDeclContext and we can end up in a situation where ivars are imported out 
of order and not all ivars are imported.

Differential Revision: https://reviews.llvm.org/D83972

Added: 


Modified: 
clang/lib/AST/ASTImporter.cpp
lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py

Removed: 




diff  --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index fcfaba625a722..e0bca8f08bb41 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -4758,11 +4758,10 @@ Error ASTNodeImporter::ImportDefinition(
   return ToImplOrErr.takeError();
   }
 
-  if (shouldForceImportDeclContext(Kind)) {
-// Import all of the members of this class.
-if (Error Err = ImportDeclContext(From, /*ForceImport=*/true))
-  return Err;
-  }
+  // Import all of the members of this class.
+  if (Error Err = ImportDeclContext(From, /*ForceImport=*/true))
+return Err;
+
   return Error::success();
 }
 

diff  --git a/lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py 
b/lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
index 6118854131024..4154bb144b350 100644
--- a/lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
+++ b/lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
@@ -14,9 +14,8 @@ def test(self):
 lldbutil.run_to_source_breakpoint(self, "// break here", 
lldb.SBFileSpec("main.m"))
 
 self.expect_expr("chb->hb->field1", result_type="unsigned int", 
result_value="0")
-
-## FIXME field2 should have a value of 1
-self.expect("expr chb->hb->field2", matching=False, substrs = ["= 1"]) 
# this must happen second
+## This should happen second
+self.expect_expr("chb->hb->field2", result_type="unsigned int", 
result_value="1")
 
 self.expect_expr("hb2->field1", result_type="unsigned int", 
result_value="10")
 self.expect_expr("hb2->field2", result_type="unsigned int", 
result_value="3")



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


[Lldb-commits] [PATCH] D83972: Modify ImportDefiniton for ObjCInterfaceDecl so that we always the ImportDeclContext one we start the definition

2020-07-24 Thread Shafik Yaghmour via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0db2934b0fa9: [ASTImporter] Modify ImportDefiniton for 
ObjCInterfaceDecl so that we always… (authored by shafik).
Herald added projects: clang, LLDB.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83972/new/

https://reviews.llvm.org/D83972

Files:
  clang/lib/AST/ASTImporter.cpp
  lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py


Index: lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
===
--- lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
+++ lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
@@ -14,9 +14,8 @@
 lldbutil.run_to_source_breakpoint(self, "// break here", 
lldb.SBFileSpec("main.m"))
 
 self.expect_expr("chb->hb->field1", result_type="unsigned int", 
result_value="0")
-
-## FIXME field2 should have a value of 1
-self.expect("expr chb->hb->field2", matching=False, substrs = ["= 1"]) 
# this must happen second
+## This should happen second
+self.expect_expr("chb->hb->field2", result_type="unsigned int", 
result_value="1")
 
 self.expect_expr("hb2->field1", result_type="unsigned int", 
result_value="10")
 self.expect_expr("hb2->field2", result_type="unsigned int", 
result_value="3")
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -4758,11 +4758,10 @@
   return ToImplOrErr.takeError();
   }
 
-  if (shouldForceImportDeclContext(Kind)) {
-// Import all of the members of this class.
-if (Error Err = ImportDeclContext(From, /*ForceImport=*/true))
-  return Err;
-  }
+  // Import all of the members of this class.
+  if (Error Err = ImportDeclContext(From, /*ForceImport=*/true))
+return Err;
+
   return Error::success();
 }
 


Index: lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
===
--- lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
+++ lldb/test/API/lang/objc/bitfield_ivars/TestBitfieldIvars.py
@@ -14,9 +14,8 @@
 lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.m"))
 
 self.expect_expr("chb->hb->field1", result_type="unsigned int", result_value="0")
-
-## FIXME field2 should have a value of 1
-self.expect("expr chb->hb->field2", matching=False, substrs = ["= 1"]) # this must happen second
+## This should happen second
+self.expect_expr("chb->hb->field2", result_type="unsigned int", result_value="1")
 
 self.expect_expr("hb2->field1", result_type="unsigned int", result_value="10")
 self.expect_expr("hb2->field2", result_type="unsigned int", result_value="3")
Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -4758,11 +4758,10 @@
   return ToImplOrErr.takeError();
   }
 
-  if (shouldForceImportDeclContext(Kind)) {
-// Import all of the members of this class.
-if (Error Err = ImportDeclContext(From, /*ForceImport=*/true))
-  return Err;
-  }
+  // Import all of the members of this class.
+  if (Error Err = ImportDeclContext(From, /*ForceImport=*/true))
+return Err;
+
   return Error::success();
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 313b607 - Revert "Add Debug Info Size to Symbol Status"

2020-07-24 Thread Walter Erquinigo via lldb-commits

Author: Walter Erquinigo
Date: 2020-07-24T13:28:29-07:00
New Revision: 313b60742af1f567ef7d8e26eb5b1015a7b5c78f

URL: 
https://github.com/llvm/llvm-project/commit/313b60742af1f567ef7d8e26eb5b1015a7b5c78f
DIFF: 
https://github.com/llvm/llvm-project/commit/313b60742af1f567ef7d8e26eb5b1015a7b5c78f.diff

LOG: Revert "Add Debug Info Size to Symbol Status"

This reverts commit 986e3af53bfe591e88a1ae4f82ea1cc0a15819a3.

It incorrectly deleted clang/tools/clang-format/git-clang-format

Added: 


Modified: 
clang/tools/clang-format/git-clang-format
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/test/API/tools/lldb-vscode/module/Makefile
lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
lldb/tools/lldb-vscode/JSONUtils.cpp

Removed: 




diff  --git a/clang/tools/clang-format/git-clang-format 
b/clang/tools/clang-format/git-clang-format
index e69de29bb2d1..f3cd585e7f4a 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -0,0 +1,585 @@
+#!/usr/bin/env python
+#
+#===- git-clang-format - ClangFormat Git Integration -*- python 
-*--===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#======#
+
+r"""
+clang-format git integration
+
+
+This file provides a clang-format integration for git. Put it somewhere in your
+path and ensure that it is executable. Then, "git clang-format" will invoke
+clang-format on the changes in current files or a specific commit.
+
+For further details, run:
+git clang-format -h
+
+Requires Python 2.7 or Python 3
+"""
+
+from __future__ import absolute_import, division, print_function
+import argparse
+import collections
+import contextlib
+import errno
+import os
+import re
+import subprocess
+import sys
+
+usage = 'git clang-format [OPTIONS] [] [] [--] [...]'
+
+desc = '''
+If zero or one commits are given, run clang-format on all lines that 
diff er
+between the working directory and , which defaults to HEAD.  Changes 
are
+only applied to the working directory.
+
+If two commits are given (requires --
diff ), run clang-format on all lines in the
+second  that 
diff er from the first .
+
+The following git-config settings set the default of the corresponding option:
+  clangFormat.binary
+  clangFormat.commit
+  clangFormat.extensions
+  clangFormat.style
+'''
+
+# Name of the temporary index file in which save the output of clang-format.
+# This file is created within the .git directory.
+temp_index_basename = 'clang-format-index'
+
+
+Range = collections.namedtuple('Range', 'start, count')
+
+
+def main():
+  config = load_git_config()
+
+  # In order to keep '--' yet allow options after positionals, we need to
+  # check for '--' ourselves.  (Setting nargs='*' throws away the '--', while
+  # nargs=argparse.REMAINDER disallows options after positionals.)
+  argv = sys.argv[1:]
+  try:
+idx = argv.index('--')
+  except ValueError:
+dash_dash = []
+  else:
+dash_dash = argv[idx:]
+argv = argv[:idx]
+
+  default_extensions = ','.join([
+  # From clang/lib/Frontend/FrontendOptions.cpp, all lower case
+  'c', 'h',  # C
+  'm',  # ObjC
+  'mm',  # ObjC++
+  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+  'cu',  # CUDA
+  # Other languages that clang-format supports
+  'proto', 'protodevel',  # Protocol Buffers
+  'java',  # Java
+  'js',  # JavaScript
+  'ts',  # TypeScript
+  'cs',  # C Sharp
+  ])
+
+  p = argparse.ArgumentParser(
+usage=usage, formatter_class=argparse.RawDescriptionHelpFormatter,
+description=desc)
+  p.add_argument('--binary',
+ default=config.get('clangformat.binary', 'clang-format'),
+ help='path to clang-format'),
+  p.add_argument('--commit',
+ default=config.get('clangformat.commit', 'HEAD'),
+ help='default commit to use if none is specified'),
+  p.add_argument('--
diff ', action='store_true',
+ help='print a 
diff  instead of applying the changes')
+  p.add_argument('--extensions',
+ default=config.get('clangformat.extensions',
+default_extensions),
+ help=('comma-separated list of file extensions to format, '
+   'excluding the period and case-insensitive')),
+  p.add_argument('-f', '--force', action='store_true',
+ help='allow changes to unstaged files')
+  p.add_argument('-p', '--patch', action='store_true',
+ help='select hunks interactively')
+  p.add_argument('-q', '--quiet', action='count', default=0,
+   

[Lldb-commits] [lldb] c86f56e - [CMake] Find zlib when building lldb as standalone

2020-07-24 Thread Petr Hosek via lldb-commits

Author: Petr Hosek
Date: 2020-07-24T13:36:13-07:00
New Revision: c86f56e32e724c6018e579bb2bc11e667c96fc96

URL: 
https://github.com/llvm/llvm-project/commit/c86f56e32e724c6018e579bb2bc11e667c96fc96
DIFF: 
https://github.com/llvm/llvm-project/commit/c86f56e32e724c6018e579bb2bc11e667c96fc96.diff

LOG: [CMake] Find zlib when building lldb as standalone

This addresses the issue introduced by 10b1b4a.

Added: 


Modified: 
lldb/cmake/modules/LLDBStandalone.cmake

Removed: 




diff  --git a/lldb/cmake/modules/LLDBStandalone.cmake 
b/lldb/cmake/modules/LLDBStandalone.cmake
index 752113bcc6c4..edd2b34ec865 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -73,6 +73,11 @@ endif()
 # We append the directory in which LLVMConfig.cmake lives. We expect LLVM's
 # CMake modules to be in that directory as well.
 list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}")
+
+if(LLVM_ENABLE_ZLIB)
+  find_package(ZLIB)
+endif()
+
 include(AddLLVM)
 include(TableGen)
 include(HandleLLVMOptions)



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


[Lldb-commits] [PATCH] D84272: Add checks for ValueObjectSP in Cocoa summary providers

2020-07-24 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.

I'm still not sure how this can happen or how this could be tested, but this 
patch seems reasonable. Also it seems we usually do nullptr checks on 
GetSyntheticChildAtOffset results, so at least it would be consistent if we do 
it here too. So LGTM.

The patch description is a bit confusing so maybe clarify that before landing 
(I'm not sure what "that looks related to we had good ValueObjectSP for some 
Cocoa summary providers" means).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84272/new/

https://reviews.llvm.org/D84272



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


[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-07-24 Thread walter erquinigo via Phabricator via lldb-commits
wallace requested changes to this revision.
wallace added a comment.
This revision now requires changes to proceed.

can you include a screenshot of how the view looked before (without the colors)?

Also explain that this is done via a mime-type identification and a built-in 
support in the IDE for syntax highlighting

Don't forget to use the new UUID I gave you


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84555/new/

https://reviews.llvm.org/D84555



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


[Lldb-commits] [PATCH] D84475: [lldb] Inform every language runtime of the modified modules

2020-07-24 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0b339c069266: [lldb] Inform every language runtime of the 
modified modules (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D84475?vs=280288=280546#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84475/new/

https://reviews.llvm.org/D84475

Files:
  lldb/source/Target/Process.cpp


Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5757,41 +5757,25 @@
 }
 
 void Process::ModulesDidLoad(ModuleList _list) {
+  // Inform the system runtime of the modified modules.
   SystemRuntime *sys_runtime = GetSystemRuntime();
-  if (sys_runtime) {
+  if (sys_runtime)
 sys_runtime->ModulesDidLoad(module_list);
-  }
 
   GetJITLoaders().ModulesDidLoad(module_list);
 
-  // Give runtimes a chance to be created.
+  // Give the instrumentation runtimes a chance to be created before informing
+  // them of the modified modules.
   InstrumentationRuntime::ModulesDidLoad(module_list, this,
  m_instrumentation_runtimes);
+  for (auto  : m_instrumentation_runtimes)
+runtime.second->ModulesDidLoad(module_list);
 
-  // Tell runtimes about new modules.
-  for (auto pos = m_instrumentation_runtimes.begin();
-   pos != m_instrumentation_runtimes.end(); ++pos) {
-InstrumentationRuntimeSP runtime = pos->second;
-runtime->ModulesDidLoad(module_list);
-  }
-
-  // Let any language runtimes we have already created know about the modules
-  // that loaded.
-
-  // Iterate over a copy of this language runtime list in case the language
-  // runtime ModulesDidLoad somehow causes the language runtime to be
-  // unloaded.
-  {
-std::lock_guard guard(m_language_runtimes_mutex);
-LanguageRuntimeCollection language_runtimes(m_language_runtimes);
-for (const auto  : language_runtimes) {
-  // We must check language_runtime_sp to make sure it is not nullptr as we
-  // might cache the fact that we didn't have a language runtime for a
-  // language.
-  LanguageRuntimeSP language_runtime_sp = pair.second;
-  if (language_runtime_sp)
-language_runtime_sp->ModulesDidLoad(module_list);
-}
+  // Give the language runtimes a chance to be created before informing them of
+  // the modified modules.
+  for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) 
{
+if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type))
+  runtime->ModulesDidLoad(module_list);
   }
 
   // If we don't have an operating system plug-in, try to load one since
@@ -5799,7 +5783,7 @@
   if (!m_os_up)
 LoadOperatingSystemPlugin(false);
 
-  // Give structured-data plugins a chance to see the modified modules.
+  // Inform the structured-data plugins of the modified modules.
   for (auto pair : m_structured_data_plugin_map) {
 if (pair.second)
   pair.second->ModulesDidLoad(*this, module_list);


Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5757,41 +5757,25 @@
 }
 
 void Process::ModulesDidLoad(ModuleList _list) {
+  // Inform the system runtime of the modified modules.
   SystemRuntime *sys_runtime = GetSystemRuntime();
-  if (sys_runtime) {
+  if (sys_runtime)
 sys_runtime->ModulesDidLoad(module_list);
-  }
 
   GetJITLoaders().ModulesDidLoad(module_list);
 
-  // Give runtimes a chance to be created.
+  // Give the instrumentation runtimes a chance to be created before informing
+  // them of the modified modules.
   InstrumentationRuntime::ModulesDidLoad(module_list, this,
  m_instrumentation_runtimes);
+  for (auto  : m_instrumentation_runtimes)
+runtime.second->ModulesDidLoad(module_list);
 
-  // Tell runtimes about new modules.
-  for (auto pos = m_instrumentation_runtimes.begin();
-   pos != m_instrumentation_runtimes.end(); ++pos) {
-InstrumentationRuntimeSP runtime = pos->second;
-runtime->ModulesDidLoad(module_list);
-  }
-
-  // Let any language runtimes we have already created know about the modules
-  // that loaded.
-
-  // Iterate over a copy of this language runtime list in case the language
-  // runtime ModulesDidLoad somehow causes the language runtime to be
-  // unloaded.
-  {
-std::lock_guard guard(m_language_runtimes_mutex);
-LanguageRuntimeCollection language_runtimes(m_language_runtimes);
-for (const auto  : language_runtimes) {
-  // We must check language_runtime_sp to make sure it is not nullptr as we
-  // might cache the fact that we didn't have a language runtime for a
-  // language.
-  LanguageRuntimeSP language_runtime_sp = pair.second;
-  if 

[Lldb-commits] [lldb] 986e3af - Add Debug Info Size to Symbol Status

2020-07-24 Thread Walter Erquinigo via lldb-commits

Author: Yifan Shen
Date: 2020-07-24T13:26:06-07:00
New Revision: 986e3af53bfe591e88a1ae4f82ea1cc0a15819a3

URL: 
https://github.com/llvm/llvm-project/commit/986e3af53bfe591e88a1ae4f82ea1cc0a15819a3
DIFF: 
https://github.com/llvm/llvm-project/commit/986e3af53bfe591e88a1ae4f82ea1cc0a15819a3.diff

LOG: Add Debug Info Size to Symbol Status

Summary: If a module has debug info, the size of debug symbol will be displayed 
after the Symbols Loaded Message for each module in the VScode modules 
view.{F12335461}

Reviewers: wallace, clayborg

Reviewed By: wallace, clayborg

Subscribers: cfe-commits, aprantl, lldb-commits

Tags: #lldb, #clang

Differential Revision: https://reviews.llvm.org/D83731

Added: 


Modified: 
clang/tools/clang-format/git-clang-format
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/test/API/tools/lldb-vscode/module/Makefile
lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
lldb/tools/lldb-vscode/JSONUtils.cpp

Removed: 




diff  --git a/clang/tools/clang-format/git-clang-format 
b/clang/tools/clang-format/git-clang-format
index f3cd585e7f4a..e69de29bb2d1 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -1,585 +0,0 @@
-#!/usr/bin/env python
-#
-#===- git-clang-format - ClangFormat Git Integration -*- python 
-*--===#
-#
-# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-# See https://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-#======#
-
-r"""
-clang-format git integration
-
-
-This file provides a clang-format integration for git. Put it somewhere in your
-path and ensure that it is executable. Then, "git clang-format" will invoke
-clang-format on the changes in current files or a specific commit.
-
-For further details, run:
-git clang-format -h
-
-Requires Python 2.7 or Python 3
-"""
-
-from __future__ import absolute_import, division, print_function
-import argparse
-import collections
-import contextlib
-import errno
-import os
-import re
-import subprocess
-import sys
-
-usage = 'git clang-format [OPTIONS] [] [] [--] [...]'
-
-desc = '''
-If zero or one commits are given, run clang-format on all lines that 
diff er
-between the working directory and , which defaults to HEAD.  Changes 
are
-only applied to the working directory.
-
-If two commits are given (requires --
diff ), run clang-format on all lines in the
-second  that 
diff er from the first .
-
-The following git-config settings set the default of the corresponding option:
-  clangFormat.binary
-  clangFormat.commit
-  clangFormat.extensions
-  clangFormat.style
-'''
-
-# Name of the temporary index file in which save the output of clang-format.
-# This file is created within the .git directory.
-temp_index_basename = 'clang-format-index'
-
-
-Range = collections.namedtuple('Range', 'start, count')
-
-
-def main():
-  config = load_git_config()
-
-  # In order to keep '--' yet allow options after positionals, we need to
-  # check for '--' ourselves.  (Setting nargs='*' throws away the '--', while
-  # nargs=argparse.REMAINDER disallows options after positionals.)
-  argv = sys.argv[1:]
-  try:
-idx = argv.index('--')
-  except ValueError:
-dash_dash = []
-  else:
-dash_dash = argv[idx:]
-argv = argv[:idx]
-
-  default_extensions = ','.join([
-  # From clang/lib/Frontend/FrontendOptions.cpp, all lower case
-  'c', 'h',  # C
-  'm',  # ObjC
-  'mm',  # ObjC++
-  'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
-  'cu',  # CUDA
-  # Other languages that clang-format supports
-  'proto', 'protodevel',  # Protocol Buffers
-  'java',  # Java
-  'js',  # JavaScript
-  'ts',  # TypeScript
-  'cs',  # C Sharp
-  ])
-
-  p = argparse.ArgumentParser(
-usage=usage, formatter_class=argparse.RawDescriptionHelpFormatter,
-description=desc)
-  p.add_argument('--binary',
- default=config.get('clangformat.binary', 'clang-format'),
- help='path to clang-format'),
-  p.add_argument('--commit',
- default=config.get('clangformat.commit', 'HEAD'),
- help='default commit to use if none is specified'),
-  p.add_argument('--
diff ', action='store_true',
- help='print a 
diff  instead of applying the changes')
-  p.add_argument('--extensions',
- default=config.get('clangformat.extensions',
-default_extensions),
- help=('comma-separated list of file extensions to format, '
-   'excluding the period and case-insensitive')),
-  p.add_argument('-f', '--force', action='store_true',
- 

[Lldb-commits] [PATCH] D83731: Add Debug Info Size to Symbol Status

2020-07-24 Thread Yifan Shen via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG986e3af53bfe: Add Debug Info Size to Symbol Status (authored 
by aelitashen, committed by Walter Erquinigo wall...@fb.com).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83731/new/

https://reviews.llvm.org/D83731

Files:
  clang/tools/clang-format/git-clang-format
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/test/API/tools/lldb-vscode/module/Makefile
  lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
  lldb/tools/lldb-vscode/JSONUtils.cpp

Index: lldb/tools/lldb-vscode/JSONUtils.cpp
===
--- lldb/tools/lldb-vscode/JSONUtils.cpp
+++ lldb/tools/lldb-vscode/JSONUtils.cpp
@@ -7,6 +7,8 @@
 //===--===//
 
 #include 
+#include 
+#include 
 
 #include "llvm/ADT/Optional.h"
 #include "llvm/Support/FormatAdapters.h"
@@ -327,6 +329,50 @@
   return llvm::json::Value(std::move(object));
 }
 
+static uint64_t GetDebugInfoSizeInSection(lldb::SBSection section) {
+  uint64_t debug_info_size = 0;
+  llvm::StringRef section_name(section.GetName());
+  if (section_name.startswith(".debug") || section_name.startswith("__debug") ||
+  section_name.startswith(".apple") || section_name.startswith("__apple"))
+debug_info_size += section.GetFileByteSize();
+  size_t num_sub_sections = section.GetNumSubSections();
+  for (size_t i = 0; i < num_sub_sections; i++) {
+debug_info_size +=
+GetDebugInfoSizeInSection(section.GetSubSectionAtIndex(i));
+  }
+  return debug_info_size;
+}
+
+static uint64_t GetDebugInfoSize(lldb::SBModule module) {
+  uint64_t debug_info_size = 0;
+  size_t num_sections = module.GetNumSections();
+  for (size_t i = 0; i < num_sections; i++) {
+debug_info_size += GetDebugInfoSizeInSection(module.GetSectionAtIndex(i));
+  }
+  return debug_info_size;
+}
+
+static std::string ConvertDebugInfoSizeToString(uint64_t debug_info) {
+  std::ostringstream oss;
+  oss << " (";
+  oss << std::fixed << std::setprecision(1);
+
+  if (debug_info < 1024) {
+oss << debug_info << "B";
+  } else if (debug_info < 1024 * 1024) {
+double kb = double(debug_info) / 1024.0;
+oss << kb << "KB";
+  } else if (debug_info < 1024 * 1024 * 1024) {
+double mb = double(debug_info) / (1024.0 * 1024.0);
+oss << mb << "MB";
+  } else {
+double gb = double(debug_info) / (1024.0 * 1024.0 * 1024.0);
+oss << gb << "GB";
+;
+  }
+  oss << ")";
+  return oss.str();
+}
 llvm::json::Value CreateModule(lldb::SBModule ) {
   llvm::json::Object object;
   if (!module.IsValid())
@@ -339,9 +385,15 @@
   std::string module_path(module_path_arr);
   object.try_emplace("path", module_path);
   if (module.GetNumCompileUnits() > 0) {
-object.try_emplace("symbolStatus", "Symbols loaded.");
+std::string symbol_str = "Symbols loaded.";
+uint64_t debug_info = GetDebugInfoSize(module);
+if (debug_info > 0) {
+  symbol_str += ConvertDebugInfoSizeToString(debug_info);
+}
+object.try_emplace("symbolStatus", symbol_str);
 char symbol_path_arr[PATH_MAX];
-module.GetSymbolFileSpec().GetPath(symbol_path_arr, sizeof(symbol_path_arr));
+module.GetSymbolFileSpec().GetPath(symbol_path_arr,
+   sizeof(symbol_path_arr));
 std::string symbol_path(symbol_path_arr);
 object.try_emplace("symbolFilePath", symbol_path);
   } else {
@@ -352,8 +404,9 @@
   object.try_emplace("addressRange", loaded_addr);
   std::string version_str;
   uint32_t version_nums[3];
-  uint32_t num_versions = module.GetVersion(version_nums, sizeof(version_nums)/sizeof(uint32_t));
-  for (uint32_t i=0; ihttps://llvm.org/LICENSE.txt for license information.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-#======#
-
-r"""
-clang-format git integration
-
-
-This file provides a clang-format integration for git. Put it somewhere in your
-path and ensure that it is executable. Then, "git clang-format" will invoke
-clang-format on the changes in current files or a specific commit.
-
-For further details, run:
-git clang-format -h
-
-Requires Python 2.7 or Python 3
-"""
-
-from __future__ import absolute_import, division, print_function
-import argparse
-import collections
-import contextlib
-import errno
-import os
-import re
-import subprocess
-import sys
-
-usage = 'git clang-format [OPTIONS] [] [] [--] [...]'
-
-desc = '''
-If zero or one commits are given, run clang-format on all lines that differ
-between the working directory and , which defaults to HEAD.  Changes are
-only applied to the working directory.
-
-If two commits are given (requires --diff), run clang-format on all lines in the
-second  that differ from the first .
-
-The 

[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-07-24 Thread Yifan Shen via Phabricator via lldb-commits
aelitashen updated this revision to Diff 280596.
aelitashen added a comment.

Use unique id for disassembly.json


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84555/new/

https://reviews.llvm.org/D84555

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/utils/vscode/llvm/package.json
  llvm/utils/vscode/llvm/syntaxes/disassembly.json


Index: llvm/utils/vscode/llvm/syntaxes/disassembly.json
===
--- /dev/null
+++ llvm/utils/vscode/llvm/syntaxes/disassembly.json
@@ -0,0 +1,31 @@
+{
+  "name": "Disassembly",
+  "scopeName": "source.disassembly",
+  "uuid": "9ade615f-5d82-4ac5-b22f-a1998c356ebe",
+  "patterns": [
+{
+  "comment": "Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "Numeric constant",
+  "name": "constant.numeric",
+  "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+},
+{
+  "comment": "Register",
+  "name": "variable.language",
+  "match": "%[A-Za-z][A-Za-z0-9]*"
+},
+{
+  "comment": "End of line comment",
+  "name": "comment.line.semicolon",
+  "match": ";.*$"
+}
+  ]
+}
Index: llvm/utils/vscode/llvm/package.json
===
--- llvm/utils/vscode/llvm/package.json
+++ llvm/utils/vscode/llvm/package.json
@@ -39,6 +39,15 @@
 ".ll"
 ],
 "configuration": "./language-configuration.json"
+},
+{
+"id": "lldb.disassembly",
+"aliases": [
+"Disassembly"
+],
+"extensions": [
+".disasm"
+]
 }
 ],
 "grammars": [
@@ -51,6 +60,11 @@
 "language": "llvm",
 "scopeName": "source.llvm",
 "path": "./syntaxes/ll.tmLanguage.json"
+},
+{
+"language": "lldb.disassembly",
+"scopeName": "source.disassembly",
+"path": "./syntaxes/disassembly.json"
 }
 ],
 "taskDefinitions": [
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -2188,6 +2188,7 @@
   } else {
 response["success"] = llvm::json::Value(false);
   }
+  EmplaceSafeString(body, "mimeType", "text/x-lldb.disassembly");
   response.try_emplace("body", std::move(body));
   g_vsc.SendJSON(llvm::json::Value(std::move(response)));
 }


Index: llvm/utils/vscode/llvm/syntaxes/disassembly.json
===
--- /dev/null
+++ llvm/utils/vscode/llvm/syntaxes/disassembly.json
@@ -0,0 +1,31 @@
+{
+  "name": "Disassembly",
+  "scopeName": "source.disassembly",
+  "uuid": "9ade615f-5d82-4ac5-b22f-a1998c356ebe",
+  "patterns": [
+{
+  "comment": "Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "Numeric constant",
+  "name": "constant.numeric",
+  "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+},
+{
+  "comment": "Register",
+  "name": "variable.language",
+  "match": "%[A-Za-z][A-Za-z0-9]*"
+},
+{
+  "comment": "End of line comment",
+  "name": "comment.line.semicolon",
+  "match": ";.*$"
+}
+  ]
+}
Index: llvm/utils/vscode/llvm/package.json
===
--- llvm/utils/vscode/llvm/package.json
+++ llvm/utils/vscode/llvm/package.json
@@ -39,6 +39,15 @@
 ".ll"
 ],
 "configuration": "./language-configuration.json"
+},
+{
+"id": "lldb.disassembly",
+"aliases": [
+"Disassembly"
+],
+"extensions": [
+".disasm"
+]
 }
 ],
 "grammars": [
@@ -51,6 +60,11 @@
 "language": "llvm",
 "scopeName": "source.llvm",
 "path": "./syntaxes/ll.tmLanguage.json"
+},
+{
+"language": "lldb.disassembly",
+"scopeName": "source.disassembly",
+"path": "./syntaxes/disassembly.json"
 }
 ],
 "taskDefinitions": [
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp

[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-07-24 Thread walter erquinigo via Phabricator via lldb-commits
wallace accepted this revision.
wallace added a comment.
This revision is now accepted and ready to land.

Very good!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84555/new/

https://reviews.llvm.org/D84555



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


[Lldb-commits] [PATCH] D84537: [lldb/AppleSimulator] Always provide a -simulator environment

2020-07-24 Thread Frederic Riss via Phabricator via lldb-commits
friss updated this revision to Diff 280604.
friss added a comment.

Simplify the logic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84537/new/

https://reviews.llvm.org/D84537

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
  lldb/unittests/Platform/CMakeLists.txt
  lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp

Index: lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
===
--- /dev/null
+++ lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp
@@ -0,0 +1,74 @@
+//===-- PlatformAppleSimulatorTest.cpp ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include "Plugins/Platform/MacOSX/PlatformAppleTVSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.h"
+#include "Plugins/Platform/MacOSX/PlatformiOSSimulator.h"
+#include "TestingSupport/SubsystemRAII.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Target/Platform.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+class PlatformAppleSimulatorTest : public ::testing::Test {
+  SubsystemRAII
+  subsystems;
+};
+
+#ifdef __APPLE__
+
+static void testSimPlatformArchHasSimEnvironment(llvm::StringRef name) {
+  Status error;
+  auto platform_sp = Platform::Create(ConstString(name), error);
+  ASSERT_TRUE(platform_sp);
+  int num_arches = 0;
+
+  while (true) {
+ArchSpec arch;
+if (!platform_sp->GetSupportedArchitectureAtIndex(num_arches, arch))
+  break;
+EXPECT_EQ(arch.GetTriple().getEnvironment(), llvm::Triple::Simulator);
+num_arches++;
+  }
+
+  EXPECT_GT(num_arches, 0);
+}
+
+TEST_F(PlatformAppleSimulatorTest, TestSimHasSimEnvionament) {
+  testSimPlatformArchHasSimEnvironment("ios-simulator");
+  testSimPlatformArchHasSimEnvironment("tvos-simulator");
+  testSimPlatformArchHasSimEnvironment("watchos-simulator");
+}
+
+TEST_F(PlatformAppleSimulatorTest, TestHostPlatformToSim) {
+  static const ArchSpec platform_arch(
+  HostInfo::GetArchitecture(HostInfo::eArchKindDefault));
+
+  const llvm::Triple::OSType sim_platforms[] = {
+  llvm::Triple::IOS,
+  llvm::Triple::TvOS,
+  llvm::Triple::WatchOS,
+  };
+
+  for (auto sim : sim_platforms) {
+ArchSpec arch = platform_arch;
+arch.GetTriple().setOS(sim);
+arch.GetTriple().setEnvironment(llvm::Triple::Simulator);
+
+Status error;
+auto platform_sp = Platform::Create(arch, nullptr, error);
+EXPECT_TRUE(platform_sp);
+  }
+}
+
+#endif
Index: lldb/unittests/Platform/CMakeLists.txt
===
--- lldb/unittests/Platform/CMakeLists.txt
+++ lldb/unittests/Platform/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(LLDBPlatformTests
+  PlatformAppleSimulatorTest.cpp
   PlatformDarwinTest.cpp
 
   LINK_LIBS
Index: lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
@@ -64,9 +64,6 @@
   FindProcesses(const lldb_private::ProcessInstanceInfoMatch _info,
 lldb_private::ProcessInstanceInfoList _infos) override;
 
-  bool GetSupportedArchitectureAtIndex(uint32_t idx,
-   lldb_private::ArchSpec ) override;
-
   void
   AddClangModuleCompilationOptions(lldb_private::Target *target,
std::vector ) override {
Index: lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
@@ -76,6 +76,7 @@
   bool create = force;
   if (!create && arch && arch->IsValid()) {
 switch (arch->GetMachine()) {
+case llvm::Triple::aarch64:
 case llvm::Triple::x86_64:
 case llvm::Triple::x86: {
   const llvm::Triple  = arch->GetTriple();
@@ -148,7 +149,25 @@
 /// Default Constructor
 PlatformiOSSimulator::PlatformiOSSimulator()
 : PlatformAppleSimulator(

[Lldb-commits] [lldb] 34d4c8a - [lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)

2020-07-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-07-24T16:28:34-07:00
New Revision: 34d4c8a53e569b1b83a0672015a19f8ca9bb3c35

URL: 
https://github.com/llvm/llvm-project/commit/34d4c8a53e569b1b83a0672015a19f8ca9bb3c35
DIFF: 
https://github.com/llvm/llvm-project/commit/34d4c8a53e569b1b83a0672015a19f8ca9bb3c35.diff

LOG: [lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)

LangaugeRuntime and SystemRuntime now both inherit from Runtime.

Added: 
lldb/include/lldb/Target/Runtime.h

Modified: 
lldb/include/lldb/Target/LanguageRuntime.h
lldb/include/lldb/Target/SystemRuntime.h
lldb/source/Target/LanguageRuntime.cpp
lldb/source/Target/SystemRuntime.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/LanguageRuntime.h 
b/lldb/include/lldb/Target/LanguageRuntime.h
index b0b9b919911a..da3cb9702392 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -18,6 +18,7 @@
 #include "lldb/Expression/LLVMUserExpression.h"
 #include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Target/ExecutionContextScope.h"
+#include "lldb/Target/Runtime.h"
 #include "lldb/lldb-private.h"
 #include "lldb/lldb-public.h"
 
@@ -56,7 +57,7 @@ class ExceptionSearchFilter : public SearchFilter {
   void UpdateModuleListIfNeeded();
 };
 
-class LanguageRuntime : public PluginInterface {
+class LanguageRuntime : public Runtime, public PluginInterface {
 public:
   ~LanguageRuntime() override;
 
@@ -127,10 +128,6 @@ class LanguageRuntime : public PluginInterface {
 return lldb::ThreadSP();
   }
 
-  Process *GetProcess() { return m_process; }
-
-  Target () { return m_process->GetTarget(); }
-
   virtual DeclVendor *GetDeclVendor() { return nullptr; }
 
   virtual lldb::BreakpointResolverSP
@@ -159,7 +156,7 @@ class LanguageRuntime : public PluginInterface {
 return llvm::None;
   }
 
-  virtual void ModulesDidLoad(const ModuleList _list) {}
+  virtual void ModulesDidLoad(const ModuleList _list) override {}
 
   // Called by ClangExpressionParser::PrepareForExecution to query for any
   // custom LLVM IR passes that need to be run before an expression is
@@ -179,10 +176,7 @@ class LanguageRuntime : public PluginInterface {
   static char ID;
 
 protected:
-  // Classes that inherit from LanguageRuntime can see and modify these
-
   LanguageRuntime(Process *process);
-  Process *m_process;
 
 private:
   LanguageRuntime(const LanguageRuntime &) = delete;

diff  --git a/lldb/include/lldb/Target/Runtime.h 
b/lldb/include/lldb/Target/Runtime.h
new file mode 100644
index ..06f0b610e40b
--- /dev/null
+++ b/lldb/include/lldb/Target/Runtime.h
@@ -0,0 +1,33 @@
+//===-- Runtime.h ---*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_TARGET_RUNTIME_H
+#define LLDB_TARGET_RUNTIME_H
+
+#include "lldb/Target/Process.h"
+
+namespace lldb_private {
+class Runtime {
+public:
+  Runtime(Process *process) : m_process(process) {}
+  virtual ~Runtime() = default;
+  Runtime(const Runtime &) = delete;
+  const Runtime =(const Runtime &) = delete;
+
+  Process *GetProcess() { return m_process; }
+  Target () { return m_process->GetTarget(); }
+
+  /// Called when modules have been loaded in the process.
+  virtual void ModulesDidLoad(const ModuleList _list) = 0;
+
+protected:
+  Process *m_process;
+};
+} // namespace lldb_private
+
+#endif // LLDB_TARGET_RUNTIME_H

diff  --git a/lldb/include/lldb/Target/SystemRuntime.h 
b/lldb/include/lldb/Target/SystemRuntime.h
index 4f07d7ab52e5..0ec0793e95f9 100644
--- a/lldb/include/lldb/Target/SystemRuntime.h
+++ b/lldb/include/lldb/Target/SystemRuntime.h
@@ -15,6 +15,7 @@
 #include "lldb/Core/PluginInterface.h"
 #include "lldb/Target/QueueItem.h"
 #include "lldb/Target/QueueList.h"
+#include "lldb/Target/Runtime.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/StructuredData.h"
 #include "lldb/lldb-private.h"
@@ -39,7 +40,7 @@ namespace lldb_private {
 /// can be asked to provide that information.
 ///
 
-class SystemRuntime : public PluginInterface {
+class SystemRuntime : public Runtime, public PluginInterface {
 public:
   /// Find a system runtime plugin for a given process.
   ///
@@ -52,7 +53,7 @@ class SystemRuntime : public PluginInterface {
   static SystemRuntime *FindPlugin(Process *process);
 
   /// Construct with a process.
-  SystemRuntime(lldb_private::Process *process);
+  SystemRuntime(Process *process);
 
   /// Destructor.
   ///
@@ -76,7 +77,7 @@ class SystemRuntime : public PluginInterface {
   ///
   /// Allow the SystemRuntime plugin to enable logging features in the system
   /// runtime 

[Lldb-commits] [lldb] 9999621 - [lldb] Don't wrap and release raw pointer in unique_ptr (NFC)

2020-07-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-07-24T16:28:34-07:00
New Revision: 6213ebd9655bb0488387f906d5438bcd37f8

URL: 
https://github.com/llvm/llvm-project/commit/6213ebd9655bb0488387f906d5438bcd37f8
DIFF: 
https://github.com/llvm/llvm-project/commit/6213ebd9655bb0488387f906d5438bcd37f8.diff

LOG: [lldb] Don't wrap and release raw pointer in unique_ptr (NFC)

Added: 


Modified: 
lldb/source/Target/LanguageRuntime.cpp

Removed: 




diff  --git a/lldb/source/Target/LanguageRuntime.cpp 
b/lldb/source/Target/LanguageRuntime.cpp
index 58ad70c2b902..f8143839bb64 100644
--- a/lldb/source/Target/LanguageRuntime.cpp
+++ b/lldb/source/Target/LanguageRuntime.cpp
@@ -202,20 +202,15 @@ class ExceptionBreakpointResolver : public 
BreakpointResolver {
 
 LanguageRuntime *LanguageRuntime::FindPlugin(Process *process,
  lldb::LanguageType language) {
-  std::unique_ptr language_runtime_up;
   LanguageRuntimeCreateInstance create_callback;
-
   for (uint32_t idx = 0;
(create_callback =
 PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) !=
nullptr;
++idx) {
-language_runtime_up.reset(create_callback(process, language));
-
-if (language_runtime_up)
-  return language_runtime_up.release();
+if (LanguageRuntime *runtime = create_callback(process, language))
+  return runtime;
   }
-
   return nullptr;
 }
 



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


[Lldb-commits] [lldb] 0b339c0 - [lldb] Inform every language runtime of the modified modules

2020-07-24 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-07-24T12:10:45-07:00
New Revision: 0b339c069266b7a4f3c82f80067d74620cbe19c4

URL: 
https://github.com/llvm/llvm-project/commit/0b339c069266b7a4f3c82f80067d74620cbe19c4
DIFF: 
https://github.com/llvm/llvm-project/commit/0b339c069266b7a4f3c82f80067d74620cbe19c4.diff

LOG: [lldb] Inform every language runtime of the modified modules

When a process is notified that modules got loaded, currently only
existing language runtimes are given a chance to deal with that. This
means that if the runtime for a given language wasn't needed before it
won't be informed of the module chance.

This is wrong because the module change might be what triggers the need
for a certain runtime. Instead, we should give the language runtime for
every supported language a chance to deal with the modified modules.

Differential revision: https://reviews.llvm.org/D84475

Added: 


Modified: 
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index b7694ec43f34..3776a90e546a 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5757,41 +5757,25 @@ addr_t Process::ResolveIndirectFunction(const Address 
*address, Status ) {
 }
 
 void Process::ModulesDidLoad(ModuleList _list) {
+  // Inform the system runtime of the modified modules.
   SystemRuntime *sys_runtime = GetSystemRuntime();
-  if (sys_runtime) {
+  if (sys_runtime)
 sys_runtime->ModulesDidLoad(module_list);
-  }
 
   GetJITLoaders().ModulesDidLoad(module_list);
 
-  // Give runtimes a chance to be created.
+  // Give the instrumentation runtimes a chance to be created before informing
+  // them of the modified modules.
   InstrumentationRuntime::ModulesDidLoad(module_list, this,
  m_instrumentation_runtimes);
+  for (auto  : m_instrumentation_runtimes)
+runtime.second->ModulesDidLoad(module_list);
 
-  // Tell runtimes about new modules.
-  for (auto pos = m_instrumentation_runtimes.begin();
-   pos != m_instrumentation_runtimes.end(); ++pos) {
-InstrumentationRuntimeSP runtime = pos->second;
-runtime->ModulesDidLoad(module_list);
-  }
-
-  // Let any language runtimes we have already created know about the modules
-  // that loaded.
-
-  // Iterate over a copy of this language runtime list in case the language
-  // runtime ModulesDidLoad somehow causes the language runtime to be
-  // unloaded.
-  {
-std::lock_guard guard(m_language_runtimes_mutex);
-LanguageRuntimeCollection language_runtimes(m_language_runtimes);
-for (const auto  : language_runtimes) {
-  // We must check language_runtime_sp to make sure it is not nullptr as we
-  // might cache the fact that we didn't have a language runtime for a
-  // language.
-  LanguageRuntimeSP language_runtime_sp = pair.second;
-  if (language_runtime_sp)
-language_runtime_sp->ModulesDidLoad(module_list);
-}
+  // Give the language runtimes a chance to be created before informing them of
+  // the modified modules.
+  for (const lldb::LanguageType lang_type : Language::GetSupportedLanguages()) 
{
+if (LanguageRuntime *runtime = GetLanguageRuntime(lang_type))
+  runtime->ModulesDidLoad(module_list);
   }
 
   // If we don't have an operating system plug-in, try to load one since
@@ -5799,7 +5783,7 @@ void Process::ModulesDidLoad(ModuleList _list) {
   if (!m_os_up)
 LoadOperatingSystemPlugin(false);
 
-  // Give structured-data plugins a chance to see the modified modules.
+  // Inform the structured-data plugins of the modified modules.
   for (auto pair : m_structured_data_plugin_map) {
 if (pair.second)
   pair.second->ModulesDidLoad(*this, module_list);



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


[Lldb-commits] [lldb] 2c1bea8 - Add Debug Info Size to Symbol Status

2020-07-24 Thread Walter Erquinigo via lldb-commits

Author: Yifan Shen
Date: 2020-07-24T13:30:04-07:00
New Revision: 2c1bea88a5f8334015455aae8b842fdd87f7e34a

URL: 
https://github.com/llvm/llvm-project/commit/2c1bea88a5f8334015455aae8b842fdd87f7e34a
DIFF: 
https://github.com/llvm/llvm-project/commit/2c1bea88a5f8334015455aae8b842fdd87f7e34a.diff

LOG: Add Debug Info Size to Symbol Status

If a module has debug info, the size of debug symbol will be displayed after 
the Symbols Loaded Message for each module in the VScode modules 
view.{F12335461}

Reviewed By: wallace, clayborg

Differential Revision: https://reviews.llvm.org/D83731

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/test/API/tools/lldb-vscode/module/Makefile
lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
lldb/tools/lldb-vscode/JSONUtils.cpp

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index c1b33c220b4b..fa5a9c0db1eb 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -53,11 +53,12 @@ def set_function_breakpoints(self, functions, 
condition=None,
 breakpoint_ids.append('%i' % (breakpoint['id']))
 return breakpoint_ids
 
-def waitUntil(self, condition):
-while True:
-if condition():
-break
+def waitUntil(self, condition_callback):
+for _ in range(20):
+if condition_callback():
+return True
 time.sleep(0.5)
+return False
 
 def verify_breakpoint_hit(self, breakpoint_ids):
 '''Wait for the process we are debugging to stop, and verify we hit

diff  --git a/lldb/test/API/tools/lldb-vscode/module/Makefile 
b/lldb/test/API/tools/lldb-vscode/module/Makefile
index 1fb944b13893..b30baf48b972 100644
--- a/lldb/test/API/tools/lldb-vscode/module/Makefile
+++ b/lldb/test/API/tools/lldb-vscode/module/Makefile
@@ -2,12 +2,16 @@ DYLIB_NAME := foo
 DYLIB_CXX_SOURCES := foo.cpp
 CXX_SOURCES := main.cpp
 
-all: a.out.stripped
+LD_EXTRAS := -Wl,-rpath "-Wl,$(shell pwd)"
+USE_LIBDL :=1
 
 include Makefile.rules
 
-a.out.stripped: a.out.dSYM
+all: a.out.stripped
+
+a.out.stripped:
strip -o a.out.stripped a.out
+
 ifneq "$(CODESIGN)" ""
$(CODESIGN) -fs - a.out.stripped
-endif
+endif
\ No newline at end of file

diff  --git a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py 
b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
index 40c4145b38e3..a16430fccae1 100644
--- a/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
+++ b/lldb/test/API/tools/lldb-vscode/module/TestVSCode_module.py
@@ -10,56 +10,93 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 import lldbvscode_testcase
+import re
 
 class TestVSCode_module(lldbvscode_testcase.VSCodeTestCaseBase):
 
 mydir = TestBase.compute_mydir(__file__)
 
-
-@skipIfWindows
-@skipUnlessDarwin
-@skipIfRemote
-def test_modules_event(self):
+def run_test(self, symbol_basename, expect_debug_info_size):
 program_basename = "a.out.stripped"
-program= self.getBuildArtifact(program_basename)
+program = self.getBuildArtifact(program_basename)
 self.build_and_launch(program)
 functions = ['foo']
 breakpoint_ids = self.set_function_breakpoints(functions)
-self.assertEquals(len(breakpoint_ids), len(functions),
-'expect one breakpoint')
+self.assertEquals(len(breakpoint_ids), len(functions), 'expect one 
breakpoint')
 self.continue_to_breakpoints(breakpoint_ids)
 active_modules = self.vscode.get_active_modules()
-self.assertIn(program_basename, active_modules, '%s module is in 
active modules' % (program_basename))
 program_module = active_modules[program_basename]
+self.assertIn(program_basename, active_modules, '%s module is in 
active modules' % (program_basename))
 self.assertIn('name', program_module, 'make sure name is in module')
 self.assertEqual(program_basename, program_module['name'])
 self.assertIn('path', program_module, 'make sure path is in module')
 self.assertEqual(program, program_module['path'])
 self.assertTrue('symbolFilePath' not in program_module, 'Make sure 
a.out.stripped has no debug info')
 self.assertEqual('Symbols not found.', program_module['symbolStatus'])
-symbol_path = self.getBuildArtifact("a.out")
-self.vscode.request_evaluate('`%s' % ('target symbols add -s "%s" 
"%s"' % (program, symbol_path)))
+symbols_path = self.getBuildArtifact(symbol_basename)
+self.vscode.request_evaluate('`%s' % 

[Lldb-commits] [PATCH] D84537: [lldb/AppleSimulator] Always provide a -simulator environment

2020-07-24 Thread Frederic Riss via Phabricator via lldb-commits
friss marked 4 inline comments as done.
friss added inline comments.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp:270
+static const ArchSpec platform_arch(
+HostInfo::GetArchitecture(HostInfo::eArchKind64));
+arch = platform_arch;

aprantl wrote:
> I guess I should really know this... does this construct create a static 
> initializer? If yes, isn't that something we generally want to avoid in LLVM?
> 
> I checked: HostInfo::GetArchitecture() caches the result anyway, so there is 
> no need to cache it again here.
static inside of a function will not create a global initializer, it will 
ensure that the variable is initialized once when the function is first 
executed. I can remove the caching though, this was cargo-culted.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h:59
+  llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;
+  llvm::ArrayRef m_supported_triples = {};
+

aprantl wrote:
> If the StringRef is supposed to be a triple, we might want to store an array 
> of llvm::Triple instead? They are basically std::strings.
I was going for constant expressions given the `StringRef` constructor is 
`constexpr`. The `Triple` constructor is not.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp:159
+  static const llvm::StringRef supported_triples[] = {
+  "x86_64-apple-tvos-simulator",
+  };

aprantl wrote:
> I'm probably missing something: Instead of declaring the static list of 
> supported triples here and then manually adding the host architecture, why 
> not create the list on-the-fly in GetSupportedArchitectureAtIndex()? Is 
> `m_supported_triples` used directly somewhere?
> 
> Something like:
> 
> ```
> switch (i) {
> #ifdef __APPLE__
> #if __arm64__
> case 0:  return  "arm64-apple-tvos-simulator";
> case 1:  return  "x86_64-apple-tvos-simulator";
> case 2: return "x86_64h-apple-tvos-simulator",
>   };
> #else
> if (is_haswell)
> switch (i) {
> case 0: return "x86_64h-apple-tvos-simulator";
> case 1: return "x86_64-apple-tvos-simulator";
> }
> else  return "x86_64-apple-tvos-simulator"
> ```
> 
> 
Again, I was going for constant expressions that can be indexed directly into, 
while this requires executing code. Spelling that argument out makes it sound 
really silly :-) Still I prefer a hardcoded list that any logic if we can get 
by with it. Maybe we just put all the variants there? If the binary cannot be 
executed, then the kernel will complain. Yeah, I think I'll do that.



Comment at: lldb/unittests/Platform/PlatformAppleSimulatorTest.cpp:72
+  }
+}
+

aprantl wrote:
> Does this explicitly test that platform[0] == HostInfo::GetArchitecture()?
No. It tests the second `::Create` method. This test would fail on Apple 
Silicon without the `case llvm::Triple::aarch64` I added in there. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84537/new/

https://reviews.llvm.org/D84537



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


[Lldb-commits] [PATCH] D84555: Add Syntax Highlighting to Disassembly View

2020-07-24 Thread Yifan Shen via Phabricator via lldb-commits
aelitashen created this revision.
aelitashen added reviewers: wallace, clayborg.
Herald added projects: LLDB, LLVM.
Herald added subscribers: llvm-commits, lldb-commits.

When lldb cannot find source file thus IDE renders a disassembly view, add 
syntax highlighting for constants, registers and final line comments for better 
debugging experience.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84555

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/utils/vscode/llvm/package.json
  llvm/utils/vscode/llvm/syntaxes/disassembly.json


Index: llvm/utils/vscode/llvm/syntaxes/disassembly.json
===
--- /dev/null
+++ llvm/utils/vscode/llvm/syntaxes/disassembly.json
@@ -0,0 +1,31 @@
+{
+  "name": "Disassembly",
+  "scopeName": "source.disassembly",
+  "uuid": "db74b3e8-fa2c-4b4e-b973-1ecc54d45ed0",
+  "patterns": [
+{
+  "comment": "Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "Numeric constant",
+  "name": "constant.numeric",
+  "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+},
+{
+  "comment": "Register",
+  "name": "variable.language",
+  "match": "%[A-Za-z][A-Za-z0-9]*"
+},
+{
+  "comment": "End of line comment",
+  "name": "comment.line.semicolon",
+  "match": ";.*$"
+}
+  ]
+}
Index: llvm/utils/vscode/llvm/package.json
===
--- llvm/utils/vscode/llvm/package.json
+++ llvm/utils/vscode/llvm/package.json
@@ -39,6 +39,15 @@
 ".ll"
 ],
 "configuration": "./language-configuration.json"
+},
+{
+"id": "lldb.disassembly",
+"aliases": [
+"Disassembly"
+],
+"extensions": [
+".disasm"
+]
 }
 ],
 "grammars": [
@@ -51,6 +60,11 @@
 "language": "llvm",
 "scopeName": "source.llvm",
 "path": "./syntaxes/ll.tmLanguage.json"
+},
+{
+"language": "lldb.disassembly",
+"scopeName": "source.disassembly",
+"path": "./syntaxes/disassembly.json"
 }
 ],
 "taskDefinitions": [
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -2188,6 +2188,7 @@
   } else {
 response["success"] = llvm::json::Value(false);
   }
+  EmplaceSafeString(body, "mimeType", "text/x-lldb.disassembly");
   response.try_emplace("body", std::move(body));
   g_vsc.SendJSON(llvm::json::Value(std::move(response)));
 }


Index: llvm/utils/vscode/llvm/syntaxes/disassembly.json
===
--- /dev/null
+++ llvm/utils/vscode/llvm/syntaxes/disassembly.json
@@ -0,0 +1,31 @@
+{
+  "name": "Disassembly",
+  "scopeName": "source.disassembly",
+  "uuid": "db74b3e8-fa2c-4b4e-b973-1ecc54d45ed0",
+  "patterns": [
+{
+  "comment": "Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "Numeric constant",
+  "name": "constant.numeric",
+  "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+},
+{
+  "comment": "Register",
+  "name": "variable.language",
+  "match": "%[A-Za-z][A-Za-z0-9]*"
+},
+{
+  "comment": "End of line comment",
+  "name": "comment.line.semicolon",
+  "match": ";.*$"
+}
+  ]
+}
Index: llvm/utils/vscode/llvm/package.json
===
--- llvm/utils/vscode/llvm/package.json
+++ llvm/utils/vscode/llvm/package.json
@@ -39,6 +39,15 @@
 ".ll"
 ],
 "configuration": "./language-configuration.json"
+},
+{
+"id": "lldb.disassembly",
+"aliases": [
+"Disassembly"
+],
+"extensions": [
+".disasm"
+]
 }
 ],
 "grammars": [
@@ -51,6 +60,11 @@
 "language": "llvm",
 "scopeName": "source.llvm",
 "path": "./syntaxes/ll.tmLanguage.json"
+},
+{
+"language": "lldb.disassembly",
+"scopeName": "source.disassembly",
+"path": 

[Lldb-commits] [PATCH] D68541: Implement 'up' and 'down' shortcuts in lldb gui

2020-07-24 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

What is the state of the patch? Does lldb support cgdb-style u/d/f/b etc now?


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68541/new/

https://reviews.llvm.org/D68541



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


[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Vedant Kumar via Phabricator via lldb-commits
vsk added a comment.

@phosek I suspect this is causing a cmake error on the lldb standalone bot, 
would you mind taking a look?

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-standalone/1858/

  CMake Error at 
/Users/buildslave/jenkins/workspace/lldb-cmake-standalone/clang-build/lib/cmake/llvm/AddLLVM.cmake:823
 (add_executable):
Target "lit-cpuid" links to target "ZLIB::ZLIB" but the target was not
found.  Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
  Call Stack (most recent call first):
cmake/modules/AddLLDB.cmake:165 (add_llvm_executable)
utils/lit-cpuid/CMakeLists.txt:1 (add_lldb_executable)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79219/new/

https://reviews.llvm.org/D79219



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


Re: [Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Vedant Kumar via lldb-commits
Thanks, that addressed the issue.

> On Jul 24, 2020, at 1:41 PM, Petr Hosek  wrote:
> 
> Thanks for the heads up, this should be addressed by 
> c86f56e32e724c6018e579bb2bc11e667c96fc96, let me know if there are other 
> issues.
> 
> On Fri, Jul 24, 2020 at 12:33 PM Vedant Kumar via Phabricator 
> mailto:revi...@reviews.llvm.org>> wrote:
> vsk added a comment.
> 
> @phosek I suspect this is causing a cmake error on the lldb standalone bot, 
> would you mind taking a look?
> 
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-standalone/1858/ 
> 
> 
>   CMake Error at 
> /Users/buildslave/jenkins/workspace/lldb-cmake-standalone/clang-build/lib/cmake/llvm/AddLLVM.cmake:823
>  (add_executable):
> Target "lit-cpuid" links to target "ZLIB::ZLIB" but the target was not
> found.  Perhaps a find_package() call is missing for an IMPORTED target, 
> or
> an ALIAS target is missing?
>   Call Stack (most recent call first):
> cmake/modules/AddLLDB.cmake:165 (add_llvm_executable)
> utils/lit-cpuid/CMakeLists.txt:1 (add_lldb_executable)
> 
> 
> Repository:
>   rG LLVM Github Monorepo
> 
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D79219/new/ 
> 
> https://reviews.llvm.org/D79219 
> 
> 
> 

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


Re: [Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Petr Hosek via lldb-commits
Thanks for the heads up, this should be addressed
by c86f56e32e724c6018e579bb2bc11e667c96fc96, let me know if there are other
issues.

On Fri, Jul 24, 2020 at 12:33 PM Vedant Kumar via Phabricator <
revi...@reviews.llvm.org> wrote:

> vsk added a comment.
>
> @phosek I suspect this is causing a cmake error on the lldb standalone
> bot, would you mind taking a look?
>
> http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-standalone/1858/
>
>   CMake Error at
> /Users/buildslave/jenkins/workspace/lldb-cmake-standalone/clang-build/lib/cmake/llvm/AddLLVM.cmake:823
> (add_executable):
> Target "lit-cpuid" links to target "ZLIB::ZLIB" but the target was not
> found.  Perhaps a find_package() call is missing for an IMPORTED
> target, or
> an ALIAS target is missing?
>   Call Stack (most recent call first):
> cmake/modules/AddLLDB.cmake:165 (add_llvm_executable)
> utils/lit-cpuid/CMakeLists.txt:1 (add_lldb_executable)
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D79219/new/
>
> https://reviews.llvm.org/D79219
>
>
>
>


smime.p7s
Description: S/MIME Cryptographic Signature
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84126: Enable -Wsuggest-override in the LLVM build

2020-07-24 Thread Logan Smith via Phabricator via lldb-commits
logan-5 added a comment.

In D84126#2171469 , @labath wrote:

> Instead of adding -Wno-suggest-override to every user it might be cleaner to 
> add the flag to the INTERFACE_COMPILE_OPTIONS property of the relevant 
> targets (gtest, gmock, and gbenchmark ?). That way, anything which links 
> against these will inherit it automatically.


Thanks, that's a good idea -- I'll look into that as a follow-up patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84126/new/

https://reviews.llvm.org/D84126



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


[Lldb-commits] [lldb] e937840 - Upstream macCatalyst support in ArchSpec and associated unit tests.

2020-07-24 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2020-07-24T18:01:41-07:00
New Revision: e937840dbdce20f2ab7ca4dcd9f04c3fd89e56e3

URL: 
https://github.com/llvm/llvm-project/commit/e937840dbdce20f2ab7ca4dcd9f04c3fd89e56e3
DIFF: 
https://github.com/llvm/llvm-project/commit/e937840dbdce20f2ab7ca4dcd9f04c3fd89e56e3.diff

LOG: Upstream macCatalyst support in ArchSpec and associated unit tests.

Added: 


Modified: 
lldb/source/Utility/ArchSpec.cpp
lldb/unittests/Utility/ArchSpecTest.cpp

Removed: 




diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index f220f4e30b29..a77ae8633070 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -846,6 +846,15 @@ bool ArchSpec::ContainsOnlyArch(const llvm::Triple 
_triple) {
 }
 
 void ArchSpec::MergeFrom(const ArchSpec ) {
+  // ios-macabi always wins over macosx.
+  if ((GetTriple().getOS() == llvm::Triple::MacOSX ||
+   GetTriple().getOS() == llvm::Triple::UnknownOS) &&
+  other.GetTriple().getOS() == llvm::Triple::IOS &&
+  other.GetTriple().getEnvironment() == llvm::Triple::MacABI) {
+(*this) = other;
+return;
+  }
+
   if (!TripleVendorWasSpecified() && other.TripleVendorWasSpecified())
 GetTriple().setVendor(other.GetTriple().getVendor());
   if (!TripleOSWasSpecified() && other.TripleOSWasSpecified())
@@ -1031,6 +1040,22 @@ bool ArchSpec::IsEqualTo(const ArchSpec , bool 
exact_match) const {
 
 const llvm::Triple::OSType lhs_triple_os = lhs_triple.getOS();
 const llvm::Triple::OSType rhs_triple_os = rhs_triple.getOS();
+const llvm::Triple::EnvironmentType lhs_triple_env =
+  lhs_triple.getEnvironment();
+const llvm::Triple::EnvironmentType rhs_triple_env =
+  rhs_triple.getEnvironment();
+
+if (!exact_match) {
+  // x86_64-apple-ios-macabi, x86_64-apple-macosx are compatible, no match.
+  if ((lhs_triple_os == llvm::Triple::IOS &&
+   lhs_triple_env == llvm::Triple::MacABI &&
+   rhs_triple_os == llvm::Triple::MacOSX) ||
+  (lhs_triple_os == llvm::Triple::MacOSX &&
+   rhs_triple_os == llvm::Triple::IOS &&
+   rhs_triple_env == llvm::Triple::MacABI))
+return true;
+}
+
 if (lhs_triple_os != rhs_triple_os) {
   const bool rhs_os_specified = rhs.TripleOSWasSpecified();
   const bool lhs_os_specified = TripleOSWasSpecified();
@@ -1045,10 +1070,13 @@ bool ArchSpec::IsEqualTo(const ArchSpec , bool 
exact_match) const {
 return false;
 }
 
-const llvm::Triple::EnvironmentType lhs_triple_env =
-lhs_triple.getEnvironment();
-const llvm::Triple::EnvironmentType rhs_triple_env =
-rhs_triple.getEnvironment();
+// x86_64-apple-ios-macabi and x86_64-apple-ios are not compatible.
+if (lhs_triple_os == llvm::Triple::IOS &&
+rhs_triple_os == llvm::Triple::IOS &&
+(lhs_triple_env == llvm::Triple::MacABI ||
+ rhs_triple_env == llvm::Triple::MacABI) &&
+lhs_triple_env != rhs_triple_env)
+  return false;
 
 return IsCompatibleEnvironment(lhs_triple_env, rhs_triple_env);
   }

diff  --git a/lldb/unittests/Utility/ArchSpecTest.cpp 
b/lldb/unittests/Utility/ArchSpecTest.cpp
index 4e8e2f3c34d7..a8f43ed7dc7c 100644
--- a/lldb/unittests/Utility/ArchSpecTest.cpp
+++ b/lldb/unittests/Utility/ArchSpecTest.cpp
@@ -328,6 +328,40 @@ TEST(ArchSpecTest, Compatibility) {
 ASSERT_TRUE(A.IsExactMatch(B));
 ASSERT_TRUE(A.IsCompatibleMatch(B));
   }
+  {
+ArchSpec A("x86_64");
+ArchSpec B("x86_64-apple-ios12.0.0-macabi");
+// FIXME: The exact match also looks unintuitive.
+ASSERT_TRUE(A.IsExactMatch(B));
+ASSERT_TRUE(A.IsCompatibleMatch(B));
+  }
+  {
+ArchSpec A("x86_64-apple-ios12.0.0");
+ArchSpec B("x86_64-apple-ios12.0.0-macabi");
+ASSERT_FALSE(A.IsExactMatch(B));
+ASSERT_FALSE(A.IsCompatibleMatch(B));
+  }
+  {
+ArchSpec A("x86_64-apple-macosx10.14.2");
+ArchSpec B("x86_64-apple-ios12.0.0-macabi");
+ASSERT_FALSE(A.IsExactMatch(B));
+ASSERT_TRUE(A.IsCompatibleMatch(B));
+  }
+  {
+ArchSpec A("x86_64-apple-macosx10.14.2");
+ArchSpec B("x86_64-apple-ios12.0.0-macabi");
+// ios-macabi wins.
+A.MergeFrom(B);
+ASSERT_TRUE(A.IsExactMatch(B));
+  }
+  {
+ArchSpec A("x86_64-apple-macosx10.14.2");
+ArchSpec B("x86_64-apple-ios12.0.0-macabi");
+ArchSpec C(B);
+// ios-macabi wins.
+B.MergeFrom(A);
+ASSERT_TRUE(B.IsExactMatch(C));
+  }
 }
 
 TEST(ArchSpecTest, OperatorBool) {



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


[Lldb-commits] [PATCH] D84401: [lldb] Add SectionList::ContainsFileAddressRange

2020-07-24 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added inline comments.



Comment at: lldb/source/Core/Section.cpp:570
+  while (file_addr < end) {
+SectionSP sect_sp = FindSectionContainingFileAddress(file_addr);
+if (!sect_sp)

I am a bit concerned about the potential large time complexity 
here.FindSectionContainingFileAddress is O(|sections|) and this loop usually 
executes once but can take a lot of iterations in a pessimistic case. See my 
comment in D84402.



Comment at: lldb/unittests/Core/SectionTest.cpp:43
+Flags:   [ SHF_ALLOC ]
+Address: 0x0031
+Size:0x000f

Might be useful leaving a comment that there is a gap.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84401/new/

https://reviews.llvm.org/D84401



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


[Lldb-commits] [PATCH] D84537: [lldb/AppleSimulator] Always provide a -simulator environment

2020-07-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

This looks much cleaner!




Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp:155
+  "x86_64-apple-tvos-simulator",
+  "x86_64h-apple-tvos-simulator",
+  };

nit: it's weird that x86_64h comes after x86_64. All the others are sorted by 
newest first.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84537/new/

https://reviews.llvm.org/D84537



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


[Lldb-commits] [PATCH] D84576: Fix debugserver's qProcessInfo reporting of maccatalyst binaries

2020-07-24 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: friss, jasonmolenda.

This patch is similar in spirit to https://reviews.llvm.org/D84480, but does 
the maccatalyst/macosx disambiguation. I also took the opportunity to factor 
out the gdb-remote packet log scanning used by several testcases into lldbutil 
functions.

rdar://problem/66059257


https://reviews.llvm.org/D84576

Files:
  lldb/packages/Python/lldbsuite/test/lldbutil.py
  lldb/test/API/macosx/macCatalyst/Makefile
  lldb/test/API/macosx/macCatalyst/TestMacCatalyst.py
  lldb/test/API/macosx/macCatalyst/main.c
  lldb/test/API/macosx/macCatalystAppMacOSFramework/Makefile
  
lldb/test/API/macosx/macCatalystAppMacOSFramework/TestMacCatalystAppWithMacOSFramework.py
  lldb/test/API/macosx/macCatalystAppMacOSFramework/foo.c
  lldb/test/API/macosx/macCatalystAppMacOSFramework/foo.h
  lldb/test/API/macosx/macCatalystAppMacOSFramework/main.c
  lldb/test/API/macosx/macabi/Makefile
  lldb/test/API/macosx/macabi/TestMacABImacOSFramework.py
  lldb/test/API/macosx/macabi/foo.c
  lldb/test/API/macosx/macabi/foo.h
  lldb/test/API/macosx/macabi/main.c
  lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
  lldb/tools/debugserver/source/DNB.cpp
  lldb/tools/debugserver/source/DNB.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.h
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/RNBRemote.cpp

Index: lldb/tools/debugserver/source/RNBRemote.cpp
===
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -6356,10 +6356,11 @@
 DNBProcessMemoryRead(pid, load_command_addr, sizeof(lc), );
 (void)bytes_read;
 
+bool is_executable = true;
 uint32_t major_version, minor_version, patch_version;
-auto *platform = DNBGetDeploymentInfo(pid, lc, load_command_addr,
-  major_version, minor_version,
-  patch_version);
+auto *platform =
+DNBGetDeploymentInfo(pid, is_executable, lc, load_command_addr,
+ major_version, minor_version, patch_version);
 if (platform) {
   os_handled = true;
   rep << "ostype:" << platform << ";";
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.mm
===
--- lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -93,6 +93,7 @@
 typedef bool (*CallOpenApplicationFunction)(NSString *bundleIDNSStr,
 NSDictionary *options,
 DNBError , pid_t *return_pid);
+
 // This function runs the BKSSystemService (or FBSSystemService) method
 // openApplication:options:clientPort:withResult,
 // messaging the app passed in bundleIDNSStr.
@@ -483,6 +484,7 @@
 #define _POSIX_SPAWN_DISABLE_ASLR 0x0100
 #endif
 
+
 MachProcess::MachProcess()
 : m_pid(0), m_cpu_type(0), m_child_stdin(-1), m_child_stdout(-1),
   m_child_stderr(-1), m_path(), m_args(), m_task(this),
@@ -603,9 +605,11 @@
 
 MachProcess::DeploymentInfo
 MachProcess::GetDeploymentInfo(const struct load_command ,
-   uint64_t load_command_address) {
+   uint64_t load_command_address,
+   bool is_executable) {
   DeploymentInfo info;
   uint32_t cmd = lc.cmd & ~LC_REQ_DYLD;
+
   // Handle the older LC_VERSION load commands, which don't
   // distinguish between simulator and real hardware.
   auto handle_version_min = [&](char platform) {
@@ -640,6 +644,7 @@
 // unambiguous LC_BUILD_VERSION load commands.
 #endif
   };
+
   switch (cmd) {
   case LC_VERSION_MIN_IPHONEOS:
 handle_version_min(PLATFORM_IOS);
@@ -667,6 +672,27 @@
   }
 #endif
   }
+
+  // The xctest binary is a pure macOS binary but is launched with
+  // DYLD_FORCE_PLATFORM=6. In that case, force the platform to
+  // macCatalyst and use the macCatalyst version of the host OS
+  // instead of the macOS deployment target.
+  if (is_executable && GetProcessPlatformViaDYLDSPI() == PLATFORM_MACCATALYST) {
+info.platform = PLATFORM_MACCATALYST;
+std::string catalyst_version = GetMacCatalystVersionString();
+const char *major = catalyst_version.c_str();
+char *minor = nullptr;
+char *patch = nullptr;
+info.major_version = std::strtoul(major, , 10);
+info.minor_version = 0;
+info.patch_version = 0;
+if (minor && *minor == '.') {
+  info.minor_version = std::strtoul(++minor, , 10);
+  if (patch && *patch == '.')
+info.patch_version = std::strtoul(++patch, nullptr, 10);
+}
+  }
+
   return info;
 }
 
@@ -798,37 +824,21 @@
   sizeof(struct uuid_command))
 uuid_copy(inf.uuid, uuidcmd.uuid);
 }
-if (DeploymentInfo 

[Lldb-commits] [PATCH] D84402: [lldb/DWARF] Add more line table validation

2020-07-24 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

For ELF, there are non-pic cases (i.e. -no-pie) and pic cases (-pie or 
-shared). I think it is sufficient just testing -pie (image base is zero). If 
filtering for -pie works, filter for -no-pie or -shared should work as well.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1044
   for (const llvm::DWARFDebugLine::Sequence  : line_table->Sequences) {
+if (!list.ContainsFileAddressRange(seq.LowPC, seq.HighPC - seq.LowPC))
+  continue;

clayborg wrote:
> labath wrote:
> > clayborg wrote:
> > > dblaikie wrote:
> > > > Could you specifically look for/propagate tombstones here, to reduce 
> > > > the risk of large functions overlapping with the valid address range, 
> > > > even when they're tombstoned to zero? (because zero+large function size 
> > > > could still end up overlapping with valid code)
> > > > 
> > > > To do that well, I guess it'd have to be implemented at a lower-layer, 
> > > > inside the line table state machine - essentially dropping all lines 
> > > > derived from a "set address" operation that specifies a tombstone.
> > > Just checking if the section lists contains an address doesn't help weed 
> > > out addresses that were tombstoned to zero since our PT_LOAD[0] will 
> > > almost always contain zero for shared libraries. It might be nice to make 
> > > a list of addresses that come from sections with read + execute 
> > > permissions and store that in SymbolFileDWARF one time at startup. Then 
> > > these searches will be faster as we are looking in less ranges, and most 
> > > likely will not contain address zero. This code will catch the -1 and -2 
> > > tombstones, but most linkers I have run into use zero and the tombstone. 
> > > 
> > > If our algorithm only checks sections with no subsections and then makes 
> > > a list of file addresses for and section ranges for those, we should have 
> > > a great list. The entire PT_LOAD[0] will usually be mapped read + 
> > > execute, so we can't just check top level sections for ELF. Mach-o also 
> > > has this issue __TEXT in mac is also mapped read + execute and usually 
> > > contains zero for shared libraries, but since the sections must come 
> > > after the mach-o header, the sections within the __TEXT segment have 
> > > correct permissions and would work, just like they would for ELF.
> > You're right -- this would not handle shared libraries with base zero.
> > 
> > I am slightly uneasy about requiring executable permissions for all line 
> > tables. While it does not seem terribly useful to have line tables for 
> > non-executable code, if someone does have a line table for it for whatever 
> > reason (maybe he wants to make it executable at runtime?) it would be a 
> > shame not to display it. Also the choice of using section rather than 
> > segment permissions feels slightly arbitrary (although I could make a case 
> > for it), as it's the segment permissions which will actually define the 
> > runtime memory permissions.
> > 
> > Since this is really about filtering out (near) zero addresses, how about 
> > we make that explicit? Find the lowest executable (section) address and 
> > reject anything below that? Additionally, I'd also reject all addresses 
> > which are completely outside of the module range, as those not going to get 
> > used for anything, and they are generating bogus line-table dumps.
> > 
> > What do you think?
> > 
> > David: The -1 tombstones are already sort of handled in llvm (and in lldb 
> > since D83957). They are "handled" in the sense that the all sequences with 
> > and end PC lower than the start PC are rejected (and line sequences 
> > starting with (unsigned)-1 will definitely wrap). This is trying to do 
> > something about the zero tombstones.
> > Since this is really about filtering out (near) zero addresses, how about 
> > we make that explicit? Find the lowest executable (section) address and 
> > reject anything below that? Additionally, I'd also reject all addresses 
> > which are completely outside of the module range, as those not going to get 
> > used for anything, and they are generating bogus line-table dumps.
> > 
> > What do you think?
> 
> That will work for me. My main goal is to get anything that should have been 
> dead stripped out from appearing in results for line lookups or function 
> lookups. The quicker we can short circuit these cases the better for 
> performance. We can also use this when we try to lookup functions and don't 
> return any matches for functions whose start address falls below this value.
> 
> 
There is a concern about ContainsFileAddressRange's performance.

FindSectionContainingFileAddress iterates all sections and can be slow when the 
number of sections is large.

>  if someone does have a line table for it for whatever reason (maybe he wants 
> to make it executable at runtime?) it would be a shame not to display it.

+1

Instead of a [lowpc,highpc) range 

[Lldb-commits] [PATCH] D84506: [tools] Add paranthesese for print in Python

2020-07-24 Thread Gaël Écorchard via Phabricator via lldb-commits
galou created this revision.
Herald added a reviewer: bollu.
Herald added subscribers: llvm-commits, openmp-commits, lldb-commits, 
Sanitizers, cfe-commits, usaxena95, kadircet, arphaman, jkorous.
Herald added projects: clang, Sanitizers, LLDB, OpenMP, LLVM.

Add paranthesese for print in Python


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84506

Files:
  
clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
  clang-tools-extra/clangd/include-mapping/gen_std.py
  compiler-rt/lib/dfsan/scripts/build-libc-list.py
  compiler-rt/test/sanitizer_common/android_commands/android_common.py
  compiler-rt/test/sanitizer_common/android_commands/android_compile.py
  compiler-rt/test/sanitizer_common/ios_commands/iossim_compile.py
  debuginfo-tests/llgdb-tests/llgdb.py
  lldb/utils/lui/lldbutil.py
  llvm/bindings/python/llvm/object.py
  openmp/runtime/tools/summarizeStats.py
  polly/utils/jscop2cloog.py
  polly/utils/pyscop/jscop2iscc.py

Index: polly/utils/pyscop/jscop2iscc.py
===
--- polly/utils/pyscop/jscop2iscc.py
+++ polly/utils/pyscop/jscop2iscc.py
@@ -1,4 +1,7 @@
 #!/usr/bin/env python
+
+from __future__ import print_function
+
 import argparse, isl, os
 import json
 
@@ -9,8 +12,8 @@
   for statement in scop['statements']:
 domain = domain.union(isl.USet(statement['domain']))
 
-  print "D :=",
-  print str(domain) + ";"
+  print('D :=', end='')
+  print(str(domain) + ';')
 
 def printAccesses(scop):
 
@@ -21,8 +24,8 @@
   if access['kind'] == 'read':
 read = read.union(isl.UMap(access['relation']))
 
-  print "R :=",
-  print str(read) + ";"
+  print('R :=', end='')
+  print(str(read) + ';')
 
   write = isl.UMap('{}')
 
@@ -31,8 +34,8 @@
   if access['kind'] == 'write':
 write = write.union(isl.UMap(access['relation']))
 
-  print "W :=",
-  print str(write) + ";"
+  print('W :=', end='')
+  print(str(write) + ';')
 
 def printSchedule(scop):
 
@@ -41,8 +44,8 @@
   for statement in scop['statements']:
 schedule = schedule.union(isl.UMap(statement['schedule']))
 
-  print "S :=",
-  print str(schedule) + ";"
+  print('S :=', end='')
+  print(str(schedule) + ';')
 
 def __main__():
   description = 'Translate JSCoP into iscc input'
@@ -58,10 +61,10 @@
   printAccesses(scop)
   printSchedule(scop)
 
-  print 'R := R * D;'
-  print 'W := W * D;'
-  print 'Dep := (last W before R under S)[0];'
-  print 'schedule D respecting Dep minimizing Dep;'
+  print('R := R * D;')
+  print('W := W * D;')
+  print('Dep := (last W before R under S)[0];')
+  print('schedule D respecting Dep minimizing Dep;')
 
 
 __main__()
Index: polly/utils/jscop2cloog.py
===
--- polly/utils/jscop2cloog.py
+++ polly/utils/jscop2cloog.py
@@ -50,7 +50,7 @@
   context = scop['context']
   domains = getDomains(scop)
   schedules = getSchedules(scop)
-  print template % (context, domains, schedules)
+  print(template % (context, domains, schedules))
 
 def __main__():
   description = 'Translate JSCoP into iscc input'
Index: openmp/runtime/tools/summarizeStats.py
===
--- openmp/runtime/tools/summarizeStats.py
+++ openmp/runtime/tools/summarizeStats.py
@@ -143,7 +143,7 @@
 res["counters"] = readCounters(f)
 return res
 except (OSError, IOError):
-print "Cannot open " + fname
+print("Cannot open " + fname)
 return None
 
 def usefulValues(l):
@@ -235,7 +235,7 @@
 compKeys[key] = data[key]
 else:
 nonCompKeys[key] = data[key]
-print "comp keys:", compKeys, "\n\n non comp keys:", nonCompKeys
+print("comp keys:", compKeys, "\n\n non comp keys:", nonCompKeys)
 return [compKeys, nonCompKeys]
 
 def drawMainPie(data, filebase, colors):
@@ -301,7 +301,7 @@
 """radar Charts finish here"""
 plt.savefig(filebase+"_"+s+"_"+chartType, bbox_inches='tight')
 elif s == 'timers':
-print "overheads in "+filebase
+print("overheads in " + filebase)
 numThreads = tmp[s]['SampleCount']['Total_OMP_parallel']
 for key in data.keys():
 if key[0:5] == 'Total':
Index: llvm/bindings/python/llvm/object.py
===
--- llvm/bindings/python/llvm/object.py
+++ llvm/bindings/python/llvm/object.py
@@ -57,22 +57,22 @@
 # This is NOT OK. You perform a lookup after the object has expired.
 symbols = list(obj.get_symbols())
 for symbol in symbols:
-print symbol.name # This raises because the object has expired.
+print(symbol.name) # This raises because the object has expired.
 
 # In this example, we mix a working and failing scenario.
 symbols = []
 for symbol in obj.get_symbols():
 

[Lldb-commits] [PATCH] D84506: [tools] Add paranthesese for print in Python

2020-07-24 Thread Gaël Écorchard via Phabricator via lldb-commits
galou added a comment.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Add parentheses for print in Python (all Python files where the print statement 
was used).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84506/new/

https://reviews.llvm.org/D84506



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


[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Petr Hosek via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG10b1b4a231a4: [CMake] Simplify CMake handling for zlib 
(authored by phosek).
Herald added subscribers: msifontes, jurahul, Kayjukh, grosul1, Joonsoo, 
stephenneuendorffer, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, 
nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini.
Herald added a project: MLIR.

Changed prior to commit:
  https://reviews.llvm.org/D79219?vs=280305=280331#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79219/new/

https://reviews.llvm.org/D79219

Files:
  clang/CMakeLists.txt
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/test/lit.common.configured.in
  lld/CMakeLists.txt
  lld/test/CMakeLists.txt
  lld/test/lit.site.cfg.py.in
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/CRC.cpp
  llvm/lib/Support/Compression.cpp
  llvm/test/CMakeLists.txt
  llvm/test/lit.site.cfg.py.in
  llvm/unittests/Support/CompressionTest.cpp
  mlir/examples/standalone/CMakeLists.txt

Index: mlir/examples/standalone/CMakeLists.txt
===
--- mlir/examples/standalone/CMakeLists.txt
+++ mlir/examples/standalone/CMakeLists.txt
@@ -28,6 +28,11 @@
 
 list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}")
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
+
+if(LLVM_ENABLE_ZLIB)
+  find_package(ZLIB)
+endif()
+
 include(TableGen)
 include(AddLLVM)
 include(AddMLIR)
Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -21,7 +21,7 @@
 
 namespace {
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 
 void TestZlibCompression(StringRef Input, int Level) {
   SmallString<32> Compressed;
Index: llvm/test/lit.site.cfg.py.in
===
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -33,7 +33,7 @@
 config.host_ldflags = '@HOST_LDFLAGS@'
 config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = @HAVE_LIBZ@
+config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.have_libxar = @HAVE_LIBXAR@
 config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
 config.enable_ffi = @LLVM_ENABLE_FFI@
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -1,12 +1,12 @@
 llvm_canonicalize_cmake_booleans(
   BUILD_SHARED_LIBS
   HAVE_LIBXAR
-  HAVE_LIBZ
   HAVE_OCAMLOPT
   HAVE_OCAML_OUNIT
   LLVM_ENABLE_DIA_SDK
   LLVM_ENABLE_FFI
   LLVM_ENABLE_THREADS
+  LLVM_ENABLE_ZLIB
   LLVM_INCLUDE_GO_TESTS
   LLVM_LIBXML2_ENABLED
   LLVM_LINK_LLVM_DYLIB
Index: llvm/lib/Support/Compression.cpp
===
--- llvm/lib/Support/Compression.cpp
+++ llvm/lib/Support/Compression.cpp
@@ -17,13 +17,13 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H
+#if LLVM_ENABLE_ZLIB
 #include 
 #endif
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 static Error createError(StringRef Err) {
   return make_error(Err, inconvertibleErrorCode());
 }
Index: llvm/lib/Support/CRC.cpp
===
--- llvm/lib/Support/CRC.cpp
+++ llvm/lib/Support/CRC.cpp
@@ -25,7 +25,7 @@
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H
+#if !LLVM_ENABLE_ZLIB
 
 static const uint32_t CRCTable[256] = {
 0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
Index: llvm/lib/Support/CMakeLists.txt
===
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -1,7 +1,7 @@
-set(system_libs)
-if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
-  set(system_libs ${system_libs} ${ZLIB_LIBRARIES})
+if(LLVM_ENABLE_ZLIB)
+  set(imported_libs ZLIB::ZLIB)
 endif()
+
 if( MSVC OR MINGW )
   # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
   # advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
@@ -194,10 +194,32 @@
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
   ${Backtrace_INCLUDE_DIRS}
-  LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES}
+  LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES}
   )
 
-set_property(TARGET LLVMSupport PROPERTY 

[Lldb-commits] [PATCH] D84506: [tools] Add paranthesese for print in Python

2020-07-24 Thread Johannes Doerfert via Phabricator via lldb-commits
jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM. Seems NFC and towards the right syntax, thx :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84506/new/

https://reviews.llvm.org/D84506



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


[Lldb-commits] [PATCH] D79219: [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Petr Hosek via Phabricator via lldb-commits
phosek updated this revision to Diff 280305.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79219/new/

https://reviews.llvm.org/D79219

Files:
  clang/CMakeLists.txt
  clang/test/CMakeLists.txt
  clang/test/lit.site.cfg.py.in
  compiler-rt/test/lit.common.configured.in
  lld/CMakeLists.txt
  lld/test/CMakeLists.txt
  lld/test/lit.site.cfg.py.in
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  llvm/cmake/config-ix.cmake
  llvm/include/llvm/Config/config.h.cmake
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/CRC.cpp
  llvm/lib/Support/Compression.cpp
  llvm/test/CMakeLists.txt
  llvm/test/lit.site.cfg.py.in
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -21,7 +21,7 @@
 
 namespace {
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 
 void TestZlibCompression(StringRef Input, int Level) {
   SmallString<32> Compressed;
Index: llvm/test/lit.site.cfg.py.in
===
--- llvm/test/lit.site.cfg.py.in
+++ llvm/test/lit.site.cfg.py.in
@@ -33,7 +33,7 @@
 config.host_ldflags = '@HOST_LDFLAGS@'
 config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = @HAVE_LIBZ@
+config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.have_libxar = @HAVE_LIBXAR@
 config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
 config.enable_ffi = @LLVM_ENABLE_FFI@
Index: llvm/test/CMakeLists.txt
===
--- llvm/test/CMakeLists.txt
+++ llvm/test/CMakeLists.txt
@@ -1,12 +1,12 @@
 llvm_canonicalize_cmake_booleans(
   BUILD_SHARED_LIBS
   HAVE_LIBXAR
-  HAVE_LIBZ
   HAVE_OCAMLOPT
   HAVE_OCAML_OUNIT
   LLVM_ENABLE_DIA_SDK
   LLVM_ENABLE_FFI
   LLVM_ENABLE_THREADS
+  LLVM_ENABLE_ZLIB
   LLVM_INCLUDE_GO_TESTS
   LLVM_LIBXML2_ENABLED
   LLVM_LINK_LLVM_DYLIB
Index: llvm/lib/Support/Compression.cpp
===
--- llvm/lib/Support/Compression.cpp
+++ llvm/lib/Support/Compression.cpp
@@ -17,13 +17,13 @@
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H
+#if LLVM_ENABLE_ZLIB
 #include 
 #endif
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
+#if LLVM_ENABLE_ZLIB
 static Error createError(StringRef Err) {
   return make_error(Err, inconvertibleErrorCode());
 }
Index: llvm/lib/Support/CRC.cpp
===
--- llvm/lib/Support/CRC.cpp
+++ llvm/lib/Support/CRC.cpp
@@ -25,7 +25,7 @@
 
 using namespace llvm;
 
-#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H
+#if !LLVM_ENABLE_ZLIB
 
 static const uint32_t CRCTable[256] = {
 0x, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
Index: llvm/lib/Support/CMakeLists.txt
===
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -1,7 +1,7 @@
-set(system_libs)
-if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
-  set(system_libs ${system_libs} ${ZLIB_LIBRARIES})
+if(LLVM_ENABLE_ZLIB)
+  set(imported_libs ZLIB::ZLIB)
 endif()
+
 if( MSVC OR MINGW )
   # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
   # advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc.
@@ -194,10 +194,32 @@
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT
   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support
   ${Backtrace_INCLUDE_DIRS}
-  LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES}
+  LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES}
   )
 
-set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
+set(llvm_system_libs ${system_libs})
+
+if(LLVM_ENABLE_ZLIB)
+  string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
+  get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type})
+  if(NOT zlib_library)
+get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
+  endif()
+  get_filename_component(zlib_library ${zlib_library} NAME)
+  if(CMAKE_STATIC_LIBRARY_PREFIX AND CMAKE_STATIC_LIBRARY_SUFFIX AND
+  zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$")
+STRING(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" zlib_library ${zlib_library})
+STRING(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library})
+  endif()
+  if(CMAKE_SHARED_LIBRARY_PREFIX AND CMAKE_SHARED_LIBRARY_SUFFIX AND
+  zlib_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$")
+STRING(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" 

[Lldb-commits] [PATCH] D84083: [lldb/ObjectFileMachO] Correctly account for resolver symbols

2020-07-24 Thread Frederic Riss via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG22c16360dd00: [lldb/ObjectFileMachO] Correctly account for 
resolver symbols (authored by friss).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84083/new/

https://reviews.llvm.org/D84083

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/test/API/macosx/indirect_symbol/Makefile


Index: lldb/test/API/macosx/indirect_symbol/Makefile
===
--- lldb/test/API/macosx/indirect_symbol/Makefile
+++ lldb/test/API/macosx/indirect_symbol/Makefile
@@ -8,7 +8,8 @@
 
 build-libindirect: indirect.c
$(MAKE) -f $(MAKEFILE_RULES) \
-   DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES
+   DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES \
+   LD_EXTRAS="-Wl,-image_base,0x2"
 
 build-libreepxoprt: reexport.c
$(MAKE) -f $(MAKEFILE_RULES) \
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1990,6 +1990,8 @@
   if (e.entry.flags & EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER) {
 e.entry.other = data.GetULEB128();
 uint64_t resolver_addr = e.entry.other;
+if (text_seg_base_addr != LLDB_INVALID_ADDRESS)
+  resolver_addr += text_seg_base_addr;
 if (is_arm)
   resolver_addr &= THUMB_ADDRESS_BIT_MASK;
 resolver_addresses.insert(resolver_addr);


Index: lldb/test/API/macosx/indirect_symbol/Makefile
===
--- lldb/test/API/macosx/indirect_symbol/Makefile
+++ lldb/test/API/macosx/indirect_symbol/Makefile
@@ -8,7 +8,8 @@
 
 build-libindirect: indirect.c
 	$(MAKE) -f $(MAKEFILE_RULES) \
-		DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES
+		DYLIB_C_SOURCES=indirect.c DYLIB_NAME=indirect DYLIB_ONLY=YES \
+		LD_EXTRAS="-Wl,-image_base,0x2"
 
 build-libreepxoprt: reexport.c
 	$(MAKE) -f $(MAKEFILE_RULES) \
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1990,6 +1990,8 @@
   if (e.entry.flags & EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER) {
 e.entry.other = data.GetULEB128();
 uint64_t resolver_addr = e.entry.other;
+if (text_seg_base_addr != LLDB_INVALID_ADDRESS)
+  resolver_addr += text_seg_base_addr;
 if (is_arm)
   resolver_addr &= THUMB_ADDRESS_BIT_MASK;
 resolver_addresses.insert(resolver_addr);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84126: Enable -Wsuggest-override in the LLVM build

2020-07-24 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Instead of adding -Wno-suggest-override to every user it might be cleaner to 
add the flag to the INTERFACE_COMPILE_OPTIONS property of the relevant targets 
(gtest, gmock, and gbenchmark ?). That way, anything which links against these 
will inherit it automatically.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84126/new/

https://reviews.llvm.org/D84126



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


[Lldb-commits] [lldb] 10b1b4a - [CMake] Simplify CMake handling for zlib

2020-07-24 Thread Petr Hosek via lldb-commits

Author: Petr Hosek
Date: 2020-07-23T23:05:36-07:00
New Revision: 10b1b4a231a485f1711d576e6131f6755e008abe

URL: 
https://github.com/llvm/llvm-project/commit/10b1b4a231a485f1711d576e6131f6755e008abe
DIFF: 
https://github.com/llvm/llvm-project/commit/10b1b4a231a485f1711d576e6131f6755e008abe.diff

LOG: [CMake] Simplify CMake handling for zlib

Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

Differential Revision: https://reviews.llvm.org/D79219

Added: 


Modified: 
clang/CMakeLists.txt
clang/test/CMakeLists.txt
clang/test/lit.site.cfg.py.in
compiler-rt/test/lit.common.configured.in
lld/CMakeLists.txt
lld/test/CMakeLists.txt
lld/test/lit.site.cfg.py.in
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
llvm/cmake/config-ix.cmake
llvm/include/llvm/Config/config.h.cmake
llvm/lib/Support/CMakeLists.txt
llvm/lib/Support/CRC.cpp
llvm/lib/Support/Compression.cpp
llvm/test/CMakeLists.txt
llvm/test/lit.site.cfg.py.in
llvm/unittests/Support/CompressionTest.cpp
mlir/examples/standalone/CMakeLists.txt

Removed: 




diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 1a6a20a271f3..1c4c22b1aaad 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -114,6 +114,10 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
   option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
 
+  if(LLVM_ENABLE_ZLIB)
+find_package(ZLIB)
+  endif()
+
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)

diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 38bbc5be90d5..334a90498d0d 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -9,15 +9,6 @@ endif ()
 
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR 
${LLVM_RUNTIME_OUTPUT_INTDIR})
 
-if(CLANG_BUILT_STANDALONE)
-  # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This
-  # value is forced to 0 if zlib was not found, so it is fine to use it
-  # instead of HAVE_LIBZ (not recorded).
-  if(LLVM_ENABLE_ZLIB)
-set(HAVE_LIBZ 1)
-  endif()
-endif()
-
 llvm_canonicalize_cmake_booleans(
   CLANG_BUILD_EXAMPLES
   CLANG_ENABLE_ARCMT
@@ -25,7 +16,7 @@ llvm_canonicalize_cmake_booleans(
   CLANG_SPAWN_CC1
   ENABLE_BACKTRACES
   ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
-  HAVE_LIBZ
+  LLVM_ENABLE_ZLIB
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
   LLVM_ENABLE_PLUGINS
   LLVM_ENABLE_THREADS)

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index d9b5b2f2592e..286ea06d798c 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -16,7 +16,7 @@ config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.host_cxx = "@CMAKE_CXX_COMPILER@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = @HAVE_LIBZ@
+config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.clang_arcmt = @CLANG_ENABLE_ARCMT@
 config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
 config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@

diff  --git a/compiler-rt/test/lit.common.configured.in 
b/compiler-rt/test/lit.common.configured.in
index 1f746c067b84..000bf9b98470 100644
--- a/compiler-rt/test/lit.common.configured.in
+++ b/compiler-rt/test/lit.common.configured.in
@@ -57,7 +57,7 @@ elif config.android:
 else:
   set_default("target_suffix", "-%s" % config.target_arch)
 
-set_default("have_zlib", "@HAVE_LIBZ@")
+set_default("have_zlib", "@LLVM_ENABLE_ZLIB@")
 set_default("libcxx_used", "@LLVM_LIBCXX_USED@")
 
 # LLVM tools dir can be passed in lit parameters, so try to

diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index e9bd1bd29c5c..bcfc2c6270b3 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -51,6 +51,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} 
NO_DEFAULT_PATH)
 
+  if(LLVM_ENABLE_ZLIB)
+find_package(ZLIB)
+  endif()
+
   include(AddLLVM)
   include(TableGen)
   include(HandleLLVMOptions)

diff  --git a/lld/test/CMakeLists.txt b/lld/test/CMakeLists.txt
index 7831bb1a8de0..753eacf4d255 100644
--- a/lld/test/CMakeLists.txt
+++ 

Re: [Lldb-commits] [lldb] 0d5fc82 - [lldb] Eliminate unneeded value parameters in Utility (NFC)

2020-07-24 Thread Raphael “Teemperor” Isemann via lldb-commits
We could make a custom attribute for types that should be always passed by 
value and then maybe have Clang handle that. The problem seems generic enough 
that maybe other people could find this useful.

- Raphael

> On 24 Jul 2020, at 09:27, Pavel Labath via lldb-commits 
>  wrote:
> 
> On 23/07/2020 18:24, Adrian Prantl wrote:
>> Is there some clever C++ way to prohibit taking an object's address (similar 
>> to how you can delete a copy constructor)?
>> 
>> -- adrian
> 
> You could =delete the address-of operator, but redefining unary & is
> generally frowned upon and I am not sure it will achieve what you want
> -- it would not prevent anyone from binding a reference to an existing
> object.
> 
> I don't think there's any way to prevent that, and even if it were, it
> would likely break too much generic code which expects to accept objects
> by const&.
> 
> pl
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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


Re: [Lldb-commits] [lldb] 0d5fc82 - [lldb] Eliminate unneeded value parameters in Utility (NFC)

2020-07-24 Thread Pavel Labath via lldb-commits
On 23/07/2020 18:24, Adrian Prantl wrote:
> Is there some clever C++ way to prohibit taking an object's address (similar 
> to how you can delete a copy constructor)?
> 
> -- adrian

You could =delete the address-of operator, but redefining unary & is
generally frowned upon and I am not sure it will achieve what you want
-- it would not prevent anyone from binding a reference to an existing
object.

I don't think there's any way to prevent that, and even if it were, it
would likely break too much generic code which expects to accept objects
by const&.

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


[Lldb-commits] [PATCH] D83972: Modify ImportDefiniton for ObjCInterfaceDecl so that we always the ImportDeclContext one we start the definition

2020-07-24 Thread Gabor Marton via Phabricator via lldb-commits
martong accepted this revision.
martong added a comment.
This revision is now accepted and ready to land.

> Unlike RecordDecl case which uses DefinitionCompleter to force 
> completeDefinition we don't seem to have a similar mechanism for 
> ObjCInterfaceDecl.

It is unfortunate that the AST does not have something similar for ObjC 
interfaces. 
So, this seems to be the right way unless we want to modify DeclObjC.h.
LGTM!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83972/new/

https://reviews.llvm.org/D83972



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