[all-commits] [llvm/llvm-project] 6b26e1: [lldb/crashlog] Refactor CrashLogParser into a Fac...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Thu Jan 12 19:21:20 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b26e1dad9608ec188446dcdc0734a7b41cf145b
      https://github.com/llvm/llvm-project/commit/6b26e1dad9608ec188446dcdc0734a7b41cf145b
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M lldb/examples/python/crashlog.py
    M lldb/examples/python/scripted_process/crashlog_scripted_process.py

  Log Message:
  -----------
  [lldb/crashlog] Refactor CrashLogParser into a Factory pattern

This patch should fix an undefined behaviour that's happening when
parsing a crash report from an IDE. In the previous implementation, the
CrashLogParser base class would use the `__new__` static class method to
create the right parser instance depending on the crash report type.

For some reasons, the derived parser initializer wouldn't be called when
running the command from an IDE, so this patch refactors the
CrashLogParser code to replace the use of the `__new__` method with a
factory `create` static method.

rdar://100527640

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: 44b81f621c41ce21b1a1352d9bd7b7e7a8b0179e
      https://github.com/llvm/llvm-project/commit/44b81f621c41ce21b1a1352d9bd7b7e7a8b0179e
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M lldb/include/lldb/Target/Process.h
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    M lldb/source/Plugins/Process/scripted/ScriptedProcess.h

  Log Message:
  -----------
  [lldb/Process] Populate queues in Scripted Process

This patch enhances queue support in Scripted Processes.

Scripted Threads could already report their queue name if they had one,
but this information was only surfaced when getting the process and
thread status.

However, no queue was create and added to the scripted process queue
list. This patch improves that by creating a queue from the scripted
thread queue name. For now, it uses an invalid queue id, since the
scripted thread doesn't expose this capability yet, but this could
easily be supported if the queue id information is available.

rdar://98844004

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: c3b471c0be4f6b5a22afe10f95ff75bf1744d66e
      https://github.com/llvm/llvm-project/commit/c3b471c0be4f6b5a22afe10f95ff75bf1744d66e
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M lldb/examples/python/crashlog.py

  Log Message:
  -----------
  [lldb] Force override when adding crashlog command

When using interactive crashlog from an IDE, it can happen that the user
already have the `command script import lldb.macosx.crashlog` command on
their `lldbinit` file.

That leads to showing some message:

```
error: cannot add command: user command exists and force replace not set
error: cannot add command: user command exists and force replace not set
```

This leads to confusion because the crashlog symbolication continues and
succeeds even after these errors.

To address that, the crashlog commands get overridden everytime the
script get re-imported.

rdar://103403943

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: e3930e77fc5b626a3c6b95f08ed25a3f8807c579
      https://github.com/llvm/llvm-project/commit/e3930e77fc5b626a3c6b95f08ed25a3f8807c579
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M lldb/examples/darwin/heap_find/heap.py
    M lldb/examples/python/bsd.py
    M lldb/examples/python/cmdtemplate.py
    M lldb/examples/python/delta.py
    M lldb/examples/python/diagnose_nsstring.py
    M lldb/examples/python/diagnose_unwind.py
    M lldb/examples/python/disassembly_mode.py
    M lldb/examples/python/gdb_disassemble.py
    M lldb/examples/python/gdbremote.py
    M lldb/examples/python/jump.py
    M lldb/examples/python/lldb_module_utils.py
    M lldb/examples/python/memory.py
    M lldb/examples/python/sources.py
    M lldb/examples/python/stacks.py
    M lldb/examples/python/step_and_print.py
    M lldb/examples/python/types.py

  Log Message:
  -----------
  [lldb] Update custom commands to always be overrriden

This is a follow-up patch to 6f7835f309b9.

As explained previously, when running from an IDE, it can happen that
the IDE imports some lldb scripts by itself. If the user also tries to
import these commands, lldb will show the following message:

```
error: cannot add command: user command exists and force replace not set
```

This message is confusing to the user, because it suggests that the
command import failed and that the execution should stop. However, in
this case, lldb will continue the execution with the command added
previously by the user.

To prevent that, this patch updates every first-party lldb-packaged
custom commands to override commands that were pre-imported in lldb.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


  Commit: 8f549c5329275293ced1d5eb87a1cf8b3d52a794
      https://github.com/llvm/llvm-project/commit/8f549c5329275293ced1d5eb87a1cf8b3d52a794
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M lldb/test/API/functionalities/scripted_process/Makefile
    M lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py
    R lldb/test/API/functionalities/scripted_process/baz.c
    A lldb/test/API/functionalities/scripted_process/baz.cpp
    M lldb/test/API/functionalities/scripted_process/baz.h
    M lldb/test/API/functionalities/scripted_process/main.cpp

  Log Message:
  -----------
  [lldb/test] Fix data racing issue in TestStackCoreScriptedProcess

This patch should fix an nondeterministic error in TestStackCoreScriptedProcess.

In order to test both the multithreading capability and shared library
loading in Scripted Processes, the test would create multiple threads
that would take the same variable as a reference.

The first thread would alter the value and the second thread would
monitor the value until it gets altered. This assumed a certain ordering
regarding the `std::thread` spawning, however the ordering was not
always guaranteed at runtime.

To fix that, the test now makes use of a `std::condition_variable`
shared between the each thread. On the former, it will notify the other
thread when the variable gets initialized or updated and on the latter,
it will wait until the variable it receives a new notification.

This should fix the data racing issue while preserving the testing
coverage.

rdar://98678134

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

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>


Compare: https://github.com/llvm/llvm-project/compare/afb613e9e7b7...8f549c532927


More information about the All-commits mailing list