[Lldb-commits] [lldb] f8d42c5 - [lldb] Fix thread syncrhonization TestThreadBacktraceRepeat

2022-02-15 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-02-15T08:58:39+01:00
New Revision: f8d42c55ec6e9c8778533d0b45bfa39753d0e63d

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

LOG: [lldb] Fix thread syncrhonization TestThreadBacktraceRepeat

lldb reports (and lldbutil.continue_to_breakpoint returns) a stop reason
even for suspended threads. Fix the test to expect that.

This was making the test flaky, as most of the time, the two threads
stop simultaneously, and the synchronization code is not executed.

Added: 


Modified: 
lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py

Removed: 




diff  --git 
a/lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py 
b/lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py
index 998ade04985ab..da5ea215bc236 100644
--- a/lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py
+++ b/lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py
@@ -119,10 +119,9 @@ def test_thread_backtrace_two_threads(self):
 if len(breakpoint_threads) == 1:
 success = thread.Suspend()
 self.assertTrue(success, "Couldn't suspend a thread")
-bkpt_threads = lldbutil.continue_to_breakpoint(self.process,
+breakpoint_threads = lldbutil.continue_to_breakpoint(self.process,
bkpt)
-self.assertEqual(len(bkpt_threads), 1, "Second thread stopped")
-breakpoint_threads.append(bkpt_threads[0])
+self.assertEqual(len(breakpoint_threads), 2, "Second thread 
stopped")
 
 # Figure out which thread is which:
 thread_id_1 = breakpoint_threads[0].idx



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


[Lldb-commits] [PATCH] D119046: Add a repeat command option for "thread backtrace --count N".

2022-02-15 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I've fixed the synchronization code in f8d42c55ec6e9 
. Based on 
my experiments, lldb reports still reports a stop reason for suspended threads 
(regardless of the platform), so the code should expect 
`continue_to_breakpoint` to return two threads when it is synchronizing them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119046

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


[Lldb-commits] [lldb] 290e482 - Cleanup LLVMDWARFDebugInfo

2022-02-15 Thread via lldb-commits

Author: serge-sans-paille
Date: 2022-02-15T09:16:03+01:00
New Revision: 290e482342826ee4c65bd6d2aece25736d3f0c7b

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

LOG: Cleanup LLVMDWARFDebugInfo

As usual with that header cleanup series, some implicit dependencies now need to
be explicit:

llvm/DebugInfo/DWARF/DWARFContext.h no longer includes:
- "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
- "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
- "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
- "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
- "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
- "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
- "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
- "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
- "llvm/DebugInfo/DWARF/DWARFSection.h"
- "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
- "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"

Plus llvm/Support/Errc.h not included by a bunch of 
llvm/DebugInfo/DWARF/DWARF*.h files

Preprocessed lines to build llvm on my setup:
after: 1065629059
before: 1066621848

Which is a great diff!

Discourse thread: 
https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D119723

Added: 


Modified: 
bolt/lib/Core/BinaryContext.cpp
bolt/lib/Core/BinaryEmitter.cpp
bolt/lib/Core/DebugData.cpp
bolt/lib/Core/Exceptions.cpp
bolt/lib/Profile/DataAggregator.cpp
bolt/lib/Profile/DataReader.cpp
bolt/lib/Rewrite/DWARFRewriter.cpp
bolt/lib/Rewrite/MachORewriteInstance.cpp
bolt/lib/Rewrite/RewriteInstance.cpp
bolt/tools/driver/llvm-bolt.cpp
bolt/tools/heatmap/heatmap.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Symbol/UnwindPlan.cpp
lldb/unittests/Symbol/PostfixExpressionTest.cpp
lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
llvm/include/llvm/DWARFLinker/DWARFLinker.h
llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
llvm/lib/ProfileData/InstrProfCorrelator.cpp
llvm/tools/llvm-dwarfdump/Statistics.cpp
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
llvm/tools/llvm-objdump/SourcePrinter.cpp
llvm/tools/obj2yaml/dwarf2yaml.cpp
llvm/tools/obj2yaml/elf2yaml.cpp
llvm/tools/obj2yaml/macho2yaml.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
llvm/unittests/De

[Lldb-commits] [PATCH] D119797: Fix race condition when launching and attaching.

2022-02-15 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Instead of polling, would it be possible for the event handler thread to send a 
notification (through a condition variable, std::future, etc.), and have the 
main thread wait for that?

But in general, avoiding flipping the modes back and forth seems like a good 
idea.




Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:797
+// We manually send a thread stopped event here since the standard launch
+// or attach API calls will eat the stopped event. But "launchCommands"
 SendThreadStoppedEvent();

is something missing here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119797

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


[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-15 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D119548#3321397 , @ilya-nozhkin 
wrote:

> In D119548#3321357 , @jingham wrote:
>
>> SBTarget.Launch calls Target::Launch.  That sets up a hijacker for the "stop 
>> at the first instruction" event regardless of the Sync mode.
>
> The problem that it sets up this hijacker too late.

Yes, so maybe the fix is to set the hijacker early (?)

That is what happens in the linux case -- hijacking is set up in 
PlatformPOSIX::DebugProcess, before the process is launched. If windows does 
not do that, then that would explain the bug and the differences between the 
platforms.


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

https://reviews.llvm.org/D119548

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


[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-15 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: JDevlieghere, jingham, clayborg, wallace.
Herald added a subscriber: mgorny.
labath requested review of this revision.
Herald added a project: LLDB.

This patch adds introduces a new kind of an lldbinit file. Unlike the
lldbinit in the home directory (useful for customizing lldb to the needs
of a particular user), or the cwd lldbinit file (useful for
project-specific settings), this file can be used to customize an entire
lldb installation to a particular environment.

The feature is enabled at build time, by setting the
LLDB_SYSTEM_INIT_PATH variable to a path to the lldbinit file. Lldb will
then load the file at startup, if it exists, and if automatic init
loading has not been disabled. Relative paths will be resolved (at
runtime) relative to the location of the lldb library (liblldb or
LLDB.framework).

The system-wide lldbinit file will be loaded first, before any
$HOME/.lldbinit and $CWD/.lldbinit files are processed, so that those
can override any system-wide settings.

More information can be found on the RFC thread at
https://discourse.llvm.org/t/rfc-system-wide-lldbinit/59933.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119831

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/include/lldb/Host/Config.h.cmake
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/source/API/SBDebugger.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/tools/driver/Driver.cpp

Index: lldb/tools/driver/Driver.cpp
===
--- lldb/tools/driver/Driver.cpp
+++ lldb/tools/driver/Driver.cpp
@@ -452,9 +452,14 @@
 
   SBCommandInterpreter sb_interpreter = m_debugger.GetCommandInterpreter();
 
-  // Before we handle any options from the command line, we parse the
-  // REPL init file or the default file in the user's home directory.
+  // Process lldbinit files before handling any options from the command line.
   SBCommandReturnObject result;
+  sb_interpreter.SourceSystemInitFile(result);
+  if (m_option_data.m_debug_mode) {
+result.PutError(m_debugger.GetErrorFile());
+result.PutOutput(m_debugger.GetOutputFile());
+  }
+
   sb_interpreter.SourceInitFileInHomeDirectory(result, m_option_data.m_repl);
   if (m_option_data.m_debug_mode) {
 result.PutError(m_debugger.GetErrorFile());
Index: lldb/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/source/Interpreter/CommandInterpreter.cpp
+++ lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2380,6 +2380,21 @@
   SourceInitFile(FileSpec(init_file.str()), result);
 }
 
+void CommandInterpreter::SourceSystemInitFile(CommandReturnObject &result) {
+  if (!m_skip_lldbinit_files) {
+#ifdef LLDB_SYSTEM_INIT_PATH
+FileSpec init_file(LLDB_SYSTEM_INIT_PATH);
+if (init_file) {
+  init_file.MakeAbsolute(HostInfo::GetShlibDir());
+}
+
+SourceInitFile(init_file, result);
+return;
+#endif
+  }
+  result.SetStatus(eReturnStatusSuccessFinishNoResult);
+}
+
 const char *CommandInterpreter::GetCommandPrefix() {
   const char *prefix = GetDebugger().GetIOHandlerCommandPrefix();
   return prefix == nullptr ? "" : prefix;
Index: lldb/source/API/SBDebugger.cpp
===
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -236,6 +236,7 @@
 interp.get()->SkipLLDBInitFiles(false);
 interp.get()->SkipAppInitFiles(false);
 SBCommandReturnObject result;
+interp.SourceSystemInitFile(result);
 interp.SourceInitFileInHomeDirectory(result, false);
   } else {
 interp.get()->SkipLLDBInitFiles(true);
Index: lldb/source/API/SBCommandInterpreter.cpp
===
--- lldb/source/API/SBCommandInterpreter.cpp
+++ lldb/source/API/SBCommandInterpreter.cpp
@@ -417,6 +417,20 @@
   m_opaque_ptr = interpreter;
 }
 
+void SBCommandInterpreter::SourceSystemInitFile(SBCommandReturnObject &result) {
+  LLDB_INSTRUMENT_VA(this, result);
+  result.Clear();
+  if (IsValid()) {
+TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
+std::unique_lock lock;
+if (target_sp)
+  lock = std::unique_lock(target_sp->GetAPIMutex());
+m_opaque_ptr->SourceSystemInitFile(result.ref());
+  } else {
+result->AppendError("SBCommandInterpreter is not valid");
+  }
+}
+
 void SBCommandInterpreter::SourceInitFileInHomeDirectory(
 SBCommandReturnObject &result) {
   LLDB_INSTRUMENT_VA(this, result);
Index: lldb/include/lldb/Interpreter/CommandInterpreter.h
===
--- lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -253,6 +253,7 @@
 
   void SourceInitFileCwd(CommandReturnObject &result);
  

[Lldb-commits] [PATCH] D119723: Cleanup LLVMDWARFDebugInfo

2022-02-15 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay accepted this revision.
MaskRay added subscribers: hubert.reinterpretcast, Kai.
MaskRay added a comment.
This revision is now accepted and ready to land.

> Plus llvm/Support/Errc.h not included by a bunch of 
> llvm/DebugInfo/DWARF/DWARF*.h files

You may check whether we can just get rid of `llvm/include/llvm/Support/Errc.h` 
in favor of ``.
It (https://reviews.llvm.org/rG2a826e40fa51fcae4adb564d789cafe95776e0bb 
2014-06) could be related to ancient MSVC workaround which may not be relevant 
today (we now require Visual Studio 2019 or later).

CC @Kai @hubert.reinterpretcast for z/OS / AIX.




Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:40
 using namespace object;
+namespace llvm {
+class DWARFDebugInfoEntry;

There is usually a blank line between `using namespace` and `namespace llvm`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119723

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


[Lldb-commits] [PATCH] D119723: Cleanup LLVMDWARFDebugInfo

2022-02-15 Thread serge via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG290e48234282: Cleanup LLVMDWARFDebugInfo (authored by 
serge-sans-paille).

Changed prior to commit:
  https://reviews.llvm.org/D119723?vs=408418&id=408734#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119723

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryEmitter.cpp
  bolt/lib/Core/DebugData.cpp
  bolt/lib/Core/Exceptions.cpp
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Profile/DataReader.cpp
  bolt/lib/Rewrite/DWARFRewriter.cpp
  bolt/lib/Rewrite/MachORewriteInstance.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/tools/driver/llvm-bolt.cpp
  bolt/tools/heatmap/heatmap.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/source/Symbol/UnwindPlan.cpp
  lldb/unittests/Symbol/PostfixExpressionTest.cpp
  lldb/unittests/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpressionTests.cpp
  llvm/include/llvm/DWARFLinker/DWARFLinker.h
  llvm/include/llvm/DWARFLinker/DWARFLinkerCompileUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFCompileUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
  llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
  llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
  llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp
  llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
  llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
  llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
  llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp
  llvm/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
  llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
  llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
  llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
  llvm/lib/ProfileData/InstrProfCorrelator.cpp
  llvm/tools/llvm-dwarfdump/Statistics.cpp
  llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
  llvm/tools/llvm-objdump/SourcePrinter.cpp
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/tools/obj2yaml/elf2yaml.cpp
  llvm/tools/obj2yaml/macho2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugFrameTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieManualExtractTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
@@ -10,6 +10,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/LEB128.h"
Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -7,6 +7,7 @@
 //===

[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

This is in line with the existing ways of sourcing init files in LLDB and has 
all the things we discussed in the RFC. I left few nits but this all looks good 
to me. I'll hold off on accepting so it continues to show up in the other 
reviewer's queue.




Comment at: lldb/include/lldb/Interpreter/CommandInterpreter.h:256
   void SourceInitFileHome(CommandReturnObject &result, bool is_repl);
+  void SourceSystemInitFile(CommandReturnObject &result);
 

`SourceInitFileSystem` for consistency with the other two? Or maybe you were 
planning to change the other two in another patch?



Comment at: lldb/source/API/SBCommandInterpreter.cpp:420-422
+void SBCommandInterpreter::SourceSystemInitFile(SBCommandReturnObject &result) 
{
+  LLDB_INSTRUMENT_VA(this, result);
+  result.Clear();

Nit: all the other functions //should// have a newline because that's what 
`lldb-instr` generates.



Comment at: lldb/source/Interpreter/CommandInterpreter.cpp:2385-2393
+#ifdef LLDB_SYSTEM_INIT_PATH
+FileSpec init_file(LLDB_SYSTEM_INIT_PATH);
+if (init_file) {
+  init_file.MakeAbsolute(HostInfo::GetShlibDir());
+}
+
+SourceInitFile(init_file, result);

Why not put the ifdef around the `m_skip_lldbinit_files` check?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

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


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, kastiglione, mib.
JDevlieghere requested review of this revision.

I was looking at `Stream::PutRawBytes` and thought I spotted a bug because both 
looks are using `i < src_len` as the loop condition despite them iterating "in 
different directions". On closer inspection, the existing code is correct, 
because it relies on well-defined unsigned integer wrapping of `size_t`. 
Correct doesn't mean readable, so this patch changes the loop condition to 
compare against 0 when decrementing `i` while still covering the edge case of 
`src_len` potentially being `0` itself.


https://reviews.llvm.org/D119857

Files:
  lldb/source/Utility/Stream.cpp


Index: lldb/source/Utility/Stream.cpp
===
--- lldb/source/Utility/Stream.cpp
+++ lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);


Index: lldb/source/Utility/Stream.cpp
===
--- lldb/source/Utility/Stream.cpp
+++ lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/source/Utility/Stream.cpp:360
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)

Intentional newline for consistency with `Stream::PutRawBytes` above.


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

https://reviews.llvm.org/D119857

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


[Lldb-commits] [lldb] 6459fdf - [lldb] Fix uninitialized variable in EvaluateExpressionOptions

2022-02-15 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-02-15T09:40:09-08:00
New Revision: 6459fdf9a8e9e8c2e06eaa42a6eda6079665c596

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

LOG: [lldb] Fix uninitialized variable in EvaluateExpressionOptions

Initialize m_pound_line_line to 0.

Added: 


Modified: 
lldb/include/lldb/Target/Target.h

Removed: 




diff  --git a/lldb/include/lldb/Target/Target.h 
b/lldb/include/lldb/Target/Target.h
index 42a641f6d52ab..54c1fb5840c9d 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -445,7 +445,7 @@ class EvaluateExpressionOptions {
   // #line %u "%s" before the expression content to remap where the source
   // originates
   mutable std::string m_pound_line_file;
-  mutable uint32_t m_pound_line_line;
+  mutable uint32_t m_pound_line_line = 0;
 };
 
 // Target



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


[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-15 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D119548#3321936 , @labath wrote:

> In D119548#3321397 , @ilya-nozhkin 
> wrote:
>
>> In D119548#3321357 , @jingham 
>> wrote:
>>
>>> SBTarget.Launch calls Target::Launch.  That sets up a hijacker for the 
>>> "stop at the first instruction" event regardless of the Sync mode.
>>
>> The problem that it sets up this hijacker too late.
>
> Yes, so maybe the fix is to set the hijacker early (?)
>
> That is what happens in the linux case -- hijacking is set up in 
> PlatformPOSIX::DebugProcess, before the process is launched. If windows does 
> not do that, then that would explain the bug and the differences between the 
> platforms.

Ah, I see.  I was focusing on the second event, not the original stop one.

The current code is relying on getting the ProcessSP & calling 
HijackProcessEvents on it, but as you say, that's too late.  Instead, we should 
put a Listener in the ProcessLaunchInfo before we do any of the CreateProcess 
stuff.  All the calls to actually make the process in Target::Launch take a 
ProcessLaunchInfo, and should obey its listener.  So that seems the right way 
to ensure that the process events get captured for this initial stop before 
they get a chance to leak out.


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

https://reviews.llvm.org/D119548

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


[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-15 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

LGTM.  I agree with Jonas about keeping the naming consistent.  I find it 
easier to spot the differentiating bits in a series of function names if they 
are at the beginning or the end, but that's a very mild preference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

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


[Lldb-commits] [PATCH] D90876: [lldb] [test] Improve comment on expr-after-step-after-crash tests

2022-02-15 Thread Ed Maste via Phabricator via lldb-commits
emaste added a comment.

ping


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

https://reviews.llvm.org/D90876

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


[Lldb-commits] [PATCH] D119797: Fix race condition when launching and attaching.

2022-02-15 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added inline comments.



Comment at: lldb/tools/lldb-vscode/VSCode.cpp:545
+  }
+  const useconds_t usleep_interval = 250 * 1; // 250 ms internal
+  const useconds_t count = (seconds * 1000 * 1000)/usleep_interval;

Is this a typo? It should be 1000 instead of 1, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119797

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


[Lldb-commits] [PATCH] D119797: Fix race condition when launching and attaching.

2022-02-15 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

I agree with labath. Specially because I wouldn't like the user having aborted 
debug sessions if their setup takes longer than 10 seconds to get the process 
ready, which I imagine might happen with android or oculus devices using custom 
launch configs. What about using a condition variable and at the same time 
issue a progress notification mentioning that the LLDB is waiting for the 
process to stop? They could stop LLDB manually if something is not working 
properly for them in that case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119797

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


[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-15 Thread walter erquinigo via Phabricator via lldb-commits
wallace added inline comments.



Comment at: lldb/include/lldb/Interpreter/CommandInterpreter.h:256
   void SourceInitFileHome(CommandReturnObject &result, bool is_repl);
+  void SourceSystemInitFile(CommandReturnObject &result);
 

JDevlieghere wrote:
> `SourceInitFileSystem` for consistency with the other two? Or maybe you were 
> planning to change the other two in another patch?
calling it SourceInitFileSystem is a bit confusing. What about using Global 
instead of System to avoid naming issues?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

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


[Lldb-commits] [lldb] b7e7a98 - [lldb] Check max_size before resizing DataBufferHeap

2022-02-15 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-02-15T13:58:35-08:00
New Revision: b7e7a982e93db82ebd7fc08bb9614468f8c0e1e5

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

LOG: [lldb] Check max_size before resizing DataBufferHeap

Don't resize DataBufferHeap if the newly requested size exceeds the
capacity of the underlying data structure, i.e. std::vector.
This matches the existing check in the DataBufferHeap constructor.

Added: 


Modified: 
lldb/include/lldb/Utility/DataBufferHeap.h
lldb/source/Utility/DataBufferHeap.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/DataBufferHeap.h 
b/lldb/include/lldb/Utility/DataBufferHeap.h
index ace526bf0a47e..f50cec2479d10 100644
--- a/lldb/include/lldb/Utility/DataBufferHeap.h
+++ b/lldb/include/lldb/Utility/DataBufferHeap.h
@@ -80,8 +80,8 @@ class DataBufferHeap : public DataBuffer {
   /// to resize itself to.
   ///
   /// \return
-  /// The size in bytes after that this heap buffer was
-  /// successfully resized to.
+  /// The size in bytes after this heap buffer was resized. If
+  /// the resize failed the size will remain unchanged.
   lldb::offset_t SetByteSize(lldb::offset_t byte_size);
 
   /// Makes a copy of the \a src_len bytes in \a src.

diff  --git a/lldb/source/Utility/DataBufferHeap.cpp 
b/lldb/source/Utility/DataBufferHeap.cpp
index 3aa0b6b0ac408..9154b3f041a75 100644
--- a/lldb/source/Utility/DataBufferHeap.cpp
+++ b/lldb/source/Utility/DataBufferHeap.cpp
@@ -47,7 +47,8 @@ uint64_t DataBufferHeap::GetByteSize() const { return 
m_data.size(); }
 // Sets the number of bytes that this object should be able to contain. This
 // can be used prior to copying data into the buffer.
 uint64_t DataBufferHeap::SetByteSize(uint64_t new_size) {
-  m_data.resize(new_size);
+  if (new_size < m_data.max_size())
+m_data.resize(new_size);
   return m_data.size();
 }
 



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


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-15 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib accepted this revision.
mib added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D119857

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


[Lldb-commits] [PATCH] D119831: [lldb] Add support for a "system-wide" lldbinit file

2022-02-15 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

This looks good to me. Just a few things to possibly think about:

- Maybe we would want addition system init files for different workflows and 
then we would start lldb with a new option like "lldb --workflow qemu" and it 
would load the system ".lldbinit-qemu" init file. That way we could have many 
supported workflows from one distribution. Here at Facebook we would have at 
least 3 that I know of: "fb-ios", "fb-android" and "fb-server". We would still 
have a system ".lldbinit" for global settings of course.
- We were currently doing stuff like this in python where it would auto import 
some of our facebook specific python modules when the debugger starts up, would 
that be useful as well? It wouldn't really be needed here because we could just 
"command script import" in the init files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119831

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


[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

2022-02-15 Thread Ilya Nozhkin via Phabricator via lldb-commits
ilya-nozhkin updated this revision to Diff 409091.
ilya-nozhkin edited the summary of this revision.
ilya-nozhkin added a comment.
Herald added a subscriber: mgrang.

Implemented the approach suggested by @labath. I.e. now the target's hijacking 
listener is activated before `Process::Launch`.

There are actually two ways of implementing that. The first of them (which is 
used in this diff) is to make the target activate the hijacking listener right 
after the process creation. The second one is to specify the hijacking listener 
in the launch info and then pass it to the platform, but it requires to modify 
all platforms to force them to activate the hijacking listener passed via 
launch info (currently, no platform actually does that). I've chosen the first 
way because it seems to be reliable and safe. I.e. the target won't depend on 
platforms, so, it'll be harder to break event dispatching again by some 
non-related modifications of platform's code.

I've also decided not to remove platform-specific hijacking listeners yet 
because some platforms define a hijacking listener even in asynchronous mode 
and then use it for waiting for the process to stop (for example, 
PlatformQemuUser does that). I'll try to test tomorrow whether it is possible 
to remove hijacking listeners at least from some subset of platforms.


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

https://reviews.llvm.org/D119548

Files:
  lldb/include/lldb/Target/Target.h
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/source/Target/Process.cpp
  lldb/source/Target/Target.cpp
  lldb/test/API/tools/lldb-vscode/stop-hooks/Makefile
  lldb/test/API/tools/lldb-vscode/stop-hooks/TestVSCode_stop_hooks.py
  lldb/test/API/tools/lldb-vscode/stop-hooks/main.c
  vscode-race-fix-3.patch

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


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-15 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added a comment.

Do we have a test that covers this edge case?


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

https://reviews.llvm.org/D119857

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


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 409135.
JDevlieghere added a comment.

- Add unit test for edge case


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

https://reviews.llvm.org/D119857

Files:
  lldb/source/Utility/Stream.cpp
  lldb/unittests/Utility/StreamTest.cpp


Index: lldb/unittests/Utility/StreamTest.cpp
===
--- lldb/unittests/Utility/StreamTest.cpp
+++ lldb/unittests/Utility/StreamTest.cpp
@@ -504,6 +504,30 @@
 #endif
 }
 
+TEST_F(StreamTest, PutRawBytesZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
+TEST_F(StreamTest, PutBytesAsRawHex8ZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
 // ULEB128 support for binary streams.
 
 TEST_F(BinaryStreamTest, PutULEB128OneByte) {
Index: lldb/source/Utility/Stream.cpp
===
--- lldb/source/Utility/Stream.cpp
+++ lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);


Index: lldb/unittests/Utility/StreamTest.cpp
===
--- lldb/unittests/Utility/StreamTest.cpp
+++ lldb/unittests/Utility/StreamTest.cpp
@@ -504,6 +504,30 @@
 #endif
 }
 
+TEST_F(StreamTest, PutRawBytesZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
+TEST_F(StreamTest, PutBytesAsRawHex8ZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
 // ULEB128 support for binary streams.
 
 TEST_F(BinaryStreamTest, PutULEB128OneByte) {
Index: lldb/source/Utility/Stream.cpp
===
--- lldb/source/Utility/Stream.cpp
+++ lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 9201463 - [lldb] Don't rely on wrapping in PutRawBytes/PutBytesAsRawHex8

2022-02-15 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-02-15T20:38:25-08:00
New Revision: 920146316da1e55017d46cfd62be783419da03d5

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

LOG: [lldb] Don't rely on wrapping in PutRawBytes/PutBytesAsRawHex8

I was looking at Stream::PutRawBytes and thought I spotted a bug because
both loops are using `i < src_len` as the loop condition despite them
iterating in opposite directions.

On closer inspection, the existing code is correct, because it relies on
well-defined unsigned integer wrapping. Correct doesn't mean readable,
so this patch changes the loop condition to compare against 0 when
decrementing i while still covering the edge case of src_len potentially
being 0 itself.

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

Added: 


Modified: 
lldb/source/Utility/Stream.cpp
lldb/unittests/Utility/StreamTest.cpp

Removed: 




diff  --git a/lldb/source/Utility/Stream.cpp b/lldb/source/Utility/Stream.cpp
index a1e2de9da4d98..b0f085418023f 100644
--- a/lldb/source/Utility/Stream.cpp
+++ b/lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@ size_t Stream::PutRawBytes(const void *s, size_t src_len,
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@ size_t Stream::PutBytesAsRawHex8(const void *s, size_t 
src_len,
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@ size_t Stream::PutBytesAsRawHex8(const void *s, size_t 
src_len,
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);

diff  --git a/lldb/unittests/Utility/StreamTest.cpp 
b/lldb/unittests/Utility/StreamTest.cpp
index 940d49fdfdb7d..959097dc52f98 100644
--- a/lldb/unittests/Utility/StreamTest.cpp
+++ b/lldb/unittests/Utility/StreamTest.cpp
@@ -504,6 +504,30 @@ TEST_F(StreamTest, PutRawBytesToMixedEndian) {
 #endif
 }
 
+TEST_F(StreamTest, PutRawBytesZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
+TEST_F(StreamTest, PutBytesAsRawHex8ZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
 // ULEB128 support for binary streams.
 
 TEST_F(BinaryStreamTest, PutULEB128OneByte) {



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


[Lldb-commits] [PATCH] D119857: [lldb] Don't rely on unsigned integer wrapping in PutRawBytes and PutBytesAsRawHex8

2022-02-15 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG920146316da1: [lldb] Don't rely on wrapping in 
PutRawBytes/PutBytesAsRawHex8 (authored by JDevlieghere).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119857

Files:
  lldb/source/Utility/Stream.cpp
  lldb/unittests/Utility/StreamTest.cpp


Index: lldb/unittests/Utility/StreamTest.cpp
===
--- lldb/unittests/Utility/StreamTest.cpp
+++ lldb/unittests/Utility/StreamTest.cpp
@@ -504,6 +504,30 @@
 #endif
 }
 
+TEST_F(StreamTest, PutRawBytesZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
+TEST_F(StreamTest, PutBytesAsRawHex8ZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
 // ULEB128 support for binary streams.
 
 TEST_F(BinaryStreamTest, PutULEB128OneByte) {
Index: lldb/source/Utility/Stream.cpp
===
--- lldb/source/Utility/Stream.cpp
+++ lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);


Index: lldb/unittests/Utility/StreamTest.cpp
===
--- lldb/unittests/Utility/StreamTest.cpp
+++ lldb/unittests/Utility/StreamTest.cpp
@@ -504,6 +504,30 @@
 #endif
 }
 
+TEST_F(StreamTest, PutRawBytesZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutRawBytes(static_cast(&value), 0, hostByteOrder,
+lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
+TEST_F(StreamTest, PutBytesAsRawHex8ZeroLenght) {
+  uint32_t value = 0x12345678;
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderLittle);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+
+  s.PutBytesAsRawHex8(static_cast(&value), 0, hostByteOrder,
+  lldb::eByteOrderBig);
+  EXPECT_EQ(0U, s.GetWrittenBytes());
+}
+
 // ULEB128 support for binary streams.
 
 TEST_F(BinaryStreamTest, PutULEB128OneByte) {
Index: lldb/source/Utility/Stream.cpp
===
--- lldb/source/Utility/Stream.cpp
+++ lldb/source/Utility/Stream.cpp
@@ -344,8 +344,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (!binary_was_set)
 m_flags.Clear(eBinary);
@@ -357,6 +357,7 @@
  ByteOrder src_byte_order,
  ByteOrder dst_byte_order) {
   ByteDelta delta(*this);
+
   if (src_byte_order == eByteOrderInvalid)
 src_byte_order = m_byte_order;
 
@@ -370,8 +371,8 @@
 for (size_t i = 0; i < src_len; ++i)
   _PutHex8(src[i], false);
   } else {
-for (size_t i = src_len - 1; i < src_len; --i)
-  _PutHex8(src[i], false);
+for (size_t i = src_len; i > 0; --i)
+  _PutHex8(src[i - 1], false);
   }
   if (binary_is_set)
 m_flags.Set(eBinary);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D119178: Add support for generating debug-info for structured bindings of structs and arrays

2022-02-15 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 409056.
shafik marked 5 inline comments as done.
shafik added a comment.

Addressed comments on SmallVector size and fixed test.


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

https://reviews.llvm.org/D119178

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDebugInfo.h
  clang/test/CodeGenCXX/debug-info-structured-binding.cpp
  lldb/test/API/lang/cpp/structured-binding/Makefile
  lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
  lldb/test/API/lang/cpp/structured-binding/main.cpp

Index: lldb/test/API/lang/cpp/structured-binding/main.cpp
===
--- /dev/null
+++ lldb/test/API/lang/cpp/structured-binding/main.cpp
@@ -0,0 +1,69 @@
+// Structured binding in C++ can bind identifiers to subobjects of an object.
+//
+// There are three cases we need to test:
+// 1) arrays
+// 2) tuples like objects
+// 3) non-static data members
+//
+// They can also bind by copy, reference or rvalue reference.
+
+#include 
+
+struct A {
+  int x;
+  int y;
+};
+
+// We want to cover a mix of types and also different sizes to make sure we
+// hande the offsets correctly.
+struct MixedTypesAndSizesStruct {
+  A a;
+  char b1;
+  char b2;
+  short b3;
+  int b4;
+  char b5;
+};
+
+int main() {
+  MixedTypesAndSizesStruct b{{20, 30}, 'a', 'b', 50, 60, 'c'};
+
+  auto [a1, b1, c1, d1, e1, f1] = b;
+  auto &[a2, b2, c2, d2, e2, f2] = b;
+  auto &&[a3, b3, c3, d3, e3, f3] =
+  MixedTypesAndSizesStruct{{20, 30}, 'a', 'b', 50, 60, 'c'};
+
+  // Array with different sized types
+  char carr[]{'a', 'b', 'c'};
+  short sarr[]{11, 12, 13};
+  int iarr[]{22, 33, 44};
+
+  auto [carr_copy1, carr_copy2, carr_copy3] = carr;
+  auto [sarr_copy1, sarr_copy2, sarr_copy3] = sarr;
+  auto [iarr_copy1, iarr_copy2, iarr_copy3] = iarr;
+
+  auto &[carr_ref1, carr_ref2, carr_ref3] = carr;
+  auto &[sarr_ref1, sarr_ref2, sarr_ref3] = sarr;
+  auto &[iarr_ref1, iarr_ref2, iarr_ref3] = iarr;
+
+  auto &&[carr_rref1, carr_rref2, carr_rref3] = carr;
+  auto &&[sarr_rref1, sarr_rref2, sarr_rref3] = sarr;
+  auto &&[iarr_rref1, iarr_rref2, iarr_rref3] = iarr;
+
+  float x{4.0};
+  char y{'z'};
+  int z{10};
+
+  std::tuple tpl(x, y, z);
+  auto [tx1, ty1, tz1] = tpl;
+  auto &[tx2, ty2, tz2] = tpl;
+
+  return a1.x + b1 + c1 + d1 + e1 + f1 + a2.y + b2 + c2 + d2 + e2 + f2 + a3.x +
+ b3 + c3 + d3 + e3 + f3 + carr_copy1 + carr_copy2 + carr_copy3 +
+ sarr_copy1 + sarr_copy2 + sarr_copy3 + iarr_copy1 + iarr_copy2 +
+ iarr_copy3 + carr_ref1 + carr_ref2 + carr_ref3 + sarr_ref1 +
+ sarr_ref2 + sarr_ref3 + iarr_ref1 + iarr_ref2 + iarr_ref3 +
+ carr_rref1 + carr_rref2 + carr_rref3 + sarr_rref1 + sarr_rref2 +
+ sarr_rref3 + iarr_rref1 + iarr_rref2 + iarr_rref3 + tx1 + ty1 + tz1 +
+ tx2 + ty2 + tz2; // break here
+}
Index: lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
===
--- /dev/null
+++ lldb/test/API/lang/cpp/structured-binding/TestStructuredBinding.py
@@ -0,0 +1,84 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestStructuredBinding(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+def test(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
+
+self.expect_expr("a1", result_type="A",
+result_children=[ValueCheck(name="x", type="int"),
+ ValueCheck(name="y", type="int")])
+self.expect_expr("b1", result_type="char", result_value="'a'")
+self.expect_expr("c1", result_type="char", result_value="'b'")
+self.expect_expr("d1", result_type="short", result_value="50")
+self.expect_expr("e1", result_type="int", result_value="60")
+self.expect_expr("f1", result_type="char", result_value="'c'")
+
+self.expect_expr("a2", result_type="A",
+result_children=[ValueCheck(name="x", type="int"),
+ ValueCheck(name="y", type="int")])
+self.expect_expr("b2", result_type="char", result_value="'a'")
+self.expect_expr("c2", result_type="char", result_value="'b'")
+self.expect_expr("d2", result_type="short", result_value="50")
+self.expect_expr("e2", result_type="int", result_value="60")
+self.expect_expr("f2", result_type="char", result_value="'c'")
+
+self.expect_expr("a3", result_type="A",
+result_children=[ValueCheck(name="x", type="int"),
+ ValueCheck(name="y", type="int")])
+self.expect_expr("b3", result_type="char", result_value="'a'")
+self.expect_expr("c3", result_type="char", result_value="'b'")
+self.expe

[Lldb-commits] [PATCH] D119178: Add support for generating debug-info for structured bindings of structs and arrays

2022-02-15 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4647
+const bool UsePointerValue) {
+  assert(CGM.getCodeGenOpts().hasReducedDebugInfo());
+  assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");

aprantl wrote:
> do you need a 
> ```
>  if (DebugKind > codegenoptions::LimitedDebugInfo)
>   return
> ```
> 
> here?
That kind of check is only used in limited places, why would it apply here as 
let's say opposed to the `EmitDeclare` for `VarDecl` case?



Comment at: clang/test/CodeGenCXX/debug-info-structured-binding.cpp:3
+
+// CHECK: call void @llvm.dbg.declare(metadata %struct.A* %[[F:[0-9]+]], 
metadata ![[F:[0-9]+]], metadata !DIExpression())
+// CHECK: call void @llvm.dbg.declare(metadata %struct.A* %[[F:[0-9]+]], 
metadata ![[F:[0-9]+]], metadata !DIExpression(DW_OP_plus_uconst, [[F:[0-9]+]]))

aprantl wrote:
> We should check what F is, too, right?
Actually I should have used a different match, that was a mistake.


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

https://reviews.llvm.org/D119178

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


[Lldb-commits] [PATCH] D119915: Replace use of double underscore in identifiers

2022-02-15 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik created this revision.
shafik added reviewers: labath, aprantl.
shafik requested review of this revision.

Identifiers with `__` anywhere are reserved. I picked this up via the 
`bugprone-reserved-identifier` clang-tidy check but `-Wreserved-identifier` 
will also flag these uses as well.


https://reviews.llvm.org/D119915

Files:
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
  lldb/source/Plugins/Language/ObjC/CF.cpp
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp
  lldb/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/source/Plugins/Language/ObjC/NSError.cpp
  lldb/source/Plugins/Language/ObjC/NSException.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -3011,8 +3011,8 @@
   if (m_CFBoolean_values)
 return true;
 
-  static ConstString g___kCFBooleanFalse("__kCFBooleanFalse");
-  static ConstString g___kCFBooleanTrue("__kCFBooleanTrue");
+  static ConstString g_double_underscore_kCFBooleanFalse("__kCFBooleanFalse");
+  static ConstString g_double_underscore_kCFBooleanTrue("__kCFBooleanTrue");
   static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
   static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
 
@@ -3045,8 +3045,8 @@
 return addr;
   };
 
-  lldb::addr_t false_addr = get_symbol(g___kCFBooleanFalse, g_kCFBooleanFalse);
-  lldb::addr_t true_addr = get_symbol(g___kCFBooleanTrue, g_kCFBooleanTrue);
+  lldb::addr_t false_addr = get_symbol(g_double_underscore_kCFBooleanFalse, g_kCFBooleanFalse);
+  lldb::addr_t true_addr = get_symbol(g_double_underscore_kCFBooleanTrue, g_kCFBooleanTrue);
 
   return (m_CFBoolean_values = {false_addr, true_addr}).operator bool();
 }
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h
@@ -32,7 +32,7 @@
 Symbol callable_symbol;
 Address callable_address;
 LineEntry callable_line_entry;
-lldb::addr_t member__f_pointer_value = 0u;
+lldb::addr_t member_double_underscore_f_pointer_value = 0u;
 LibCppStdFunctionCallableCase callable_case =
 LibCppStdFunctionCallableCase::Invalid;
   };
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -63,7 +63,7 @@
 CPPLanguageRuntime::LibCppStdFunctionCallableInfo
 line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol,
   llvm::StringRef first_template_param_sref,
-  bool has___invoke) {
+  bool has_double_underscore_invoke) {
 
   CPPLanguageRuntime::LibCppStdFunctionCallableInfo optional_info;
 
@@ -78,7 +78,7 @@
 LineEntry line_entry;
 addr.CalculateSymbolContextLineEntry(line_entry);
 
-if (contains_lambda_identifier(first_template_param_sref) || has___invoke) {
+if (contains_lambda_identifier(first_template_param_sref) || has_double_underscore_invoke) {
   // Case 1 and 2
   optional_info.callable_case = lldb_private::CPPLanguageRuntime::
   LibCppStdFunctionCallableCase::Lambda;
@@ -138,25 +138,25 @@
   //we will obtain the name from this pointer.
   // 5) a free function. A pointer to the function will stored after the vtable
   //we will obtain the name from this pointer.
-  ValueObjectSP member__f_(
+  ValueObjectSP member_double_underscore_f_(
   valobj_sp->GetChildMemberWithName(ConstString("__f_"), true));
 
-  if (member__f_) {
-ValueObjectSP sub_member__f_(
-   member__f_->GetChildMemberWithName(ConstString("__f_"), true));
+  if (member_double_underscore_f_) {
+ValueObjectSP sub_member_double_underscore_f_(
+   member_double_underscore_f_->GetChildMemberWithName(ConstString("__f_"), true));
 
-if (sub_member__f_)
-member__f_ = sub_member__f_;
+if (sub_member_double_underscore_f_)
+member_double_underscore_f_ = sub_member_double_underscore_f_;
   }
 
-  if (!member__f_)
+  if (!member_double_underscore_f_)
 return optional_info;
 
-  lldb::addr_t member__f_pointer_value = member__f_->GetValueAsUnsigned(0);
+  lldb::addr_t member_