summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-06-19 20:30:11 +0000
committerAndrew Cagney <cagney@redhat.com>2001-06-19 20:30:11 +0000
commit65bc176d8c8517316955195dfb2ecb7891ca4f5e (patch)
tree5c5387df579faad77a8d9437000ebf93a76c8fd8
parent45fee2496ed6790b3387cf9d712b2a051e3ba359 (diff)
downloadgdb-65bc176d8c8517316955195dfb2ecb7891ca4f5e.tar.gz
* cli-out.c: Include "gdb_assert.h'.
(struct ui_out_data): Add field ``suppress_output. (cli_table_begin): When NR_ROWS is zero, suppress_output. (cli_table_end): Clear suppress_output. (cli_table_body): Check suppress_output. (cli_table_header, cli_begin): Ditto. (cli_end, cli_field_int, cli_field_skip): Ditto. (cli_field_string, cli_field_fmt, cli_spaces): Ditto. (cli_text, cli_message, cli_wrap_hint): Ditto. * breakpoint.c (breakpoint_1): Close the ui_out table before printing the breakpoint not found message.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/breakpoint.c8
-rw-r--r--gdb/cli-out.c45
3 files changed, 64 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 23633f0176b..1e436d8d49c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2001-06-19 Andrew Cagney <ac131313@redhat.com>
+
+ * cli-out.c: Include "gdb_assert.h'.
+ (struct ui_out_data): Add field ``suppress_output.
+ (cli_table_begin): When NR_ROWS is zero, suppress_output.
+ (cli_table_end): Clear suppress_output.
+ (cli_table_body): Check suppress_output.
+ (cli_table_header, cli_begin): Ditto.
+ (cli_end, cli_field_int, cli_field_skip): Ditto.
+ (cli_field_string, cli_field_fmt, cli_spaces): Ditto.
+ (cli_text, cli_message, cli_wrap_hint): Ditto.
+ * breakpoint.c (breakpoint_1): Close the ui_out table before
+ printing the breakpoint not found message.
+
2001-06-18 Andrew Cagney <ac131313@redhat.com>
* ui-out.c (ui_out_table_begin): Add parameter ``nr_rows''.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 90c85032daf..e8c9c7390ce 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3657,6 +3657,11 @@ breakpoint_1 (int bnum, int allflag)
print_one_breakpoint (b, &last_addr);
}
+
+#ifdef UI_OUT
+ ui_out_table_end (uiout);
+#endif /* UI_OUT */
+
if (nr_printable_breakpoints == 0)
{
#ifdef UI_OUT
@@ -3680,9 +3685,6 @@ breakpoint_1 (int bnum, int allflag)
set_next_address (last_addr);
}
-#ifdef UI_OUT
- ui_out_table_end (uiout);
-#endif /* UI_OUT */
/* FIXME? Should this be moved up so that it is only called when
there have been breakpoints? */
annotate_breakpoints_table_end ();
diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 3bfb370056a..367c92aaf1c 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -24,6 +24,7 @@
#include "ui-out.h"
#include "cli-out.h"
#include "gdb_string.h"
+#include "gdb_assert.h"
/* Convenience macro for allocting typesafe memory. */
@@ -34,6 +35,7 @@
struct ui_out_data
{
struct ui_file *stream;
+ int suppress_output;
};
/* These are the CLI output functions */
@@ -111,6 +113,13 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols,
int nr_rows,
const char *tblid)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (nr_rows == 0)
+ data->suppress_output = 1;
+ else
+ /* Only the table suppresses the output and, fortunatly, a table
+ is not a recursive data structure. */
+ gdb_assert (data->suppress_output == 0);
}
/* Mark beginning of a table body */
@@ -118,6 +127,9 @@ cli_table_begin (struct ui_out *uiout, int nbrofcols,
void
cli_table_body (struct ui_out *uiout)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
/* first, close the table header line */
cli_text (uiout, "\n");
}
@@ -127,6 +139,8 @@ cli_table_body (struct ui_out *uiout)
void
cli_table_end (struct ui_out *uiout)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ data->suppress_output = 0;
}
/* Specify table header */
@@ -135,6 +149,9 @@ void
cli_table_header (struct ui_out *uiout, int width, enum ui_align alignment,
const char *colhdr)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
cli_field_string (uiout, 0, width, alignment, 0, colhdr);
}
@@ -146,6 +163,9 @@ cli_begin (struct ui_out *uiout,
int level,
const char *id)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
}
/* Mark end of a list */
@@ -155,6 +175,9 @@ cli_end (struct ui_out *uiout,
enum ui_out_type type,
int level)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
}
/* output an int field */
@@ -166,6 +189,9 @@ cli_field_int (struct ui_out *uiout, int fldno, int width,
{
char buffer[20]; /* FIXME: how many chars long a %d can become? */
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
sprintf (buffer, "%d", value);
cli_field_string (uiout, fldno, width, alignment, fldname, buffer);
}
@@ -177,6 +203,9 @@ cli_field_skip (struct ui_out *uiout, int fldno, int width,
enum ui_align alignment,
const char *fldname)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
cli_field_string (uiout, fldno, width, alignment, fldname, "");
}
@@ -194,6 +223,10 @@ cli_field_string (struct ui_out *uiout,
int before = 0;
int after = 0;
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
+
if ((align != ui_noalign) && string)
{
before = width - strlen (string);
@@ -238,6 +271,9 @@ cli_field_fmt (struct ui_out *uiout, int fldno,
va_list args)
{
struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
+
vfprintf_filtered (data->stream, format, args);
if (align != ui_noalign)
@@ -248,6 +284,8 @@ void
cli_spaces (struct ui_out *uiout, int numspaces)
{
struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
print_spaces_filtered (numspaces, data->stream);
}
@@ -255,6 +293,8 @@ void
cli_text (struct ui_out *uiout, const char *string)
{
struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
fputs_filtered (string, data->stream);
}
@@ -263,6 +303,8 @@ cli_message (struct ui_out *uiout, int verbosity,
const char *format, va_list args)
{
struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
if (ui_out_get_verblvl (uiout) >= verbosity)
vfprintf_unfiltered (data->stream, format, args);
}
@@ -270,6 +312,9 @@ cli_message (struct ui_out *uiout, int verbosity,
void
cli_wrap_hint (struct ui_out *uiout, char *identstring)
{
+ struct ui_out_data *data = ui_out_data (uiout);
+ if (data->suppress_output)
+ return;
wrap_here (identstring);
}