aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/arm-linux-tdep.c5
-rw-r--r--gdb/breakpoint.c25
-rw-r--r--gdb/breakpoint.h8
-rw-r--r--gdb/compile/compile.c1
-rw-r--r--gdb/debuginfod-support.c1
-rw-r--r--gdb/gdbarch-gen.h12
-rw-r--r--gdb/gdbarch_components.py12
-rw-r--r--gdb/i386-tdep.c29
-rw-r--r--gdb/i386-tdep.h84
-rw-r--r--gdb/infrun.c19
-rw-r--r--gdb/record-full.c4
-rw-r--r--gdb/run-on-main-thread.c1
-rw-r--r--gdb/testsuite/gdb.base/style.exp16
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp4
-rw-r--r--gdb/testsuite/lib/gdb.exp4
-rw-r--r--gdb/top.c1
-rw-r--r--gdb/tui/tui-io.c8
-rw-r--r--gdb/ui-style.c26
-rw-r--r--gdb/ui-style.h36
-rw-r--r--gdb/unittests/style-selftests.c32
-rw-r--r--gdb/value.c1
21 files changed, 213 insertions, 116 deletions
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 2f034af..08526d8 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -960,6 +960,11 @@ arm_linux_software_single_step (struct regcache *regcache)
struct gdbarch *gdbarch = regcache->arch ();
struct arm_get_next_pcs next_pcs_ctx;
+ /* If the target does have hardware single step, GDB doesn't have
+ to bother software single step. */
+ if (target_can_do_single_step () == 1)
+ return {};
+
arm_get_next_pcs_ctor (&next_pcs_ctx,
&arm_linux_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index f795d7b..d704ad1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13998,26 +13998,11 @@ insert_single_step_breakpoint (struct gdbarch *gdbarch,
update_global_location_list (UGLL_INSERT);
}
-/* Try to setup for software single stepping. Return true if
- target_resume() should use hardware single step.
+/* Insert single step breakpoints according to the current state. */
- GDBARCH is the current gdbarch. */
-
-bool
-maybe_software_singlestep (struct gdbarch *gdbarch)
+int
+insert_single_step_breakpoints (struct gdbarch *gdbarch)
{
- if (execution_direction != EXEC_FORWARD)
- return true;
-
- if (target_can_do_single_step () == 1)
- {
- /* The target definitely has hardware single step. */
- return true;
- }
-
- if (!gdbarch_software_single_step_p (gdbarch))
- return true;
-
regcache *regcache = get_thread_regcache (inferior_thread ());
std::vector<CORE_ADDR> next_pcs;
@@ -14031,10 +14016,10 @@ maybe_software_singlestep (struct gdbarch *gdbarch)
for (CORE_ADDR pc : next_pcs)
insert_single_step_breakpoint (gdbarch, aspace, pc);
- return false;
+ return 1;
}
else
- return true;
+ return 0;
}
/* See breakpoint.h. */
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index e9201bc..9341112 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1884,10 +1884,10 @@ extern void insert_single_step_breakpoint (struct gdbarch *,
const address_space *,
CORE_ADDR);
-/* Try to setup for software single stepping. Return true if
- target_resume() should use hardware single step. GDBARCH is the
- current gdbarch. */
-extern bool maybe_software_singlestep (struct gdbarch *);
+/* Insert all software single step breakpoints for the current frame.
+ Return true if any software single step breakpoints are inserted,
+ otherwise, return false. */
+extern int insert_single_step_breakpoints (struct gdbarch *);
/* Check whether any hardware watchpoints have triggered or not,
according to the target, and record it in each watchpoint's
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 229e155..5d81ec1 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -45,6 +45,7 @@
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/scoped_ignore_signal.h"
#include "gdbsupport/buildargv.h"
+#include "gdbsupport/cleanups.h"
/* Hold "compile" commands. */
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 8f28fd5..e99c13b 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -18,6 +18,7 @@
#include "diagnostics.h"
#include <errno.h>
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/scoped_fd.h"
#include "debuginfod-support.h"
#include <optional>
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index 1e51081..281b97b 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -776,10 +776,16 @@ extern void set_gdbarch_get_memtag (struct gdbarch *gdbarch, gdbarch_get_memtag_
extern CORE_ADDR gdbarch_memtag_granule_size (struct gdbarch *gdbarch);
extern void set_gdbarch_memtag_granule_size (struct gdbarch *gdbarch, CORE_ADDR memtag_granule_size);
-/* Return a vector of addresses at which the software single step
- breakpoints should be inserted. An empty vector means software single
- step is not used.
+/* FIXME/cagney/2001-01-18: This should be split in two. A target method that
+ indicates if the target needs software single step. An ISA method to
+ implement it.
+ FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
+ target can single step. If not, then implement single step using breakpoints.
+
+ Return a vector of addresses on which the software single step
+ breakpoints should be inserted. NULL means software single step is
+ not used.
Multiple breakpoints may be inserted for some instructions such as
conditional branch. However, each implementation must always evaluate
the condition and only put the breakpoint at the branch destination if
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 55df102..91c867e 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -1378,10 +1378,16 @@ For a non-zero value, this represents the number of bytes of memory per tag.
Function(
comment="""
-Return a vector of addresses at which the software single step
-breakpoints should be inserted. An empty vector means software single
-step is not used.
+FIXME/cagney/2001-01-18: This should be split in two. A target method that
+indicates if the target needs software single step. An ISA method to
+implement it.
+FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
+target can single step. If not, then implement single step using breakpoints.
+
+Return a vector of addresses on which the software single step
+breakpoints should be inserted. NULL means software single step is
+not used.
Multiple breakpoints may be inserted for some instructions such as
conditional branch. However, each implementation must always evaluate
the condition and only put the breakpoint at the branch destination if
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index f97c98e..21a5a28 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8977,41 +8977,12 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS;
tdep->register_names = i386_register_names;
- /* No upper YMM registers. */
- tdep->ymmh_register_names = NULL;
- tdep->ymm0h_regnum = -1;
-
- /* No upper ZMM registers. */
- tdep->zmmh_register_names = NULL;
- tdep->zmm0h_regnum = -1;
-
- /* No high XMM registers. */
- tdep->xmm_avx512_register_names = NULL;
- tdep->xmm16_regnum = -1;
-
- /* No upper YMM16-31 registers. */
- tdep->ymm16h_register_names = NULL;
- tdep->ymm16h_regnum = -1;
-
tdep->num_byte_regs = 8;
tdep->num_word_regs = 8;
tdep->num_dword_regs = 0;
tdep->num_mmx_regs = 8;
tdep->num_ymm_regs = 0;
- /* No AVX512 registers. */
- tdep->k0_regnum = -1;
- tdep->num_zmm_regs = 0;
- tdep->num_ymm_avx512_regs = 0;
- tdep->num_xmm_avx512_regs = 0;
-
- /* No PKEYS registers */
- tdep->pkru_regnum = -1;
- tdep->num_pkeys_regs = 0;
-
- /* No segment base registers. */
- tdep->fsbase_regnum = -1;
-
tdesc_arch_data_up tdesc_data = tdesc_data_alloc ();
set_gdbarch_relocate_instruction (gdbarch, i386_relocate_instruction);
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index e849b33..e4895b1 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -69,56 +69,57 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
size_t sizeof_fpregset = 0;
/* Register number for %st(0). The register numbers for the other
- registers follow from this one. Set this to -1 to indicate the
- absence of an FPU. */
- int st0_regnum = 0;
+ registers follow from this one. Set this to a value >= 0 if FPU is
+ present. */
+ int st0_regnum = -1;
/* Number of MMX registers. */
int num_mmx_regs = 0;
- /* Register number for %mm0. Set this to -1 to indicate the absence
- of MMX support. */
- int mm0_regnum = 0;
+ /* Register number for %mm0. Set this to a value >= 0 if MMX is
+ supported. */
+ int mm0_regnum = -1;
/* Number of pseudo YMM registers. */
int num_ymm_regs = 0;
- /* Register number for %ymm0. Set this to -1 to indicate the absence
- of pseudo YMM register support. */
- int ymm0_regnum = 0;
+ /* Register number for %ymm0. Set this to a value >= 0 if pseudo YMM
+ registers are supported. */
+ int ymm0_regnum = -1;
/* Number of AVX512 OpMask registers (K-registers) */
int num_k_regs = 0;
- /* Register number for %k0. Set this to -1 to indicate the absence
- of AVX512 OpMask register support. */
- int k0_regnum = 0;
+ /* Register number for %k0. Set this to a value >= 0 if AVX512 OpMask
+ is supported. */
+ int k0_regnum = -1;
/* Number of pseudo ZMM registers ($zmm0-$zmm31). */
int num_zmm_regs = 0;
- /* Register number for %zmm0. Set this to -1 to indicate the absence
- of pseudo ZMM register support. */
- int zmm0_regnum = 0;
+ /* Register number for %zmm0. Set this to a value >= 0 if pseudo ZMM
+ registers are supported. */
+ int zmm0_regnum = -1;
/* Number of byte registers. */
int num_byte_regs = 0;
- /* Register pseudo number for %al. */
- int al_regnum = 0;
+ /* Register pseudo number for %al. If supported, set this to a
+ value >= 0. */
+ int al_regnum = -1;
/* Number of pseudo word registers. */
int num_word_regs = 0;
- /* Register number for %ax. */
- int ax_regnum = 0;
+ /* Register number for %ax. If supported, set this to a value >= 0. */
+ int ax_regnum = -1;
/* Number of pseudo dword registers. */
int num_dword_regs = 0;
- /* Register number for %eax. Set this to -1 to indicate the absence
- of pseudo dword register support. */
- int eax_regnum = 0;
+ /* Register number for %eax. Set this to a value >= 0 if pseudo dword
+ registers are supported. */
+ int eax_regnum = -1;
/* Number of core registers. */
int num_core_regs = 0;
@@ -129,14 +130,16 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
/* Number of SSE registers added in AVX512. */
int num_xmm_avx512_regs = 0;
- /* Register number of XMM16, the first XMM register added in AVX512. */
- int xmm16_regnum = 0;
+ /* Register number of XMM16, the first XMM register added in AVX512.
+ Set this to a value >= 0 if XMM registers are supported. */
+ int xmm16_regnum = -1;
/* Number of YMM registers added in AVX512. */
int num_ymm_avx512_regs = 0;
- /* Register number of YMM16, the first YMM register added in AVX512. */
- int ymm16_regnum = 0;
+ /* Register number of YMM16, the first YMM register added in AVX512.
+ Set this to a value >= 0 if YMM registers are supported. */
+ int ymm16_regnum = -1;
/* Bits of the extended control register 0 (the XFEATURE_ENABLED_MASK
register), excluding the x87 bit, which are supported by this GDB. */
@@ -152,23 +155,23 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
/* Register names. */
const char * const *register_names = nullptr;
- /* Register number for %ymm0h. Set this to -1 to indicate the absence
- of upper YMM register support. */
- int ymm0h_regnum = 0;
+ /* Register number for %ymm0h. Set this to a value >= 0 if they are
+ supported. */
+ int ymm0h_regnum = -1;
/* Upper YMM register names. Only used for tdesc_numbered_register. */
const char * const *ymmh_register_names = nullptr;
- /* Register number for %ymm16h. Set this to -1 to indicate the absence
- of support for YMM16-31. */
- int ymm16h_regnum = 0;
+ /* Register number for %ymm16h. Set this to a value >= 0 if they are
+ supported. */
+ int ymm16h_regnum = -1;
/* YMM16-31 register names. Only used for tdesc_numbered_register. */
const char * const *ymm16h_register_names = nullptr;
- /* Register number for %zmm0h. Set this to -1 to indicate the absence
- of ZMM_HI256 register support. */
- int zmm0h_regnum = 0;
+ /* Register number for %zmm0h. Set this to a value >= 0 if ZMM_HI256
+ registers are supported. */
+ int zmm0h_regnum = -1;
/* OpMask register names. */
const char * const *k_register_names = nullptr;
@@ -185,15 +188,16 @@ struct i386_gdbarch_tdep : gdbarch_tdep_base
/* Number of PKEYS registers. */
int num_pkeys_regs = 0;
- /* Register number for PKRU register. */
- int pkru_regnum = 0;
+ /* Register number for PKRU register. If supported, set this to a value
+ >= 0. */
+ int pkru_regnum = -1;
/* PKEYS register names. */
const char * const *pkeys_register_names = nullptr;
- /* Register number for %fsbase. Set this to -1 to indicate the
- absence of segment base registers. */
- int fsbase_regnum = 0;
+ /* Register number for %fsbase. If supported, set this to a value
+ >= 0. */
+ int fsbase_regnum = -1;
/* Target description. */
const struct target_desc *tdesc = nullptr;
diff --git a/gdb/infrun.c b/gdb/infrun.c
index e0e9ffa..9d3e1b7 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -93,6 +93,8 @@ static void insert_step_resume_breakpoint_at_caller (const frame_info_ptr &);
static void insert_longjmp_resume_breakpoint (struct gdbarch *, CORE_ADDR);
+static bool maybe_software_singlestep (struct gdbarch *gdbarch);
+
static void resume (gdb_signal sig);
static void wait_for_inferior (inferior *inf);
@@ -2357,6 +2359,23 @@ set_schedlock_func (const char *args, int from_tty, struct cmd_list_element *c)
process. */
bool sched_multi = false;
+/* Try to setup for software single stepping. Return true if target_resume()
+ should use hardware single step.
+
+ GDBARCH the current gdbarch. */
+
+static bool
+maybe_software_singlestep (struct gdbarch *gdbarch)
+{
+ bool hw_step = true;
+
+ if (execution_direction == EXEC_FORWARD
+ && gdbarch_software_single_step_p (gdbarch))
+ hw_step = !insert_single_step_breakpoints (gdbarch);
+
+ return hw_step;
+}
+
/* See infrun.h. */
ptid_t
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 7d4ef87..7e3da27 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -1105,7 +1105,7 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
record_full_resume_step = 1;
}
else
- step = maybe_software_singlestep (gdbarch);
+ step = !insert_single_step_breakpoints (gdbarch);
}
}
@@ -1277,7 +1277,7 @@ record_full_wait_1 (struct target_ops *ops,
};
reinit_frame_cache ();
- step = maybe_software_singlestep (gdbarch);
+ step = !insert_single_step_breakpoints (gdbarch);
}
if (record_debug)
diff --git a/gdb/run-on-main-thread.c b/gdb/run-on-main-thread.c
index 30b0928..bf53163 100644
--- a/gdb/run-on-main-thread.c
+++ b/gdb/run-on-main-thread.c
@@ -22,6 +22,7 @@
#include <thread>
#include <mutex>
#endif
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/event-loop.h"
/* The serial event used when posting runnables. */
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index 47efb64..a6c18d3 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -323,10 +323,10 @@ proc run_style_tests { } {
gdb_test_no_output "set style version background 255"
gdb_test_no_output "set style version foreground #FED210"
gdb_test "show style version background" \
- "The \033\\\[38;2;254;210;16;48;5;255;22;27m.*\".*version.*\".*style.*\033\\\[m background color is: 255" \
+ "The \033\\\[38;2;254;210;16;48;5;255;22;23;24;27m.*\".*version.*\".*style.*\033\\\[m background color is: 255" \
"Version's 256-color background style"
gdb_test "show style version foreground" \
- "The \033\\\[38;2;254;210;16;48;5;255;22;27m.*\".*version.*\".*style.*\033\\\[m foreground color is: #FED210" \
+ "The \033\\\[38;2;254;210;16;48;5;255;22;23;24;27m.*\".*version.*\".*style.*\033\\\[m foreground color is: #FED210" \
"Version's TrueColor foreground style"
}
@@ -782,7 +782,7 @@ proc test_pagination_cmd_after_quit_styling {} {
-re "^apropos time\r\n" {
exp_continue
}
- -re "^\033\\\[39;49;1;27m\[^\r\n\]+\r\n" {
+ -re "^\033\\\[39;49;1;23;24;27m\[^\r\n\]+\r\n" {
exp_continue
}
-re "^$::pagination_prompt$" {
@@ -828,7 +828,7 @@ proc test_pagination_cmd_after_quit_styling {} {
# non-default style that was in use when pagination kicked in
# above.
gdb_test "maintenance time" \
- "^\"\033\\\[39;49;1;27mmaintenance time\033\\\[m\" takes a numeric argument\\."
+ "^\"\033\\\[39;49;1;23;24;27mmaintenance time\033\\\[m\" takes a numeric argument\\."
}
# Helper for test_pagination_prompt_styling. Return false if STR, a
@@ -995,20 +995,20 @@ proc test_pagination_continue_styling_1 { length } {
exp_continue
}
- -re "^The current logfile is \"\033\\\[32;49;22;27m(?:ax)+\033\\\[m" {
+ -re "^The current logfile is \"\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m" {
exp_continue
}
- -re "^\r\n\033\\\[32;49;22;27m(?:ax)+\033\\\[m(?=--)" {
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m(?=--)" {
exp_continue
}
- -re "^\r\n\033\\\[32;49;22;27m(?:ax)+(?=--)" {
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+(?=--)" {
set saw_bad_styling true
exp_continue
}
- -re "^\r\n\033\\\[32;49;22;27m(?:ax)+\033\\\[m\"\\.\r\n" {
+ -re "^\r\n\033\\\[32;49;22;23;24;27m(?:ax)+\033\\\[m\"\\.\r\n" {
exp_continue
}
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index fe2cfca..c24e7ed 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -70,6 +70,8 @@ proc style {str style} {
set fg 39
set bg 49
set intensity 22
+ set italic 23
+ set underline 24
set reverse 27
switch -exact -- $style {
title { set intensity 1 }
@@ -84,7 +86,7 @@ proc style {str style} {
line-number { set intensity 2 }
none { return $str }
}
- return "\033\\\[${fg};${bg};${intensity};${reverse}m${str}\033\\\[m"
+ return "\033\\\[${fg};${bg};${intensity};${italic};${underline};${reverse}m${str}\033\\\[m"
}
# gdb_get_bp_addr num
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 0a582aa..98691df 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5729,6 +5729,10 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
set ext "d"
break
}
+ if { "$flag" eq "rust" } {
+ set ext "rs"
+ break
+ }
}
set src [standard_temp_file $name.$ext]
set obj [standard_temp_file $name.$postfix]
diff --git a/gdb/top.c b/gdb/top.c
index 72d1953..b097683 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -34,6 +34,7 @@
#include "value.h"
#include "language.h"
#include "terminal.h"
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/job-control.h"
#include "annotate.h"
#include "completer.h"
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 1b4cc82..c97e8fd 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -319,6 +319,8 @@ tui_apply_style (WINDOW *w, ui_file_style style)
wattron (w, A_NORMAL);
wattroff (w, A_BOLD);
wattroff (w, A_DIM);
+ wattroff (w, A_ITALIC);
+ wattroff (w, A_UNDERLINE);
wattroff (w, A_REVERSE);
if (last_color_pair != -1)
wattroff (w, COLOR_PAIR (last_color_pair));
@@ -366,6 +368,12 @@ tui_apply_style (WINDOW *w, ui_file_style style)
gdb_assert_not_reached ("invalid intensity");
}
+ if (style.is_italic ())
+ wattron (w, A_ITALIC);
+
+ if (style.is_underline ())
+ wattron (w, A_UNDERLINE);
+
if (style.is_reverse ())
wattron (w, A_REVERSE);
diff --git a/gdb/ui-style.c b/gdb/ui-style.c
index c8f2e11..9a58e4d 100644
--- a/gdb/ui-style.c
+++ b/gdb/ui-style.c
@@ -290,6 +290,16 @@ ui_file_style::to_ansi () const
else
result.append (std::to_string (m_intensity));
result.push_back (';');
+ if (m_italic)
+ result.append ("3");
+ else
+ result.append ("23");
+ result.push_back (';');
+ if (m_underline)
+ result.append ("4");
+ else
+ result.append ("24");
+ result.push_back (';');
if (m_reverse)
result.push_back ('7');
else
@@ -435,6 +445,14 @@ ui_file_style::parse (const char *buf, size_t *n_read)
/* Dim. */
m_intensity = DIM;
break;
+ case 3:
+ /* Italic. */
+ m_italic = true;
+ break;
+ case 4:
+ /* Underline. */
+ m_underline = true;
+ break;
case 7:
/* Reverse. */
m_reverse = true;
@@ -446,6 +464,14 @@ ui_file_style::parse (const char *buf, size_t *n_read)
/* Normal. */
m_intensity = NORMAL;
break;
+ case 23:
+ /* Non-italic. */
+ m_italic = false;
+ break;
+ case 24:
+ /* Non-underline. */
+ m_underline = false;
+ break;
case 27:
/* Inverse off. */
m_reverse = false;
diff --git a/gdb/ui-style.h b/gdb/ui-style.h
index f61152f..1ea3556 100644
--- a/gdb/ui-style.h
+++ b/gdb/ui-style.h
@@ -266,7 +266,9 @@ struct ui_file_style
return (m_foreground == other.m_foreground
&& m_background == other.m_background
&& m_intensity == other.m_intensity
- && m_reverse == other.m_reverse);
+ && m_reverse == other.m_reverse
+ && m_italic == other.m_italic
+ && m_underline == other.m_underline);
}
bool operator!= (const ui_file_style &other) const
@@ -284,7 +286,9 @@ struct ui_file_style
return (m_foreground == NONE
&& m_background == NONE
&& m_intensity == NORMAL
- && !m_reverse);
+ && !m_reverse
+ && !m_italic
+ && !m_underline);
}
/* Return true if this style specified reverse display; false
@@ -330,6 +334,32 @@ struct ui_file_style
return m_intensity;
}
+ /* Return true if this style specified italic display; false
+ otherwise. */
+ bool is_italic () const
+ {
+ return m_italic;
+ }
+
+ /* Set/clear the italic display flag. */
+ void set_italic (bool italic)
+ {
+ m_italic = italic;
+ }
+
+ /* Return true if this style specified underline display; false
+ otherwise. */
+ bool is_underline () const
+ {
+ return m_underline;
+ }
+
+ /* Set/clear the underline display flag. */
+ void set_underline (bool underline)
+ {
+ m_underline = underline;
+ }
+
/* Parse an ANSI escape sequence in BUF, modifying this style. BUF
must begin with an ESC character. Return true if an escape
sequence was successfully parsed; false otherwise. In either
@@ -351,6 +381,8 @@ private:
color m_foreground = NONE;
color m_background = NONE;
intensity m_intensity = NORMAL;
+ bool m_italic = false;
+ bool m_underline = false;
bool m_reverse = false;
};
diff --git a/gdb/unittests/style-selftests.c b/gdb/unittests/style-selftests.c
index f2a37bb..7cb42a1 100644
--- a/gdb/unittests/style-selftests.c
+++ b/gdb/unittests/style-selftests.c
@@ -38,6 +38,8 @@ run_tests ()
SELF_CHECK (style.get_foreground ().is_none ());
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
SELF_CHECK (style.to_ansi () == "\033[m");
@@ -47,6 +49,8 @@ run_tests ()
SELF_CHECK (style.get_foreground ().is_none ());
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
/* This particular case does not round-trip identically, but the
difference is unimportant. */
@@ -57,8 +61,10 @@ run_tests ()
SELF_CHECK (style.get_foreground ().is_none ());
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[39;49;22;7m");
+ SELF_CHECK (style.to_ansi () == "\033[39;49;22;23;24;7m");
style = ui_file_style ();
SELF_CHECK (style.parse ("\033[32;1m", &n_read));
@@ -67,8 +73,22 @@ run_tests ()
SELF_CHECK (style.get_foreground ().get_value () == ui_file_style::GREEN);
SELF_CHECK (style.get_background ().is_none ());
SELF_CHECK (style.get_intensity () == ui_file_style::BOLD);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[32;49;1;27m");
+ SELF_CHECK (style.to_ansi () == "\033[32;49;1;23;24;27m");
+
+ style = ui_file_style ();
+ SELF_CHECK (style.parse ("\033[32;2;3;4m", &n_read));
+ SELF_CHECK (n_read == 11);
+ SELF_CHECK (style.get_foreground ().is_basic ());
+ SELF_CHECK (style.get_foreground ().get_value () == ui_file_style::GREEN);
+ SELF_CHECK (style.get_background ().is_none ());
+ SELF_CHECK (style.get_intensity () == ui_file_style::DIM);
+ SELF_CHECK (style.is_italic ());
+ SELF_CHECK (style.is_underline ());
+ SELF_CHECK (!style.is_reverse ());
+ SELF_CHECK (style.to_ansi () == "\033[32;49;2;3;4;27m");
style = ui_file_style ();
SELF_CHECK (style.parse ("\033[38;5;112;48;5;249m", &n_read));
@@ -80,8 +100,10 @@ run_tests ()
style.get_background ().get_rgb (rgb);
CHECK_RGB (0xb2, 0xb2, 0xb2);
SELF_CHECK (style.get_intensity () == ui_file_style::NORMAL);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (!style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[38;5;112;48;5;249;22;27m");
+ SELF_CHECK (style.to_ansi () == "\033[38;5;112;48;5;249;22;23;24;27m");
style = ui_file_style ();
SELF_CHECK (style.parse ("\033[38;2;83;84;85;48;2;0;1;254;2;7m", &n_read));
@@ -93,8 +115,10 @@ run_tests ()
style.get_background ().get_rgb (rgb);
CHECK_RGB (0, 1, 254);
SELF_CHECK (style.get_intensity () == ui_file_style::DIM);
+ SELF_CHECK (!style.is_italic ());
+ SELF_CHECK (!style.is_underline ());
SELF_CHECK (style.is_reverse ());
- SELF_CHECK (style.to_ansi () == "\033[38;2;83;84;85;48;2;0;1;254;2;7m");
+ SELF_CHECK (style.to_ansi () == "\033[38;2;83;84;85;48;2;0;1;254;2;23;24;7m");
}
} /* namespace style */
diff --git a/gdb/value.c b/gdb/value.c
index 5574642..82d9a86 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -45,6 +45,7 @@
#include <utility>
#include <vector>
#include "completer.h"
+#include "gdbsupport/cleanups.h"
#include "gdbsupport/selftest.h"
#include "gdbsupport/array-view.h"
#include "cli/cli-style.h"