<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<pre wrap="" class="moz-quote-pre">Hi, Maxim!
Thanks for the patch!
Please consider my comments below.
</pre>
<p></p>
<div class="moz-cite-prefix">On 04.04.2024 01:21, Maxim Kokryashkin
via Tarantool-patches wrote:</div>
<div class="moz-cite-prefix">
<pre wrap="" class="moz-quote-pre"><snipped></pre>
</div>
<blockquote type="cite"
cite="mid:13501abba00ac3e072284d36a531c721e279722f.1712182830.git.m.kokryashkin@tarantool.org">
<pre wrap="" class="moz-quote-pre">+class Debugger(object):
+ def __init__(self):
+ self.GDB = False
+ self.LLDB = False
+
+ debuggers = {
+ 'gdb': lambda lib: True,
+ 'lldb': lambda lib: lib.debugger is not None,
+ }
+ for name, healthcheck in debuggers.items():
+ lib = None
+ try:
+ lib = import_module(name)
+ if healthcheck(lib):
+ setattr(self, name.upper(), True)
+ globals()[name] = lib
+ self.name = name
+ except Exception:
+ continue
+
+ assert self.LLDB != self.GDB</pre>
</blockquote>
<p>I'd suggest to use two separate implementations of Debugger
interface for GDB and LLDB, so you would not need all these
checking <span style="white-space: pre-wrap">(like `if self.LLDB`</span>)
in every single method of all-in-one implementation.<br>
</p>
<p>With this approach it seems any initial setup that is specific to
certain debugger (like setup of event_connect/event_disconnect
handlers for GDB) could be done as a part of corresponding
__init__ method.</p>
<div class="moz-cite-prefix">
<pre wrap="" class="moz-quote-pre"><snipped></pre>
</div>
<pre class="moz-signature" cols="72">--
Best regards,
Mikhail Elhimov</pre>
</body>
</html>