summaryrefslogtreecommitdiff
path: root/buildscripts/gdb
diff options
context:
space:
mode:
authorIrina Yatsenko <irina.yatsenko@mongodb.com>2022-10-27 16:12:51 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-27 17:50:55 +0000
commitc32ea289b77a3ec19651a0beb49d62275928355c (patch)
tree6599b0321a7633956e0f9302b2217265d5ef1cb7 /buildscripts/gdb
parentbe98d83d232dc09acbc9bc77fb95a2d51b8c24a8 (diff)
downloadmongo-c32ea289b77a3ec19651a0beb49d62275928355c.tar.gz
SERVER-68743 Push down $exits and $type
Diffstat (limited to 'buildscripts/gdb')
-rw-r--r--buildscripts/gdb/mongo_printers.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/buildscripts/gdb/mongo_printers.py b/buildscripts/gdb/mongo_printers.py
index a524a2ba085..c18eb3d94ef 100644
--- a/buildscripts/gdb/mongo_printers.py
+++ b/buildscripts/gdb/mongo_printers.py
@@ -721,6 +721,15 @@ def read_as_integer(pmem, size):
gdb.selected_inferior().read_memory(pmem, size).tobytes(), \
sys.byteorder)
+def read_as_integer_signed(pmem, size):
+ """Read 'size' bytes at 'pmem' as an integer."""
+ # We assume the same platform for the debugger and the debuggee (thus, 'sys.byteorder'). If
+ # this becomes a problem look into whether it's possible to determine the byteorder of the
+ # inferior.
+ return int.from_bytes(
+ gdb.selected_inferior().read_memory(pmem, size).tobytes(),
+ sys.byteorder,
+ signed = True)
class SbeCodeFragmentPrinter(object):
"""
@@ -803,7 +812,7 @@ class SbeCodeFragmentPrinter(object):
args = 'arg: ' + str(read_as_integer(cur_op, int_size))
cur_op += int_size
elif op_name in ['jmp', 'jmpTrue', 'jmpNothing']:
- offset = read_as_integer(cur_op, int_size)
+ offset = read_as_integer_signed(cur_op, int_size)
cur_op += int_size
args = 'offset: ' + str(offset) + ', target: ' + hex(cur_op + offset)
elif op_name in ['pushConstVal', 'getFieldImm']:
@@ -838,7 +847,8 @@ class SbeCodeFragmentPrinter(object):
cur_op += uint8_size
args = \
'Instruction::Constants: ' + str(const_enum) + \
- ", offset: " + str(read_as_integer(cur_op, int_size))
+ ", offset: " + str(read_as_integer_signed(cur_op, int_size))
+ cur_op += int_size
elif op_name in ['applyClassicMatcher']:
args = 'MatchExpression* ' + hex(read_as_integer(cur_op, ptr_size))
cur_op += ptr_size
@@ -855,6 +865,10 @@ class SbeCodeFragmentPrinter(object):
day_of_week = read_as_integer(cur_op, day_of_week_size)
cur_op += day_of_week_size
args += ', dayOfWeek: ' + str(day_of_week)
+ elif op_name in ['traverseCsiCellValues', 'traverseCsiCellTypes']:
+ offset = read_as_integer_signed(cur_op, int_size)
+ cur_op += int_size
+ args = 'lambda at: ' + hex(cur_op + offset)
yield hex(op_addr), '{} ({})'.format(op_name, args)