scylla-gdb: access io_queue::_streams and io_queue::_fgs with static_vector

in seastar's b28342fa5a301de3facf5e83dc691524a6b20604, we switched
* `io_queue::_streams` from
  `boost::container::small_vector<fair_queue, 2>` to
  `boost::container::static_vector<fair_queue, 2>`
* `io_queue::_fgs` from
  `std::vector<std::unique_ptr<fair_group>>` to
  `boost::container::static_vector<fair_group, 2>`

so we need to update the gdb script accordingly to reflect this
change, and to avoid the nested try-except blocks, we switch to
a `while` statement to simplify the code structure.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#18165
This commit is contained in:
Kefu Chai
2024-04-03 14:49:39 +08:00
committed by Botond Dénes
parent 994f807bf6
commit 3b50c39a83

View File

@@ -3684,14 +3684,34 @@ class scylla_io_queues(gdb.Command):
gdb.write("\n")
group = std_shared_ptr(ioq['_group']).get().dereference()
try:
f_groups = [ std_unique_ptr(x) for x in std_vector(group['_fgs']) ]
f_queues = boost_small_vector(ioq['_streams'])
fq_pclass = lambda x : x.dereference()
except gdb.error:
f_groups = [ group['_fg'] ]
f_queues = [ ioq['_fq'] ]
fq_pclass = lambda x : seastar_lw_shared_ptr(x).get().dereference()
while True:
# in order to avoid nested try-catch block, use a single while block
try:
f_groups = static_vector(group['_fgs'])
_ = len(f_groups)
f_queues = static_vector(ioq['_streams'])
_ = len(f_queues)
fq_pclass = lambda x: x.dereference()
break
except gdb.error:
# try harder
pass
try:
f_groups = [std_unique_ptr(x) for x in std_vector(group['_fgs'])]
f_queues = boost_small_vector(ioq['_streams'])
fq_pclass = lambda x: x.dereference()
break
except gdb.error:
# try harder
pass
try:
f_groups = [group['_fg']]
f_queues = [ioq['_fq']]
fq_pclass = lambda x: seastar_lw_shared_ptr(x).get().dereference()
break
except gdb.error:
# give up
raise
gdb.write("\t{} streams\n".format(len(f_groups)))
gdb.write("\n")