From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master

gdb: fix error on connect on older distros

In commit adf78de4, I noticed that to access values of an enum class,
we needed to add the class's name, which we previously didn't.
I speculated that is only needed with newer gdb. I just confirmed that
indeed, if one tries to debug OSv on an old distro (but still new enough
to compile OSv), the new names do not work and we need to use the old ones
from before commit adf78de4 - otherwise we get errors on "connect".

So in this patch we try both names, trying the new names first, and if
they fail, the old names.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
Message-Id: <20170315184400.25885-1-...@scylladb.com>

---
diff --git a/scripts/loader.py b/scripts/loader.py
--- a/scripts/loader.py
+++ b/scripts/loader.py
@@ -180,10 +180,16 @@ def invoke(self, arg, from_tty):
             host_port = arg.split()[0]
         gdb.execute('target remote %s' % host_port)
         global status_enum
- status_enum.running = gdb.parse_and_eval('sched::thread::status::running') - status_enum.waiting = gdb.parse_and_eval('sched::thread::status::waiting') - status_enum.queued = gdb.parse_and_eval('sched::thread::status::queued') - status_enum.waking = gdb.parse_and_eval('sched::thread::status::waking')
+        try:
+ status_enum.running = gdb.parse_and_eval('sched::thread::status::running') + status_enum.waiting = gdb.parse_and_eval('sched::thread::status::waiting') + status_enum.queued = gdb.parse_and_eval('sched::thread::status::queued') + status_enum.waking = gdb.parse_and_eval('sched::thread::status::waking')
+        except:
+ status_enum.running = gdb.parse_and_eval('sched::thread::running') + status_enum.waiting = gdb.parse_and_eval('sched::thread::waiting') + status_enum.queued = gdb.parse_and_eval('sched::thread::queued') + status_enum.waking = gdb.parse_and_eval('sched::thread::waking')


 Connect()

--
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to