Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 40 additions & 27 deletions gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -463,39 +463,39 @@ define flagsarm
# Carry/Borrow/Extend (C), bit 29
# Overflow (V), bit 28
# negative/less than (N), bit 31 of CPSR
if ($cpsr->n & 1)
if (($cpsr >> 0x1f) & 1)
printf "N "
set $_n_flag = 1
else
printf "n "
set $_n_flag = 0
end
# zero (Z), bit 30
if ($cpsr->z & 1)
if (($cpsr >> 0x1e) & 1)
printf "Z "
set $_z_flag = 1
else
printf "z "
set $_z_flag = 0
end
# Carry/Borrow/Extend (C), bit 29
if ($cpsr->c & 1)
if (($cpsr >> 0x1d) & 1)
printf "C "
set $_c_flag = 1
else
printf "c "
set $_c_flag = 0
end
# Overflow (V), bit 28
if ($cpsr->v & 1)
if (($cpsr >> 0x1c) & 1)
printf "V "
set $_v_flag = 1
else
printf "v "
set $_v_flag = 0
end
# Sticky overflow (Q), bit 27
if ($cpsr->q & 1)
if (($cpsr >> 0x1b) & 1)
printf "Q "
set $_q_flag = 1
else
Expand All @@ -506,15 +506,15 @@ define flagsarm
# When T=1:
# J = 0 The processor is in Thumb state.
# J = 1 The processor is in ThumbEE state.
if ($cpsr->j & 1)
if (($cpsr >> 0x18) & 1)
printf "J "
set $_j_flag = 1
else
printf "j "
set $_j_flag = 0
end
# Data endianness bit (E), bit 9
if ($cpsr->e & 1)
if (($cpsr >> 9) & 1)
printf "E "
set $_e_flag = 1
else
Expand All @@ -524,7 +524,7 @@ define flagsarm
# Imprecise abort disable bit (A), bit 8
# The A bit is set to 1 automatically. It is used to disable imprecise data aborts.
# It might not be writable in the Nonsecure state if the AW bit in the SCR register is reset.
if ($cpsr->a & 1)
if (($cpsr >> 8) & 1)
printf "A "
set $_a_flag = 1
else
Expand All @@ -533,7 +533,7 @@ define flagsarm
end
# IRQ disable bit (I), bit 7
# When the I bit is set to 1, IRQ interrupts are disabled.
if ($cpsr->i & 1)
if (($cpsr >> 7) & 1)
printf "I "
set $_i_flag = 1
else
Expand All @@ -543,7 +543,7 @@ define flagsarm
# FIQ disable bit (F), bit 6
# When the F bit is set to 1, FIQ interrupts are disabled.
# FIQ can be nonmaskable in the Nonsecure state if the FW bit in SCR register is reset.
if ($cpsr->f & 1)
if (($cpsr >> 6) & 1)
printf "F "
set $_f_flag = 1
else
Expand All @@ -552,7 +552,7 @@ define flagsarm
end
# Thumb state bit (F), bit 5
# if 1 then the processor is executing in Thumb state or ThumbEE state depending on the J bit
if ($cpsr->t & 1)
if (($cpsr >> 5) & 1)
printf "T "
set $_t_flag = 1
else
Expand Down Expand Up @@ -656,15 +656,16 @@ end

define eflags
if $ARM == 1
# http://www.heyrick.co.uk/armwiki/The_Status_register
printf " N <%d> Z <%d> C <%d> V <%d>",\
($cpsr->n & 1), ($cpsr->z & 1), \
($cpsr->c & 1), ($cpsr->v & 1)
(($cpsr >> 0x1f) & 1), (($cpsr >> 0x1e) & 1), \
(($cpsr >> 0x1d) & 1), (($cpsr >> 0x1c) & 1)
printf " Q <%d> J <%d> GE <%d> E <%d> A <%d>",\
($cpsr->q & 1), ($cpsr->j & 1),\
($cpsr->ge), ($cpsr->e & 1), ($cpsr->a & 1)
(($cpsr >> 0x1b) & 1), (($cpsr >> 0x18) & 1),\
(($cpsr >> 0x10) & 7), (($cpsr >> 9) & 1), (($cpsr >> 8) & 1)
printf " I <%d> F <%d> T <%d> \n",\
($cpsr->i & 1), ($cpsr->f & 1), \
($cpsr->t & 1)
(($cpsr >> 7) & 1), (($cpsr >> 6) & 1), \
(($cpsr >> 5) & 1)
else
printf " OF <%d> DF <%d> IF <%d> TF <%d>",\
(((unsigned int)$eflags >> 0xB) & 1), (((unsigned int)$eflags >> 0xA) & 1), \
Expand Down Expand Up @@ -1495,11 +1496,16 @@ define ddump
help ddump
else
color $COLOR_SEPARATOR
if ($64BITS == 1)
printf "[0x%04X:0x%016lX]", $ds, $data_addr
if $ARM == 1
printf "[0x%08X]", $data_addr
else
printf "[0x%04X:0x%08X]", $ds, $data_addr
if ($64BITS == 1)
printf "[0x%04X:0x%016lX]", $ds, $data_addr
else
printf "[0x%04X:0x%08X]", $ds, $data_addr
end
end

color $COLOR_SEPARATOR
printf "------------------------"
printf "-------------------------------"
Expand Down Expand Up @@ -1610,7 +1616,8 @@ define dumpjump
# 12 bits for any immediate value
# $_t_flag == 0 => ARM mode
# $_t_flag == 1 => Thumb or ThumbEE
if ($cpsr->t & 1)
# State bit (T), bit 5
if (($cpsr >> 5) & 1)
set $_t_flag = 1
else
set $_t_flag = 0
Expand Down Expand Up @@ -2031,11 +2038,15 @@ define context
end
if $SHOWSTACK == 1
color $COLOR_SEPARATOR
if ($64BITS == 1)
printf "[0x%04X:0x%016lX]", $ss, $rsp
if $ARM == 1
printf "[0x%08X]", $sp
else
printf "[0x%04X:0x%08X]", $ss, $esp
end
if ($64BITS == 1)
printf "[0x%04X:0x%016lX]", $ss, $rsp
else
printf "[0x%04X:0x%08X]", $ss, $esp
end
end
color $COLOR_SEPARATOR
printf "-------------------------"
printf "-----------------------------"
Expand Down Expand Up @@ -2130,14 +2141,16 @@ define context
if ($SETCOLOUR1STLINE == 1)
color $GREEN
if ($ARM == 1)
x/i $pc | $cpsr.t
# | $cpsr.t (Thumb flag)
x/i (unsigned int)$pc | (($cpsr >> 5) & 1)
else
x/i $pc
end
color_reset
else
if ($ARM == 1)
x/i $pc | $cpsr.t
# | $cpsr.t (Thumb flag)
x/i (unsigned int)$pc | (($cpsr >> 5) & 1)
else
x/i $pc
end
Expand Down