2008-12-02 08:57:38 +01:00
|
|
|
/* Routines for handling XML generic OS data provided by target.
|
|
|
|
|
2018-01-01 05:43:02 +01:00
|
|
|
Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
2008-12-02 08:57:38 +01:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "vec.h"
|
|
|
|
#include "xml-support.h"
|
|
|
|
#include "osdata.h"
|
|
|
|
#include "ui-out.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
|
|
|
|
#if !defined(HAVE_LIBEXPAT)
|
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
std::unique_ptr<osdata>
|
2008-12-02 08:57:38 +01:00
|
|
|
osdata_parse (const char *xml)
|
|
|
|
{
|
|
|
|
static int have_warned;
|
|
|
|
|
|
|
|
if (!have_warned)
|
|
|
|
{
|
|
|
|
have_warned = 1;
|
|
|
|
warning (_("Can not parse XML OS data; XML support was disabled "
|
|
|
|
"at compile time"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* HAVE_LIBEXPAT */
|
|
|
|
|
|
|
|
/* Internal parsing data passed to all XML callbacks. */
|
|
|
|
struct osdata_parsing_data
|
2017-11-22 22:12:06 +01:00
|
|
|
{
|
|
|
|
std::unique_ptr<struct osdata> osdata;
|
|
|
|
std::string property_name;
|
|
|
|
};
|
2008-12-02 08:57:38 +01:00
|
|
|
|
|
|
|
/* Handle the start of a <osdata> element. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
osdata_start_osdata (struct gdb_xml_parser *parser,
|
|
|
|
const struct gdb_xml_element *element,
|
2018-01-07 15:29:52 +01:00
|
|
|
void *user_data,
|
|
|
|
std::vector<gdb_xml_value> &attributes)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2015-09-25 20:08:07 +02:00
|
|
|
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
if (data->osdata != NULL)
|
2008-12-02 08:57:38 +01:00
|
|
|
gdb_xml_error (parser, _("Seen more than on osdata element"));
|
|
|
|
|
2018-01-07 15:29:52 +01:00
|
|
|
char *type = (char *) xml_find_attribute (attributes, "type")->value.get ();
|
2017-11-22 22:12:06 +01:00
|
|
|
data->osdata.reset (new struct osdata (std::string (type)));
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the start of a <item> element. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
osdata_start_item (struct gdb_xml_parser *parser,
|
|
|
|
const struct gdb_xml_element *element,
|
2018-01-07 15:29:52 +01:00
|
|
|
void *user_data,
|
|
|
|
std::vector<gdb_xml_value> &attributes)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2015-09-25 20:08:07 +02:00
|
|
|
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
|
2017-11-22 22:12:06 +01:00
|
|
|
data->osdata->items.emplace_back ();
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the start of a <column> element. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
osdata_start_column (struct gdb_xml_parser *parser,
|
|
|
|
const struct gdb_xml_element *element,
|
2018-01-07 15:29:52 +01:00
|
|
|
void *user_data,
|
|
|
|
std::vector<gdb_xml_value> &attributes)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2015-09-25 20:08:07 +02:00
|
|
|
struct osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
|
|
|
|
const char *name
|
2018-01-07 15:29:52 +01:00
|
|
|
= (const char *) xml_find_attribute (attributes, "name")->value.get ();
|
2010-05-16 02:46:46 +02:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
data->property_name.assign (name);
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle the end of a <column> element. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
osdata_end_column (struct gdb_xml_parser *parser,
|
|
|
|
const struct gdb_xml_element *element,
|
|
|
|
void *user_data, const char *body_text)
|
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
osdata_parsing_data *data = (struct osdata_parsing_data *) user_data;
|
|
|
|
struct osdata *osdata = data->osdata.get ();
|
|
|
|
osdata_item &item = osdata->items.back ();
|
2010-05-16 02:46:46 +02:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
item.columns.emplace_back (std::move (data->property_name),
|
2017-11-23 19:51:50 +01:00
|
|
|
std::string (body_text));
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The allowed elements and attributes for OS data object.
|
|
|
|
The root element is a <osdata>. */
|
|
|
|
|
|
|
|
const struct gdb_xml_attribute column_attributes[] = {
|
|
|
|
{ "name", GDB_XML_AF_NONE, NULL, NULL },
|
|
|
|
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct gdb_xml_element item_children[] = {
|
|
|
|
{ "column", column_attributes, NULL,
|
|
|
|
GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
|
|
|
|
osdata_start_column, osdata_end_column },
|
|
|
|
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct gdb_xml_attribute osdata_attributes[] = {
|
|
|
|
{ "type", GDB_XML_AF_NONE, NULL, NULL },
|
|
|
|
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct gdb_xml_element osdata_children[] = {
|
|
|
|
{ "item", NULL, item_children,
|
|
|
|
GDB_XML_EF_REPEATABLE | GDB_XML_EF_OPTIONAL,
|
|
|
|
osdata_start_item, NULL },
|
|
|
|
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct gdb_xml_element osdata_elements[] = {
|
|
|
|
{ "osdata", osdata_attributes, osdata_children,
|
|
|
|
GDB_XML_EF_NONE, osdata_start_osdata, NULL },
|
|
|
|
{ NULL, NULL, NULL, GDB_XML_EF_NONE, NULL, NULL }
|
|
|
|
};
|
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
std::unique_ptr<osdata>
|
2008-12-02 08:57:38 +01:00
|
|
|
osdata_parse (const char *xml)
|
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
osdata_parsing_data data;
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2011-01-25 10:49:59 +01:00
|
|
|
if (gdb_xml_parse_quick (_("osdata"), "osdata.dtd",
|
|
|
|
osdata_elements, xml, &data) == 0)
|
|
|
|
{
|
|
|
|
/* Parsed successfully, don't need to delete the result. */
|
2017-11-22 22:12:06 +01:00
|
|
|
return std::move (data.osdata);
|
2011-01-25 10:49:59 +01:00
|
|
|
}
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2011-01-25 10:49:59 +01:00
|
|
|
return NULL;
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
std::unique_ptr<osdata>
|
2008-12-02 16:52:15 +01:00
|
|
|
get_osdata (const char *type)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
std::unique_ptr<osdata> osdata;
|
Make target_read_alloc & al return vectors
This patch started by changing target_read_alloc_1 to return a
byte_vector, to avoid manual memory management (in target_read_alloc_1
and in the callers). To communicate failures to the callers, it
actually returns a gdb::optional<gdb::byte_vector>.
Adjusting target_read_stralloc was a bit more tricky, since it wants to
return a buffer of char, and not gdb_byte. Since you can't just cast a
gdb::byte_vector into a gdb::def_vector<char>, I made
target_read_alloc_1 templated, so both versions (that return vectors of
gdb_byte and char) are generated. Since target_read_stralloc now
returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a
few callers need to be adjusted.
gdb/ChangeLog:
* common/byte-vector.h (char_vector): New type.
* target.h (target_read_alloc): Return
gdb::optional<byte_vector>.
(target_read_stralloc): Return gdb::optional<char_vector>.
(target_get_osdata): Return gdb::optional<char_vector>.
* target.c (target_read_alloc_1): Templatize. Replacement
manual memory management with vector.
(target_read_alloc): Change return type, adjust.
(target_read_stralloc): Change return type, adjust.
(target_get_osdata): Change return type, adjust.
* auxv.c (struct auxv_info) <length>: Remove.
<data>: Change type to gdb::optional<byte_vector>.
(auxv_inferior_data_cleanup): Free auxv_info with delete.
(get_auxv_inferior_data): Allocate auxv_info with new, adjust.
(target_auxv_search): Adjust.
(fprint_target_auxv): Adjust.
* avr-tdep.c (avr_io_reg_read_command): Adjust.
* linux-tdep.c (linux_spu_make_corefile_notes): Adjust.
(linux_make_corefile_notes): Adjust.
* osdata.c (get_osdata): Adjust.
* remote.c (remote_get_threads_with_qxfer): Adjust.
(remote_memory_map): Adjust.
(remote_traceframe_info): Adjust.
(btrace_read_config): Adjust.
(remote_read_btrace): Adjust.
(remote_pid_to_exec_file): Adjust.
* solib-aix.c (solib_aix_get_library_list): Adjust.
* solib-dsbt.c (decode_loadmap): Don't free buf.
(dsbt_get_initial_loadmaps): Adjust.
* solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust.
* solib-target.c (solib_target_current_sos): Adjust.
* tracepoint.c (sdata_make_value): Adjust.
* xml-support.c (xinclude_start_include): Adjust.
(xml_fetch_content_from_file): Adjust.
* xml-support.h (xml_fetch_another): Change return type.
(xml_fetch_content_from_file): Change return type.
* xml-syscall.c (xml_init_syscalls_info): Adjust.
* xml-tdesc.c (file_read_description_xml): Adjust.
(fetch_available_features_from_target): Change return type.
(target_fetch_description_xml): Adjust.
(target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
|
|
|
gdb::optional<gdb::char_vector> xml = target_get_osdata (type);
|
2010-05-16 02:46:46 +02:00
|
|
|
|
2008-12-02 08:57:38 +01:00
|
|
|
if (xml)
|
|
|
|
{
|
Make target_read_alloc & al return vectors
This patch started by changing target_read_alloc_1 to return a
byte_vector, to avoid manual memory management (in target_read_alloc_1
and in the callers). To communicate failures to the callers, it
actually returns a gdb::optional<gdb::byte_vector>.
Adjusting target_read_stralloc was a bit more tricky, since it wants to
return a buffer of char, and not gdb_byte. Since you can't just cast a
gdb::byte_vector into a gdb::def_vector<char>, I made
target_read_alloc_1 templated, so both versions (that return vectors of
gdb_byte and char) are generated. Since target_read_stralloc now
returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a
few callers need to be adjusted.
gdb/ChangeLog:
* common/byte-vector.h (char_vector): New type.
* target.h (target_read_alloc): Return
gdb::optional<byte_vector>.
(target_read_stralloc): Return gdb::optional<char_vector>.
(target_get_osdata): Return gdb::optional<char_vector>.
* target.c (target_read_alloc_1): Templatize. Replacement
manual memory management with vector.
(target_read_alloc): Change return type, adjust.
(target_read_stralloc): Change return type, adjust.
(target_get_osdata): Change return type, adjust.
* auxv.c (struct auxv_info) <length>: Remove.
<data>: Change type to gdb::optional<byte_vector>.
(auxv_inferior_data_cleanup): Free auxv_info with delete.
(get_auxv_inferior_data): Allocate auxv_info with new, adjust.
(target_auxv_search): Adjust.
(fprint_target_auxv): Adjust.
* avr-tdep.c (avr_io_reg_read_command): Adjust.
* linux-tdep.c (linux_spu_make_corefile_notes): Adjust.
(linux_make_corefile_notes): Adjust.
* osdata.c (get_osdata): Adjust.
* remote.c (remote_get_threads_with_qxfer): Adjust.
(remote_memory_map): Adjust.
(remote_traceframe_info): Adjust.
(btrace_read_config): Adjust.
(remote_read_btrace): Adjust.
(remote_pid_to_exec_file): Adjust.
* solib-aix.c (solib_aix_get_library_list): Adjust.
* solib-dsbt.c (decode_loadmap): Don't free buf.
(dsbt_get_initial_loadmaps): Adjust.
* solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust.
* solib-target.c (solib_target_current_sos): Adjust.
* tracepoint.c (sdata_make_value): Adjust.
* xml-support.c (xinclude_start_include): Adjust.
(xml_fetch_content_from_file): Adjust.
* xml-support.h (xml_fetch_another): Change return type.
(xml_fetch_content_from_file): Change return type.
* xml-syscall.c (xml_init_syscalls_info): Adjust.
* xml-tdesc.c (file_read_description_xml): Adjust.
(fetch_available_features_from_target): Change return type.
(target_fetch_description_xml): Adjust.
(target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
|
|
|
if ((*xml)[0] == '\0')
|
2010-06-19 01:06:30 +02:00
|
|
|
{
|
|
|
|
if (type)
|
|
|
|
warning (_("Empty data returned by target. Wrong osdata type?"));
|
|
|
|
else
|
|
|
|
warning (_("Empty type list returned by target. No type data?"));
|
|
|
|
}
|
2008-12-02 16:52:15 +01:00
|
|
|
else
|
Make target_read_alloc & al return vectors
This patch started by changing target_read_alloc_1 to return a
byte_vector, to avoid manual memory management (in target_read_alloc_1
and in the callers). To communicate failures to the callers, it
actually returns a gdb::optional<gdb::byte_vector>.
Adjusting target_read_stralloc was a bit more tricky, since it wants to
return a buffer of char, and not gdb_byte. Since you can't just cast a
gdb::byte_vector into a gdb::def_vector<char>, I made
target_read_alloc_1 templated, so both versions (that return vectors of
gdb_byte and char) are generated. Since target_read_stralloc now
returns a gdb::char_vector instead of a gdb::unique_xmalloc_ptr<char>, a
few callers need to be adjusted.
gdb/ChangeLog:
* common/byte-vector.h (char_vector): New type.
* target.h (target_read_alloc): Return
gdb::optional<byte_vector>.
(target_read_stralloc): Return gdb::optional<char_vector>.
(target_get_osdata): Return gdb::optional<char_vector>.
* target.c (target_read_alloc_1): Templatize. Replacement
manual memory management with vector.
(target_read_alloc): Change return type, adjust.
(target_read_stralloc): Change return type, adjust.
(target_get_osdata): Change return type, adjust.
* auxv.c (struct auxv_info) <length>: Remove.
<data>: Change type to gdb::optional<byte_vector>.
(auxv_inferior_data_cleanup): Free auxv_info with delete.
(get_auxv_inferior_data): Allocate auxv_info with new, adjust.
(target_auxv_search): Adjust.
(fprint_target_auxv): Adjust.
* avr-tdep.c (avr_io_reg_read_command): Adjust.
* linux-tdep.c (linux_spu_make_corefile_notes): Adjust.
(linux_make_corefile_notes): Adjust.
* osdata.c (get_osdata): Adjust.
* remote.c (remote_get_threads_with_qxfer): Adjust.
(remote_memory_map): Adjust.
(remote_traceframe_info): Adjust.
(btrace_read_config): Adjust.
(remote_read_btrace): Adjust.
(remote_pid_to_exec_file): Adjust.
* solib-aix.c (solib_aix_get_library_list): Adjust.
* solib-dsbt.c (decode_loadmap): Don't free buf.
(dsbt_get_initial_loadmaps): Adjust.
* solib-svr4.c (svr4_current_sos_via_xfer_libraries): Adjust.
* solib-target.c (solib_target_current_sos): Adjust.
* tracepoint.c (sdata_make_value): Adjust.
* xml-support.c (xinclude_start_include): Adjust.
(xml_fetch_content_from_file): Adjust.
* xml-support.h (xml_fetch_another): Change return type.
(xml_fetch_content_from_file): Change return type.
* xml-syscall.c (xml_init_syscalls_info): Adjust.
* xml-tdesc.c (file_read_description_xml): Adjust.
(fetch_available_features_from_target): Change return type.
(target_fetch_description_xml): Adjust.
(target_read_description_xml): Adjust.
2018-04-07 19:19:12 +02:00
|
|
|
osdata = osdata_parse (xml->data ());
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
2008-12-02 16:52:15 +01:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
if (osdata == NULL)
|
2011-03-16 18:59:03 +01:00
|
|
|
error (_("Can not fetch data now."));
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2017-11-23 19:51:50 +01:00
|
|
|
return osdata;
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
const std::string *
|
|
|
|
get_osdata_column (const osdata_item &item, const char *name)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
for (const osdata_column &col : item.columns)
|
|
|
|
if (col.name == name)
|
|
|
|
return &col.value;
|
2008-12-02 08:57:38 +01:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-05-24 02:33:47 +02:00
|
|
|
void
|
2017-04-05 20:21:35 +02:00
|
|
|
info_osdata (const char *type)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2011-08-04 Pedro Alves <pedro@codesourcery.com>
* ui-out.h (uiout): Rename to ...
(current_uiout): ... this.
* ui-out.c (uiout): Rename to ...
(current_uiout): ... this.
* ada-lang.c (print_it_exception, print_one_exception)
(print_mention_exception): Adjust.
* breakpoint.c (watchpoint_check): Adjust.
(print_breakpoint_location, print_one_breakpoint, breakpoint_1)
(default_collect_info, watchpoints_info, print_one_catch_fork)
(print_one_catch_vfork, print_one_catch_syscall)
(print_one_catch_exec, mention, print_it_ranged_breakpoint)
(print_one_ranged_breakpoint, print_mention_ranged_breakpoint)
(print_it_watchpoint, print_mention_watchpoint)
(print_it_masked_watchpoint, print_mention_masked_watchpoint)
(print_it_exception_catchpoint, print_one_exception_catchpoint)
(print_mention_exception_catchpoint, say_where, bkpt_print_it)
(bkpt_print_mention, momentary_bkpt_print_it)
(tracepoint_print_mention, update_static_tracepoint)
(tracepoints_info, save_breakpoints): Adjust.
* cli-out.c (field_separator): Adjust.
* cp-abi.c (list_cp_abis, show_cp_abi_cmd): Adjust.
* exceptions.c (catch_exceptions_with_msg, catch_errors): Adjust.
* frame.c (get_current_frame): Adjust.
* infcmd.c (run_command_1, print_return_value): Adjust.
* inferior.c (inferior_command, info_inferiors_command): Adjust.
* infrun.c (print_end_stepping_range_reason): Adjust.
(print_signal_exited_reason, print_exited_reason): Adjust.
(print_signal_received_reason, print_no_history_reason): Adjust.
* interps.c (interp_set): Adjust.
* osdata.c (info_osdata_command): Adjust.
* progspace.c (maintenance_info_program_spaces_command): Adjust.
* remote-fileio.c (remote_fileio_request): Adjust.
* remote.c (show_remote_cmd): Adjust.
* solib.c (info_sharedlibrary_command): Adjust.
* source.c (print_source_lines_base): Adjust.
* stack.c (print_stack_frame): Adjust.
(do_gdb_disassembly, print_frame_info, print_frame): Adjust.
* symfile-mem.c (add_vsyscall_page): Adjust.
* symfile.c (load_progress, generic_load)
(print_transfer_performance): Adjust.
* thread.c (info_threads_command, restore_selected_frame)
(thread_command): Adjust.
* top.c (make_cleanup_restore_ui_file): Adjust.
* tracepoint.c (tvariables_info_1, trace_status_mi, tfind_1)
(print_one_static_tracepoint_marker): Adjust.
* cli/cli-cmds.c (print_disassembly): Adjust.
* cli/cli-decode.c (print_doc_line): Adjust.
* cli/cli-interp.c (safe_execute_command): Adjust.
* cli/cli-logging.c (set_logging_redirect, pop_output_files)
(handle_redirections): Adjust.
* cli/cli-script.c (show_user_1): Adjust.
* cli/cli-setshow.c (do_setshow_command, cmd_show_list): Adjust.
* mi/mi-cmd-break.c (breakpoint_notify): Adjust.
* mi/mi-cmd-disas.c (mi_cmd_disassemble): Adjust.
* mi/mi-cmd-env.c (mi_cmd_env_pwd, mi_cmd_env_path)
(mi_cmd_env_dir): Adjust.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file)
(print_partial_file_name, mi_cmd_file_list_exec_source_files): Adjust.
* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames)
(mi_cmd_stack_info_depth, mi_cmd_stack_list_args)
(list_args_or_locals): Adjust.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_create)
(mi_cmd_var_delete, mi_cmd_var_set_format, mi_cmd_var_set_frozen)
(mi_cmd_var_show_format, mi_cmd_var_info_num_children)
(mi_cmd_var_list_children, mi_cmd_var_info_type)
(mi_cmd_var_info_path_expression, mi_cmd_var_info_expression)
(mi_cmd_var_show_attributes, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, mi_cmd_var_update, varobj_update_one): Adjust.
* mi/mi-interp.c (mi_on_normal_stop): Adjust.
* mi/mi-main.c (mi_cmd_gdb_exit, mi_cmd_thread_select)
(mi_cmd_thread_list_ids, mi_cmd_thread_info, print_one_inferior)
(list_available_thread_groups, mi_cmd_list_thread_groups)
(mi_cmd_data_list_register_names)
(mi_cmd_data_list_changed_registers)
(mi_cmd_data_list_register_values, get_register)
(mi_cmd_data_evaluate_expression, mi_cmd_data_read_memory)
(mi_cmd_data_read_memory_bytes, mi_cmd_list_features)
(mi_cmd_list_target_features, mi_cmd_add_inferior)
(mi_execute_command, mi_load_progress): Adjust.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Adjust.
* python/py-auto-load.c (print_script, info_auto_load_scripts):
Adjust.
* python/py-breakpoint.c (bppy_get_commands): Adjust.
* tui/tui-interp.c (tui_command_loop): Adjust.
* tui/tui-io.c (tui_setup_io, tui_initialize_io): Adjust.
2011-08-04 21:10:14 +02:00
|
|
|
struct ui_out *uiout = current_uiout;
|
2011-11-21 17:54:28 +01:00
|
|
|
struct osdata_item *last = NULL;
|
|
|
|
int ncols = 0;
|
2012-06-29 01:44:26 +02:00
|
|
|
int col_to_skip = -1;
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2017-04-05 20:21:35 +02:00
|
|
|
if (type == NULL)
|
|
|
|
type = "";
|
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
std::unique_ptr<osdata> osdata = get_osdata (type);
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
int nrows = osdata->items.size ();
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2017-04-05 20:21:35 +02:00
|
|
|
if (*type == '\0' && nrows == 0)
|
2010-06-19 01:06:30 +02:00
|
|
|
error (_("Available types of OS data not reported."));
|
2011-11-21 17:54:28 +01:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
if (!osdata->items.empty ())
|
2011-11-21 17:54:28 +01:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
last = &osdata->items.back ();
|
|
|
|
ncols = last->columns.size ();
|
2012-06-29 01:44:26 +02:00
|
|
|
|
|
|
|
/* As a special case, scan the listing of available data types
|
|
|
|
for a column named "Title", and only include it with MI
|
|
|
|
output; this column's normal use is for titles for interface
|
|
|
|
elements like menus, and it clutters up CLI output. */
|
2017-04-10 18:43:44 +02:00
|
|
|
if (*type == '\0' && !uiout->is_mi_like_p ())
|
2012-06-29 01:44:26 +02:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
for (int ix = 0; ix < last->columns.size (); ix++)
|
2012-06-29 01:44:26 +02:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
if (last->columns[ix].name == "Title")
|
2012-06-29 01:44:26 +02:00
|
|
|
col_to_skip = ix;
|
|
|
|
}
|
|
|
|
/* Be sure to reduce the total column count, otherwise
|
|
|
|
internal errors ensue. */
|
|
|
|
if (col_to_skip >= 0)
|
|
|
|
--ncols;
|
|
|
|
}
|
2011-11-21 17:54:28 +01:00
|
|
|
}
|
2010-06-19 01:06:30 +02:00
|
|
|
|
2017-04-23 18:21:50 +02:00
|
|
|
ui_out_emit_table table_emitter (uiout, ncols, nrows, "OSDataTable");
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2011-11-21 17:54:28 +01:00
|
|
|
/* With no columns/items, we just output an empty table, but we
|
|
|
|
still output the table. This matters for MI. */
|
|
|
|
if (ncols == 0)
|
2017-11-22 22:12:06 +01:00
|
|
|
return;
|
2011-11-21 17:54:28 +01:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
if (last != NULL && !last->columns.empty ())
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
for (int ix = 0; ix < last->columns.size (); ix++)
|
2011-11-21 17:54:28 +01:00
|
|
|
{
|
|
|
|
char col_name[32];
|
2012-06-29 01:44:26 +02:00
|
|
|
|
|
|
|
if (ix == col_to_skip)
|
|
|
|
continue;
|
|
|
|
|
2011-11-21 17:54:28 +01:00
|
|
|
snprintf (col_name, 32, "col%d", ix);
|
Class-ify ui_out
This patch finalizes the C++ conversion of the ui-out subsystem, by
turning the ui_out and ui_out_impl structures into a single class
hierarchy. ui_out functions are turned into virtual methods of that new
class, so as a result there are a lot of call sites to update.
In the previous version of the patchset, there were separate ui_out and
ui_out_impl classes, but it wasn't really useful and added boilerplate.
In this version there is simply an ui_out base class that is
extended for CLI, TUI and MI.
It's a bit hard to maintain a ChangeLog for such a big patch, I did my
best but I'm sure there are some missing or outdated info in there...
gdb/ChangeLog:
* ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int,
ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
Remove, replace with a method in class ui_out.
(table_begin_ftype): Remove, replace with pure virtual method in
class ui_out.
(table_body_ftype): Likewise.
(table_end_ftype): Likewise.
(table_header_ftype): Likewise.
(ui_out_begin_ftype): Likewise.
(ui_out_end_ftype): Likewise.
(field_int_ftype): Likewise.
(field_skip_ftype): Likewise.
(field_string_ftype): Likewise.
(field_fmt_ftype): Likewise.
(spaces_ftype): Likewise.
(text_ftype): Likewise.
(message_ftype): Likewise.
(wrap_hint_ftype): Likewise.
(flush_ftype): Likewise.
(redirect_ftype): Likewise.
(data_destroy_ftype): Likewise.
(struct ui_out_impl): Remove, replace with class ui_out.
(ui_out_new): Remove.
(class ui_out): New class.
* ui-out.c (struct ui_out): Remove, replaced with class ui_out.
(current_level): Remove, replace with ui_out method.
(push_level): Likewise.
(pop_level): Likewise.
(uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
uo_redirect, uo_field_string): Remove.
(ui_out_table_begin): Replace with ...
(ui_out::table_begin): ... this.
(ui_out_table_body): Replace with ...
(ui_out::table_body): ... this.
(ui_out_table_end): Replace with ...
(ui_out::table_end): ... this.
(ui_out_table_header): Replace with ...
(ui_out::table_header): ... this.
(ui_out_begin): Replace with ...
(ui_out::begin): ... this.
(ui_out_end): Replace with ...
(ui_out::end): ... this.
(ui_out_field_int): Replace with ...
(ui_out::field_int): ... this.
(ui_out_field_fmt_int): Replace with ...
(ui_out::field_fmt_int): ... this.
(ui_out_field_core_addr): Replace with ...
(ui_out::field_core_addr): ... this.
(ui_out_field_stream): Replace with ...
(ui_out::field_stream): ... this.
(ui_out_field_skip): Replace with ...
(ui_out::field_skip): ... this.
(ui_out_field_string): Replace with ...
(ui_out::field_string): ... this.
(ui_out_field_fmt): Replace with ...
(ui_out::field_fmt): ... this.
(ui_out_spaces): Replace with ...
(ui_out::spaces): ... this.
(ui_out_text): Replace with ...
(ui_out::text): ... this.
(ui_out_message): Replace with ...
(ui_out::message): ... this.
(ui_out_wrap_hint): Replace with ...
(ui_out::wrap_hint): ... this.
(ui_out_flush): Replace with ...
(ui_out::flush): ... this.
(ui_out_redirect): Replace with ...
(ui_out::redirect): ... this.
(ui_out_test_flags): Replace with ...
(ui_out::test_flags): ... this.
(ui_out_is_mi_like_p): Replace with ...
(ui_out::is_mi_like_p): ... this.
(verify_field): Replace with ...
(ui_out::verify_field): ... this.
(ui_out_query_field): Replace with ...
(ui_out::query_table_field): ... this.
(ui_out_data): Remove.
(ui_out_new): Remove, replace with ...
(ui_out::ui_out): ... this constructor.
(do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
make_cleanup_ui_out_list_begin_end): Update fallouts of struct
ui_out -> class ui_out change.
* cli-out.c (cli_out_data): Remove.
(cli_uiout_dtor): Remove.
(cli_table_begin): Replace with ...
(cli_ui_out::do_table_begin): ... this new method.
(cli_table_body): Replace with ...
(cli_ui_out::do_table_body): ... this new method.
(cli_table_end): Replace with ...
(cli_ui_out::do_table_end): ... this new method.
(cli_table_header): Replace with ...
(cli_ui_out::do_table_header): ... this new method.
(cli_begin): Replace with ...
(cli_ui_out::do_begin): ... this new method.
(cli_end): Replace with ...
(cli_ui_out::do_end): ... this new method.
(cli_field_int): Replace with ...
(cli_ui_out::do_field_int): ... this new method.
(cli_field_skip): Replace with ...
(cli_ui_out::do_field_skip): ... this new method.
(cli_field_string): Replace with ...
(cli_ui_out::do_field_string): ... this new method.
(cli_field_fmt): Replace with ...
(cli_ui_out::do_field_fmt): ... this new method.
(cli_spaces): Replace with ...
(cli_ui_out::do_spaces): ... this new method.
(cli_text): Replace with ...
(cli_ui_out::do_text): ... this new method.
(cli_message): Replace with ...
(cli_ui_out::do_message): ... this new method.
(cli_wrap_hint): Replace with ...
(cli_ui_out::do_wrap_hint): ... this new method.
(cli_flush): Replace with ...
(cli_ui_out::do_flush): ... this new method.
(cli_redirect): Replace with ...
(cli_ui_out::do_redirect): ... this new method.
(out_field_fmt): Replace with ...
(cli_ui_out::out_field_fmt): ... this new method.
(field_separator): Replace with ...
(cli_ui_out::field_separator): ... this new method.
(cli_out_set_stream): Replace with ...
(cli_ui_out::set_stream): ... this new method.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_ui_out_impl::cli_ui_out_impl): New constructor.
(cli_ui_out_impl::~cli_ui_out_impl): New destructor.
(cli_out_new): Change return type to cli_ui_out *, instantiate a
cli_ui_out.
* cli-out.h (cli_ui_out_data): Remove, replace with class
cli_ui_out.
(class cli_ui_out): New class.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_out_new): Change return type to cli_ui_out*.
(cli_out_set_stream): Remove.
* cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
to cli_ui_out*.
(cli_interpreter_resume): Adapt.
(cli_interpreter_exec): Adapt.
* mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
(mi_ui_out_impl): Remove.
(mi_table_begin): Replace with ...
(mi_ui_out::do_table_begin): ... this.
(mi_table_body): Replace with ...
(mi_ui_out::do_table_body): ... this.
(mi_table_end): Replace with ...
(mi_ui_out::do_table_end): ... this.
(mi_table_header): Replace with ...
(mi_ui_out::do_table_header): ... this.
(mi_begin): Replace with ...
(mi_ui_out::do_begin): ... this.
(mi_end): Replace with ...
(mi_ui_out::do_end): ... this.
(mi_field_int): Replace with ...
(mi_ui_out::do_field_int): ... this.
(mi_field_skip): Replace with ...
(mi_ui_out::do_field_skip): ... this.
(mi_field_string): Replace with ...
(mi_ui_out::do_field_string): ... this.
(mi_field_fmt): Replace with ...
(mi_ui_out::do_field_fmt): ... this.
(mi_spaces): Replace with ...
(mi_ui_out::do_spaces): ... this.
(mi_text): Replace with ...
(mi_ui_out::do_text): ... this.
(mi_message): Replace with ...
(mi_ui_out::do_message): ... this.
(mi_wrap_hint): Replace with ...
(mi_ui_out::do_wrap_hint): ... this.
(mi_flush): Replace with ...
(mi_ui_out::do_flush): ... this.
(mi_redirect): Replace with ...
(mi_ui_out::do_redirect):
(field_separator): Replace with ...
(mi_ui_out::field_separator):
(mi_open): Replace with ...
(mi_ui_out::open): ... this.
(mi_close): Replace with ...
(mi_ui_out::close): ... this.
(mi_out_rewind): Replace with ...
(mi_ui_out::rewind): ... this.
(mi_out_put): Replace with ...
(mi_ui_out::put): ... this.
(mi_version): Replace with ...
(mi_ui_out::version): ... this.
(mi_out_data_ctor): Replace with ...
(mi_ui_out::mi_ui_out): ... this.
(mi_out_data_dtor): Replace with ...
(mi_ui_out::~mi_ui_out): ... this.
(mi_out_new): Change return type to mi_ui_out*, instantiate
an mi_ui_out object.
(as_mi_ui_out): New function.
(mi_version): Update fallouts of struct ui_out to class ui_out
transition.
(mi_out_put): Likewise.
(mi_out_rewind): Likewise.
* mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
* tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
Remove.
(tui_field_int): Replace with ...
(tui_ui_out::do_field_int): ... this.
(tui_field_string): Replace with ...
(tui_ui_out::do_field_string): ... this.
(tui_field_fmt): Replace with ...
(tui_ui_out::do_field_fmt): ... this.
(tui_text): Replace with ...
(tui_ui_out::do_text): ... this.
(tui_out_new): Change return type to tui_ui_out*, instantiate
tui_ui_out object.
(tui_ui_out::tui_ui_out): New.
* tui/tui-out.h: New file.
* tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
* tui/tui-io.c: Include tui/tui-out.h.
(tui_old_uiout): Change type to cli_ui_out*.
(tui_setup_io): Use dynamic_cast.
* tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
* tui/tui-interp.c (tui_resume): Adapt.
* ada-lang.c (print_it_exception): Update fallouts of struct
ui_out to class ui_out transition.
(print_one_exception): Likewise.
(print_mention_exception): Likewise.
* ada-tasks.c (print_ada_task_info): Likewise.
(info_task): Likewise.
(task_command): Likewise.
* auto-load.c (print_script): Likewise.
(auto_load_info_scripts): Likewise.
(info_auto_load_cmd): Likewise.
* break-catch-sig.c (signal_catchpoint_print_one): Likewise.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
(print_one_catch_syscall): Likewise.
* break-catch-throw.c (print_it_exception_catchpoint): Likewise.
(print_one_exception_catchpoint): Likewise.
(print_one_detail_exception_catchpoint): Likewise.
(print_mention_exception_catchpoint): Likewise.
* breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
(print_solib_event): Likewise.
(watchpoint_check): Likewise.
(wrap_indent_at_field): Likewise.
(print_breakpoint_location): Likewise.
(output_thread_groups): Likewise.
(print_one_breakpoint_location): Likewise.
(breakpoint_1): Likewise.
(default_collect_info): Likewise.
(watchpoints_info): Likewise.
(print_it_catch_fork): Likewise.
(print_one_catch_fork): Likewise.
(print_it_catch_vfork): Likewise.
(print_one_catch_vfork): Likewise.
(print_it_catch_solib): Likewise.
(print_one_catch_solib): Likewise.
(print_it_catch_exec): Likewise.
(print_one_catch_exec): Likewise.
(mention): Likewise.
(print_it_ranged_breakpoint): Likewise.
(print_one_ranged_breakpoint): Likewise.
(print_one_detail_ranged_breakpoint): Likewise.
(print_mention_ranged_breakpoint): Likewise.
(print_it_watchpoint): Likewise.
(print_mention_watchpoint): Likewise.
(print_it_masked_watchpoint): Likewise.
(print_one_detail_masked_watchpoint): Likewise.
(print_mention_masked_watchpoint): Likewise.
(bkpt_print_it): Likewise.
(tracepoint_print_one_detail): Likewise.
(tracepoint_print_mention): Likewise.
(update_static_tracepoint): Likewise.
(tracepoints_info): Likewise.
(save_breakpoints): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
* cli/cli-logging.c (set_logging_redirect): Likewise.
(pop_output_files): Likewise.
(handle_redirections): Likewise.
* cli/cli-script.c (print_command_lines): Likewise.
* cli/cli-setshow.c (do_show_command): Likewise.
(cmd_show_list): Likewise.
* cp-abi.c (list_cp_abis): Likewise.
(show_cp_abi_cmd): Likewise.
* darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
* disasm.c (gdb_pretty_print_insn): Likewise.
(do_mixed_source_and_assembly_deprecated): Likewise.
(do_mixed_source_and_assembly): Likewise.
* gdb_bfd.c (print_one_bfd): Likewise.
(maintenance_info_bfds): Likewise.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
* i386-tdep.c (i386_mpx_print_bounds): Likewise.
* infcmd.c (run_command_1): Likewise.
(print_return_value_1): Likewise.
* inferior.c (print_selected_inferior): Likewise.
(print_inferior): Likewise.
* infrun.c (print_end_stepping_range_reason): Likewise.
(print_signal_exited_reason): Likewise.
(print_exited_reason): Likewise.
(print_signal_received_reason): Likewise.
(print_no_history_reason): Likewise.
* interps.c (interp_set): Likewise.
* linespec.c (decode_line_full): Likewise.
* linux-thread-db.c (info_auto_load_libthread_db): Likewise.
* mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
(mi_cmd_env_path): Likewise.
(mi_cmd_env_dir): Likewise.
(mi_cmd_inferior_tty_show): Likewise.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
(print_partial_file_name): Likewise.
(mi_cmd_file_list_exec_source_files): Likewise.
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
(mi_cmd_info_gdb_mi_command): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
(mi_cmd_stack_list_args): Likewise.
(list_arg_or_local): Likewise.
* mi/mi-cmd-var.c (print_varobj): Likewise.
(mi_cmd_var_create): Likewise.
(mi_cmd_var_delete): Likewise.
(mi_cmd_var_set_format): Likewise.
(mi_cmd_var_show_format): Likewise.
(mi_cmd_var_info_num_children): Likewise.
(mi_cmd_var_list_children): Likewise.
(mi_cmd_var_info_type): Likewise.
(mi_cmd_var_info_path_expression): Likewise.
(mi_cmd_var_info_expression): Likewise.
(mi_cmd_var_show_attributes): Likewise.
(mi_cmd_var_evaluate_expression): Likewise.
(mi_cmd_var_assign): Likewise.
(varobj_update_one): Likewise.
* mi/mi-interp.c (as_mi_interp): Likewise.
(mi_on_normal_stop_1): Likewise.
(mi_tsv_modified): Likewise.
(mi_breakpoint_created): Likewise.
(mi_breakpoint_modified): Likewise.
(mi_solib_loaded): Likewise.
(mi_solib_unloaded): Likewise.
(mi_command_param_changed): Likewise.
(mi_memory_changed): Likewise.
(mi_user_selected_context_changed): Likewise.
* mi/mi-main.c (print_one_inferior): Likewise.
(output_cores): Likewise.
(list_available_thread_groups): Likewise.
(mi_cmd_data_list_register_names): Likewise.
(mi_cmd_data_list_changed_registers): Likewise.
(output_register): Likewise.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_list_features): Likewise.
(mi_cmd_list_target_features): Likewise.
(mi_cmd_add_inferior): Likewise.
(mi_execute_command): Likewise.
(mi_load_progress): Likewise.
(print_variable_or_computed): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
* osdata.c (info_osdata_command): Likewise.
* probe.c (gen_ui_out_table_header_info): Likewise.
(print_ui_out_not_applicables): Likewise.
(print_ui_out_info): Likewise.
(info_probes_for_ops): Likewise.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
* progspace.c (print_program_space): Likewise.
* python/py-breakpoint.c (bppy_get_commands): Likewise.
* python/py-framefilter.c (py_print_type): Likewise.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Likewise.
(enumerate_locals): Likewise.
(py_print_args): Likewise.
(py_print_frame): Likewise.
* record-btrace.c (btrace_ui_out_decode_error): Likewise.
(btrace_call_history_insn_range): Likewise.
(btrace_call_history_src_line): Likewise.
(btrace_call_history): Likewise.
* remote.c (show_remote_cmd): Likewise.
* skip.c (skip_info): Likewise.
* solib.c (info_sharedlibrary_command): Likewise.
* source.c (print_source_lines_base): Likewise.
* spu-tdep.c (info_spu_event_command): Likewise.
(info_spu_signal_command): Likewise.
(info_spu_mailbox_list): Likewise.
(info_spu_dma_cmdlist): Likewise.
(info_spu_dma_command): Likewise.
(info_spu_proxydma_command): Likewise.
* stack.c (print_stack_frame): Likewise.
(print_frame_arg): Likewise.
(read_frame_arg): Likewise.
(print_frame_args): Likewise.
(print_frame_info): Likewise.
(print_frame): Likewise.
* symfile.c (load_progress): Likewise.
(generic_load): Likewise.
(print_transfer_performance): Likewise.
* thread.c (do_captured_list_thread_ids): Likewise.
(print_thread_info_1): Likewise.
(restore_selected_frame): Likewise.
(do_captured_thread_select): Likewise.
(print_selected_thread_frame): Likewise.
* top.c (execute_command_to_string): Likewise.
* tracepoint.c (tvariables_info_1): Likewise.
(trace_status_mi): Likewise.
(tfind_1): Likewise.
(print_one_static_tracepoint_marker): Likewise.
(info_static_tracepoint_markers_command): Likewise.
* utils.c (do_ui_out_redirect_pop): Likewise.
(fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
|
|
|
uiout->table_header (10, ui_left,
|
2017-11-22 22:12:06 +01:00
|
|
|
col_name, last->columns[ix].name.c_str ());
|
2011-11-21 17:54:28 +01:00
|
|
|
}
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
|
Class-ify ui_out
This patch finalizes the C++ conversion of the ui-out subsystem, by
turning the ui_out and ui_out_impl structures into a single class
hierarchy. ui_out functions are turned into virtual methods of that new
class, so as a result there are a lot of call sites to update.
In the previous version of the patchset, there were separate ui_out and
ui_out_impl classes, but it wasn't really useful and added boilerplate.
In this version there is simply an ui_out base class that is
extended for CLI, TUI and MI.
It's a bit hard to maintain a ChangeLog for such a big patch, I did my
best but I'm sure there are some missing or outdated info in there...
gdb/ChangeLog:
* ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int,
ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
Remove, replace with a method in class ui_out.
(table_begin_ftype): Remove, replace with pure virtual method in
class ui_out.
(table_body_ftype): Likewise.
(table_end_ftype): Likewise.
(table_header_ftype): Likewise.
(ui_out_begin_ftype): Likewise.
(ui_out_end_ftype): Likewise.
(field_int_ftype): Likewise.
(field_skip_ftype): Likewise.
(field_string_ftype): Likewise.
(field_fmt_ftype): Likewise.
(spaces_ftype): Likewise.
(text_ftype): Likewise.
(message_ftype): Likewise.
(wrap_hint_ftype): Likewise.
(flush_ftype): Likewise.
(redirect_ftype): Likewise.
(data_destroy_ftype): Likewise.
(struct ui_out_impl): Remove, replace with class ui_out.
(ui_out_new): Remove.
(class ui_out): New class.
* ui-out.c (struct ui_out): Remove, replaced with class ui_out.
(current_level): Remove, replace with ui_out method.
(push_level): Likewise.
(pop_level): Likewise.
(uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
uo_redirect, uo_field_string): Remove.
(ui_out_table_begin): Replace with ...
(ui_out::table_begin): ... this.
(ui_out_table_body): Replace with ...
(ui_out::table_body): ... this.
(ui_out_table_end): Replace with ...
(ui_out::table_end): ... this.
(ui_out_table_header): Replace with ...
(ui_out::table_header): ... this.
(ui_out_begin): Replace with ...
(ui_out::begin): ... this.
(ui_out_end): Replace with ...
(ui_out::end): ... this.
(ui_out_field_int): Replace with ...
(ui_out::field_int): ... this.
(ui_out_field_fmt_int): Replace with ...
(ui_out::field_fmt_int): ... this.
(ui_out_field_core_addr): Replace with ...
(ui_out::field_core_addr): ... this.
(ui_out_field_stream): Replace with ...
(ui_out::field_stream): ... this.
(ui_out_field_skip): Replace with ...
(ui_out::field_skip): ... this.
(ui_out_field_string): Replace with ...
(ui_out::field_string): ... this.
(ui_out_field_fmt): Replace with ...
(ui_out::field_fmt): ... this.
(ui_out_spaces): Replace with ...
(ui_out::spaces): ... this.
(ui_out_text): Replace with ...
(ui_out::text): ... this.
(ui_out_message): Replace with ...
(ui_out::message): ... this.
(ui_out_wrap_hint): Replace with ...
(ui_out::wrap_hint): ... this.
(ui_out_flush): Replace with ...
(ui_out::flush): ... this.
(ui_out_redirect): Replace with ...
(ui_out::redirect): ... this.
(ui_out_test_flags): Replace with ...
(ui_out::test_flags): ... this.
(ui_out_is_mi_like_p): Replace with ...
(ui_out::is_mi_like_p): ... this.
(verify_field): Replace with ...
(ui_out::verify_field): ... this.
(ui_out_query_field): Replace with ...
(ui_out::query_table_field): ... this.
(ui_out_data): Remove.
(ui_out_new): Remove, replace with ...
(ui_out::ui_out): ... this constructor.
(do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
make_cleanup_ui_out_list_begin_end): Update fallouts of struct
ui_out -> class ui_out change.
* cli-out.c (cli_out_data): Remove.
(cli_uiout_dtor): Remove.
(cli_table_begin): Replace with ...
(cli_ui_out::do_table_begin): ... this new method.
(cli_table_body): Replace with ...
(cli_ui_out::do_table_body): ... this new method.
(cli_table_end): Replace with ...
(cli_ui_out::do_table_end): ... this new method.
(cli_table_header): Replace with ...
(cli_ui_out::do_table_header): ... this new method.
(cli_begin): Replace with ...
(cli_ui_out::do_begin): ... this new method.
(cli_end): Replace with ...
(cli_ui_out::do_end): ... this new method.
(cli_field_int): Replace with ...
(cli_ui_out::do_field_int): ... this new method.
(cli_field_skip): Replace with ...
(cli_ui_out::do_field_skip): ... this new method.
(cli_field_string): Replace with ...
(cli_ui_out::do_field_string): ... this new method.
(cli_field_fmt): Replace with ...
(cli_ui_out::do_field_fmt): ... this new method.
(cli_spaces): Replace with ...
(cli_ui_out::do_spaces): ... this new method.
(cli_text): Replace with ...
(cli_ui_out::do_text): ... this new method.
(cli_message): Replace with ...
(cli_ui_out::do_message): ... this new method.
(cli_wrap_hint): Replace with ...
(cli_ui_out::do_wrap_hint): ... this new method.
(cli_flush): Replace with ...
(cli_ui_out::do_flush): ... this new method.
(cli_redirect): Replace with ...
(cli_ui_out::do_redirect): ... this new method.
(out_field_fmt): Replace with ...
(cli_ui_out::out_field_fmt): ... this new method.
(field_separator): Replace with ...
(cli_ui_out::field_separator): ... this new method.
(cli_out_set_stream): Replace with ...
(cli_ui_out::set_stream): ... this new method.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_ui_out_impl::cli_ui_out_impl): New constructor.
(cli_ui_out_impl::~cli_ui_out_impl): New destructor.
(cli_out_new): Change return type to cli_ui_out *, instantiate a
cli_ui_out.
* cli-out.h (cli_ui_out_data): Remove, replace with class
cli_ui_out.
(class cli_ui_out): New class.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_out_new): Change return type to cli_ui_out*.
(cli_out_set_stream): Remove.
* cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
to cli_ui_out*.
(cli_interpreter_resume): Adapt.
(cli_interpreter_exec): Adapt.
* mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
(mi_ui_out_impl): Remove.
(mi_table_begin): Replace with ...
(mi_ui_out::do_table_begin): ... this.
(mi_table_body): Replace with ...
(mi_ui_out::do_table_body): ... this.
(mi_table_end): Replace with ...
(mi_ui_out::do_table_end): ... this.
(mi_table_header): Replace with ...
(mi_ui_out::do_table_header): ... this.
(mi_begin): Replace with ...
(mi_ui_out::do_begin): ... this.
(mi_end): Replace with ...
(mi_ui_out::do_end): ... this.
(mi_field_int): Replace with ...
(mi_ui_out::do_field_int): ... this.
(mi_field_skip): Replace with ...
(mi_ui_out::do_field_skip): ... this.
(mi_field_string): Replace with ...
(mi_ui_out::do_field_string): ... this.
(mi_field_fmt): Replace with ...
(mi_ui_out::do_field_fmt): ... this.
(mi_spaces): Replace with ...
(mi_ui_out::do_spaces): ... this.
(mi_text): Replace with ...
(mi_ui_out::do_text): ... this.
(mi_message): Replace with ...
(mi_ui_out::do_message): ... this.
(mi_wrap_hint): Replace with ...
(mi_ui_out::do_wrap_hint): ... this.
(mi_flush): Replace with ...
(mi_ui_out::do_flush): ... this.
(mi_redirect): Replace with ...
(mi_ui_out::do_redirect):
(field_separator): Replace with ...
(mi_ui_out::field_separator):
(mi_open): Replace with ...
(mi_ui_out::open): ... this.
(mi_close): Replace with ...
(mi_ui_out::close): ... this.
(mi_out_rewind): Replace with ...
(mi_ui_out::rewind): ... this.
(mi_out_put): Replace with ...
(mi_ui_out::put): ... this.
(mi_version): Replace with ...
(mi_ui_out::version): ... this.
(mi_out_data_ctor): Replace with ...
(mi_ui_out::mi_ui_out): ... this.
(mi_out_data_dtor): Replace with ...
(mi_ui_out::~mi_ui_out): ... this.
(mi_out_new): Change return type to mi_ui_out*, instantiate
an mi_ui_out object.
(as_mi_ui_out): New function.
(mi_version): Update fallouts of struct ui_out to class ui_out
transition.
(mi_out_put): Likewise.
(mi_out_rewind): Likewise.
* mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
* tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
Remove.
(tui_field_int): Replace with ...
(tui_ui_out::do_field_int): ... this.
(tui_field_string): Replace with ...
(tui_ui_out::do_field_string): ... this.
(tui_field_fmt): Replace with ...
(tui_ui_out::do_field_fmt): ... this.
(tui_text): Replace with ...
(tui_ui_out::do_text): ... this.
(tui_out_new): Change return type to tui_ui_out*, instantiate
tui_ui_out object.
(tui_ui_out::tui_ui_out): New.
* tui/tui-out.h: New file.
* tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
* tui/tui-io.c: Include tui/tui-out.h.
(tui_old_uiout): Change type to cli_ui_out*.
(tui_setup_io): Use dynamic_cast.
* tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
* tui/tui-interp.c (tui_resume): Adapt.
* ada-lang.c (print_it_exception): Update fallouts of struct
ui_out to class ui_out transition.
(print_one_exception): Likewise.
(print_mention_exception): Likewise.
* ada-tasks.c (print_ada_task_info): Likewise.
(info_task): Likewise.
(task_command): Likewise.
* auto-load.c (print_script): Likewise.
(auto_load_info_scripts): Likewise.
(info_auto_load_cmd): Likewise.
* break-catch-sig.c (signal_catchpoint_print_one): Likewise.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
(print_one_catch_syscall): Likewise.
* break-catch-throw.c (print_it_exception_catchpoint): Likewise.
(print_one_exception_catchpoint): Likewise.
(print_one_detail_exception_catchpoint): Likewise.
(print_mention_exception_catchpoint): Likewise.
* breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
(print_solib_event): Likewise.
(watchpoint_check): Likewise.
(wrap_indent_at_field): Likewise.
(print_breakpoint_location): Likewise.
(output_thread_groups): Likewise.
(print_one_breakpoint_location): Likewise.
(breakpoint_1): Likewise.
(default_collect_info): Likewise.
(watchpoints_info): Likewise.
(print_it_catch_fork): Likewise.
(print_one_catch_fork): Likewise.
(print_it_catch_vfork): Likewise.
(print_one_catch_vfork): Likewise.
(print_it_catch_solib): Likewise.
(print_one_catch_solib): Likewise.
(print_it_catch_exec): Likewise.
(print_one_catch_exec): Likewise.
(mention): Likewise.
(print_it_ranged_breakpoint): Likewise.
(print_one_ranged_breakpoint): Likewise.
(print_one_detail_ranged_breakpoint): Likewise.
(print_mention_ranged_breakpoint): Likewise.
(print_it_watchpoint): Likewise.
(print_mention_watchpoint): Likewise.
(print_it_masked_watchpoint): Likewise.
(print_one_detail_masked_watchpoint): Likewise.
(print_mention_masked_watchpoint): Likewise.
(bkpt_print_it): Likewise.
(tracepoint_print_one_detail): Likewise.
(tracepoint_print_mention): Likewise.
(update_static_tracepoint): Likewise.
(tracepoints_info): Likewise.
(save_breakpoints): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
* cli/cli-logging.c (set_logging_redirect): Likewise.
(pop_output_files): Likewise.
(handle_redirections): Likewise.
* cli/cli-script.c (print_command_lines): Likewise.
* cli/cli-setshow.c (do_show_command): Likewise.
(cmd_show_list): Likewise.
* cp-abi.c (list_cp_abis): Likewise.
(show_cp_abi_cmd): Likewise.
* darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
* disasm.c (gdb_pretty_print_insn): Likewise.
(do_mixed_source_and_assembly_deprecated): Likewise.
(do_mixed_source_and_assembly): Likewise.
* gdb_bfd.c (print_one_bfd): Likewise.
(maintenance_info_bfds): Likewise.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
* i386-tdep.c (i386_mpx_print_bounds): Likewise.
* infcmd.c (run_command_1): Likewise.
(print_return_value_1): Likewise.
* inferior.c (print_selected_inferior): Likewise.
(print_inferior): Likewise.
* infrun.c (print_end_stepping_range_reason): Likewise.
(print_signal_exited_reason): Likewise.
(print_exited_reason): Likewise.
(print_signal_received_reason): Likewise.
(print_no_history_reason): Likewise.
* interps.c (interp_set): Likewise.
* linespec.c (decode_line_full): Likewise.
* linux-thread-db.c (info_auto_load_libthread_db): Likewise.
* mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
(mi_cmd_env_path): Likewise.
(mi_cmd_env_dir): Likewise.
(mi_cmd_inferior_tty_show): Likewise.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
(print_partial_file_name): Likewise.
(mi_cmd_file_list_exec_source_files): Likewise.
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
(mi_cmd_info_gdb_mi_command): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
(mi_cmd_stack_list_args): Likewise.
(list_arg_or_local): Likewise.
* mi/mi-cmd-var.c (print_varobj): Likewise.
(mi_cmd_var_create): Likewise.
(mi_cmd_var_delete): Likewise.
(mi_cmd_var_set_format): Likewise.
(mi_cmd_var_show_format): Likewise.
(mi_cmd_var_info_num_children): Likewise.
(mi_cmd_var_list_children): Likewise.
(mi_cmd_var_info_type): Likewise.
(mi_cmd_var_info_path_expression): Likewise.
(mi_cmd_var_info_expression): Likewise.
(mi_cmd_var_show_attributes): Likewise.
(mi_cmd_var_evaluate_expression): Likewise.
(mi_cmd_var_assign): Likewise.
(varobj_update_one): Likewise.
* mi/mi-interp.c (as_mi_interp): Likewise.
(mi_on_normal_stop_1): Likewise.
(mi_tsv_modified): Likewise.
(mi_breakpoint_created): Likewise.
(mi_breakpoint_modified): Likewise.
(mi_solib_loaded): Likewise.
(mi_solib_unloaded): Likewise.
(mi_command_param_changed): Likewise.
(mi_memory_changed): Likewise.
(mi_user_selected_context_changed): Likewise.
* mi/mi-main.c (print_one_inferior): Likewise.
(output_cores): Likewise.
(list_available_thread_groups): Likewise.
(mi_cmd_data_list_register_names): Likewise.
(mi_cmd_data_list_changed_registers): Likewise.
(output_register): Likewise.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_list_features): Likewise.
(mi_cmd_list_target_features): Likewise.
(mi_cmd_add_inferior): Likewise.
(mi_execute_command): Likewise.
(mi_load_progress): Likewise.
(print_variable_or_computed): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
* osdata.c (info_osdata_command): Likewise.
* probe.c (gen_ui_out_table_header_info): Likewise.
(print_ui_out_not_applicables): Likewise.
(print_ui_out_info): Likewise.
(info_probes_for_ops): Likewise.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
* progspace.c (print_program_space): Likewise.
* python/py-breakpoint.c (bppy_get_commands): Likewise.
* python/py-framefilter.c (py_print_type): Likewise.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Likewise.
(enumerate_locals): Likewise.
(py_print_args): Likewise.
(py_print_frame): Likewise.
* record-btrace.c (btrace_ui_out_decode_error): Likewise.
(btrace_call_history_insn_range): Likewise.
(btrace_call_history_src_line): Likewise.
(btrace_call_history): Likewise.
* remote.c (show_remote_cmd): Likewise.
* skip.c (skip_info): Likewise.
* solib.c (info_sharedlibrary_command): Likewise.
* source.c (print_source_lines_base): Likewise.
* spu-tdep.c (info_spu_event_command): Likewise.
(info_spu_signal_command): Likewise.
(info_spu_mailbox_list): Likewise.
(info_spu_dma_cmdlist): Likewise.
(info_spu_dma_command): Likewise.
(info_spu_proxydma_command): Likewise.
* stack.c (print_stack_frame): Likewise.
(print_frame_arg): Likewise.
(read_frame_arg): Likewise.
(print_frame_args): Likewise.
(print_frame_info): Likewise.
(print_frame): Likewise.
* symfile.c (load_progress): Likewise.
(generic_load): Likewise.
(print_transfer_performance): Likewise.
* thread.c (do_captured_list_thread_ids): Likewise.
(print_thread_info_1): Likewise.
(restore_selected_frame): Likewise.
(do_captured_thread_select): Likewise.
(print_selected_thread_frame): Likewise.
* top.c (execute_command_to_string): Likewise.
* tracepoint.c (tvariables_info_1): Likewise.
(trace_status_mi): Likewise.
(tfind_1): Likewise.
(print_one_static_tracepoint_marker): Likewise.
(info_static_tracepoint_markers_command): Likewise.
* utils.c (do_ui_out_redirect_pop): Likewise.
(fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
|
|
|
uiout->table_body ();
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2011-11-21 17:54:28 +01:00
|
|
|
if (nrows != 0)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2017-11-22 22:12:06 +01:00
|
|
|
for (const osdata_item &item : osdata->items)
|
2008-12-02 08:57:38 +01:00
|
|
|
{
|
2017-04-12 16:23:08 +02:00
|
|
|
{
|
|
|
|
ui_out_emit_tuple tuple_emitter (uiout, "item");
|
2008-12-02 08:57:38 +01:00
|
|
|
|
2017-11-22 22:12:06 +01:00
|
|
|
for (int ix_cols = 0; ix_cols < item.columns.size (); ix_cols++)
|
2017-04-12 16:23:08 +02:00
|
|
|
{
|
|
|
|
char col_name[32];
|
2012-06-29 01:44:26 +02:00
|
|
|
|
2017-04-12 16:23:08 +02:00
|
|
|
if (ix_cols == col_to_skip)
|
|
|
|
continue;
|
2012-06-29 01:44:26 +02:00
|
|
|
|
2017-04-12 16:23:08 +02:00
|
|
|
snprintf (col_name, 32, "col%d", ix_cols);
|
2017-11-22 22:12:06 +01:00
|
|
|
uiout->field_string (col_name,
|
|
|
|
item.columns[ix_cols].value.c_str ());
|
2017-04-12 16:23:08 +02:00
|
|
|
}
|
|
|
|
}
|
2008-12-02 08:57:38 +01:00
|
|
|
|
Class-ify ui_out
This patch finalizes the C++ conversion of the ui-out subsystem, by
turning the ui_out and ui_out_impl structures into a single class
hierarchy. ui_out functions are turned into virtual methods of that new
class, so as a result there are a lot of call sites to update.
In the previous version of the patchset, there were separate ui_out and
ui_out_impl classes, but it wasn't really useful and added boilerplate.
In this version there is simply an ui_out base class that is
extended for CLI, TUI and MI.
It's a bit hard to maintain a ChangeLog for such a big patch, I did my
best but I'm sure there are some missing or outdated info in there...
gdb/ChangeLog:
* ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header,
ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int,
ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream,
ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text,
ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags,
ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect):
Remove, replace with a method in class ui_out.
(table_begin_ftype): Remove, replace with pure virtual method in
class ui_out.
(table_body_ftype): Likewise.
(table_end_ftype): Likewise.
(table_header_ftype): Likewise.
(ui_out_begin_ftype): Likewise.
(ui_out_end_ftype): Likewise.
(field_int_ftype): Likewise.
(field_skip_ftype): Likewise.
(field_string_ftype): Likewise.
(field_fmt_ftype): Likewise.
(spaces_ftype): Likewise.
(text_ftype): Likewise.
(message_ftype): Likewise.
(wrap_hint_ftype): Likewise.
(flush_ftype): Likewise.
(redirect_ftype): Likewise.
(data_destroy_ftype): Likewise.
(struct ui_out_impl): Remove, replace with class ui_out.
(ui_out_new): Remove.
(class ui_out): New class.
* ui-out.c (struct ui_out): Remove, replaced with class ui_out.
(current_level): Remove, replace with ui_out method.
(push_level): Likewise.
(pop_level): Likewise.
(uo_table_begin, uo_table_body, uo_table_end, uo_table_header,
uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt,
uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush,
uo_redirect, uo_field_string): Remove.
(ui_out_table_begin): Replace with ...
(ui_out::table_begin): ... this.
(ui_out_table_body): Replace with ...
(ui_out::table_body): ... this.
(ui_out_table_end): Replace with ...
(ui_out::table_end): ... this.
(ui_out_table_header): Replace with ...
(ui_out::table_header): ... this.
(ui_out_begin): Replace with ...
(ui_out::begin): ... this.
(ui_out_end): Replace with ...
(ui_out::end): ... this.
(ui_out_field_int): Replace with ...
(ui_out::field_int): ... this.
(ui_out_field_fmt_int): Replace with ...
(ui_out::field_fmt_int): ... this.
(ui_out_field_core_addr): Replace with ...
(ui_out::field_core_addr): ... this.
(ui_out_field_stream): Replace with ...
(ui_out::field_stream): ... this.
(ui_out_field_skip): Replace with ...
(ui_out::field_skip): ... this.
(ui_out_field_string): Replace with ...
(ui_out::field_string): ... this.
(ui_out_field_fmt): Replace with ...
(ui_out::field_fmt): ... this.
(ui_out_spaces): Replace with ...
(ui_out::spaces): ... this.
(ui_out_text): Replace with ...
(ui_out::text): ... this.
(ui_out_message): Replace with ...
(ui_out::message): ... this.
(ui_out_wrap_hint): Replace with ...
(ui_out::wrap_hint): ... this.
(ui_out_flush): Replace with ...
(ui_out::flush): ... this.
(ui_out_redirect): Replace with ...
(ui_out::redirect): ... this.
(ui_out_test_flags): Replace with ...
(ui_out::test_flags): ... this.
(ui_out_is_mi_like_p): Replace with ...
(ui_out::is_mi_like_p): ... this.
(verify_field): Replace with ...
(ui_out::verify_field): ... this.
(ui_out_query_field): Replace with ...
(ui_out::query_table_field): ... this.
(ui_out_data): Remove.
(ui_out_new): Remove, replace with ...
(ui_out::ui_out): ... this constructor.
(do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end,
do_cleanup_end, make_cleanup_ui_out_tuple_begin_end,
make_cleanup_ui_out_list_begin_end): Update fallouts of struct
ui_out -> class ui_out change.
* cli-out.c (cli_out_data): Remove.
(cli_uiout_dtor): Remove.
(cli_table_begin): Replace with ...
(cli_ui_out::do_table_begin): ... this new method.
(cli_table_body): Replace with ...
(cli_ui_out::do_table_body): ... this new method.
(cli_table_end): Replace with ...
(cli_ui_out::do_table_end): ... this new method.
(cli_table_header): Replace with ...
(cli_ui_out::do_table_header): ... this new method.
(cli_begin): Replace with ...
(cli_ui_out::do_begin): ... this new method.
(cli_end): Replace with ...
(cli_ui_out::do_end): ... this new method.
(cli_field_int): Replace with ...
(cli_ui_out::do_field_int): ... this new method.
(cli_field_skip): Replace with ...
(cli_ui_out::do_field_skip): ... this new method.
(cli_field_string): Replace with ...
(cli_ui_out::do_field_string): ... this new method.
(cli_field_fmt): Replace with ...
(cli_ui_out::do_field_fmt): ... this new method.
(cli_spaces): Replace with ...
(cli_ui_out::do_spaces): ... this new method.
(cli_text): Replace with ...
(cli_ui_out::do_text): ... this new method.
(cli_message): Replace with ...
(cli_ui_out::do_message): ... this new method.
(cli_wrap_hint): Replace with ...
(cli_ui_out::do_wrap_hint): ... this new method.
(cli_flush): Replace with ...
(cli_ui_out::do_flush): ... this new method.
(cli_redirect): Replace with ...
(cli_ui_out::do_redirect): ... this new method.
(out_field_fmt): Replace with ...
(cli_ui_out::out_field_fmt): ... this new method.
(field_separator): Replace with ...
(cli_ui_out::field_separator): ... this new method.
(cli_out_set_stream): Replace with ...
(cli_ui_out::set_stream): ... this new method.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_ui_out_impl::cli_ui_out_impl): New constructor.
(cli_ui_out_impl::~cli_ui_out_impl): New destructor.
(cli_out_new): Change return type to cli_ui_out *, instantiate a
cli_ui_out.
* cli-out.h (cli_ui_out_data): Remove, replace with class
cli_ui_out.
(class cli_ui_out): New class.
(cli_ui_out_impl): Remove.
(cli_out_data_ctor): Remove.
(cli_out_new): Change return type to cli_ui_out*.
(cli_out_set_stream): Remove.
* cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type
to cli_ui_out*.
(cli_interpreter_resume): Adapt.
(cli_interpreter_exec): Adapt.
* mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove.
(mi_ui_out_impl): Remove.
(mi_table_begin): Replace with ...
(mi_ui_out::do_table_begin): ... this.
(mi_table_body): Replace with ...
(mi_ui_out::do_table_body): ... this.
(mi_table_end): Replace with ...
(mi_ui_out::do_table_end): ... this.
(mi_table_header): Replace with ...
(mi_ui_out::do_table_header): ... this.
(mi_begin): Replace with ...
(mi_ui_out::do_begin): ... this.
(mi_end): Replace with ...
(mi_ui_out::do_end): ... this.
(mi_field_int): Replace with ...
(mi_ui_out::do_field_int): ... this.
(mi_field_skip): Replace with ...
(mi_ui_out::do_field_skip): ... this.
(mi_field_string): Replace with ...
(mi_ui_out::do_field_string): ... this.
(mi_field_fmt): Replace with ...
(mi_ui_out::do_field_fmt): ... this.
(mi_spaces): Replace with ...
(mi_ui_out::do_spaces): ... this.
(mi_text): Replace with ...
(mi_ui_out::do_text): ... this.
(mi_message): Replace with ...
(mi_ui_out::do_message): ... this.
(mi_wrap_hint): Replace with ...
(mi_ui_out::do_wrap_hint): ... this.
(mi_flush): Replace with ...
(mi_ui_out::do_flush): ... this.
(mi_redirect): Replace with ...
(mi_ui_out::do_redirect):
(field_separator): Replace with ...
(mi_ui_out::field_separator):
(mi_open): Replace with ...
(mi_ui_out::open): ... this.
(mi_close): Replace with ...
(mi_ui_out::close): ... this.
(mi_out_rewind): Replace with ...
(mi_ui_out::rewind): ... this.
(mi_out_put): Replace with ...
(mi_ui_out::put): ... this.
(mi_version): Replace with ...
(mi_ui_out::version): ... this.
(mi_out_data_ctor): Replace with ...
(mi_ui_out::mi_ui_out): ... this.
(mi_out_data_dtor): Replace with ...
(mi_ui_out::~mi_ui_out): ... this.
(mi_out_new): Change return type to mi_ui_out*, instantiate
an mi_ui_out object.
(as_mi_ui_out): New function.
(mi_version): Update fallouts of struct ui_out to class ui_out
transition.
(mi_out_put): Likewise.
(mi_out_rewind): Likewise.
* mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*.
* tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl):
Remove.
(tui_field_int): Replace with ...
(tui_ui_out::do_field_int): ... this.
(tui_field_string): Replace with ...
(tui_ui_out::do_field_string): ... this.
(tui_field_fmt): Replace with ...
(tui_ui_out::do_field_fmt): ... this.
(tui_text): Replace with ...
(tui_ui_out::do_text): ... this.
(tui_out_new): Change return type to tui_ui_out*, instantiate
tui_ui_out object.
(tui_ui_out::tui_ui_out): New.
* tui/tui-out.h: New file.
* tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h.
* tui/tui-io.c: Include tui/tui-out.h.
(tui_old_uiout): Change type to cli_ui_out*.
(tui_setup_io): Use dynamic_cast.
* tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*.
* tui/tui-interp.c (tui_resume): Adapt.
* ada-lang.c (print_it_exception): Update fallouts of struct
ui_out to class ui_out transition.
(print_one_exception): Likewise.
(print_mention_exception): Likewise.
* ada-tasks.c (print_ada_task_info): Likewise.
(info_task): Likewise.
(task_command): Likewise.
* auto-load.c (print_script): Likewise.
(auto_load_info_scripts): Likewise.
(info_auto_load_cmd): Likewise.
* break-catch-sig.c (signal_catchpoint_print_one): Likewise.
* break-catch-syscall.c (print_it_catch_syscall): Likewise.
(print_one_catch_syscall): Likewise.
* break-catch-throw.c (print_it_exception_catchpoint): Likewise.
(print_one_exception_catchpoint): Likewise.
(print_one_detail_exception_catchpoint): Likewise.
(print_mention_exception_catchpoint): Likewise.
* breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise.
(print_solib_event): Likewise.
(watchpoint_check): Likewise.
(wrap_indent_at_field): Likewise.
(print_breakpoint_location): Likewise.
(output_thread_groups): Likewise.
(print_one_breakpoint_location): Likewise.
(breakpoint_1): Likewise.
(default_collect_info): Likewise.
(watchpoints_info): Likewise.
(print_it_catch_fork): Likewise.
(print_one_catch_fork): Likewise.
(print_it_catch_vfork): Likewise.
(print_one_catch_vfork): Likewise.
(print_it_catch_solib): Likewise.
(print_one_catch_solib): Likewise.
(print_it_catch_exec): Likewise.
(print_one_catch_exec): Likewise.
(mention): Likewise.
(print_it_ranged_breakpoint): Likewise.
(print_one_ranged_breakpoint): Likewise.
(print_one_detail_ranged_breakpoint): Likewise.
(print_mention_ranged_breakpoint): Likewise.
(print_it_watchpoint): Likewise.
(print_mention_watchpoint): Likewise.
(print_it_masked_watchpoint): Likewise.
(print_one_detail_masked_watchpoint): Likewise.
(print_mention_masked_watchpoint): Likewise.
(bkpt_print_it): Likewise.
(tracepoint_print_one_detail): Likewise.
(tracepoint_print_mention): Likewise.
(update_static_tracepoint): Likewise.
(tracepoints_info): Likewise.
(save_breakpoints): Likewise.
* cli/cli-cmds.c (complete_command): Likewise.
* cli/cli-logging.c (set_logging_redirect): Likewise.
(pop_output_files): Likewise.
(handle_redirections): Likewise.
* cli/cli-script.c (print_command_lines): Likewise.
* cli/cli-setshow.c (do_show_command): Likewise.
(cmd_show_list): Likewise.
* cp-abi.c (list_cp_abis): Likewise.
(show_cp_abi_cmd): Likewise.
* darwin-nat-info.c (darwin_debug_regions_recurse): Likewise.
* disasm.c (gdb_pretty_print_insn): Likewise.
(do_mixed_source_and_assembly_deprecated): Likewise.
(do_mixed_source_and_assembly): Likewise.
* gdb_bfd.c (print_one_bfd): Likewise.
(maintenance_info_bfds): Likewise.
* guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise.
* guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
* i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise.
* i386-tdep.c (i386_mpx_print_bounds): Likewise.
* infcmd.c (run_command_1): Likewise.
(print_return_value_1): Likewise.
* inferior.c (print_selected_inferior): Likewise.
(print_inferior): Likewise.
* infrun.c (print_end_stepping_range_reason): Likewise.
(print_signal_exited_reason): Likewise.
(print_exited_reason): Likewise.
(print_signal_received_reason): Likewise.
(print_no_history_reason): Likewise.
* interps.c (interp_set): Likewise.
* linespec.c (decode_line_full): Likewise.
* linux-thread-db.c (info_auto_load_libthread_db): Likewise.
* mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise.
(mi_cmd_env_path): Likewise.
(mi_cmd_env_dir): Likewise.
(mi_cmd_inferior_tty_show): Likewise.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise.
(print_partial_file_name): Likewise.
(mi_cmd_file_list_exec_source_files): Likewise.
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise.
(mi_cmd_info_gdb_mi_command): Likewise.
* mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise.
(mi_cmd_stack_list_args): Likewise.
(list_arg_or_local): Likewise.
* mi/mi-cmd-var.c (print_varobj): Likewise.
(mi_cmd_var_create): Likewise.
(mi_cmd_var_delete): Likewise.
(mi_cmd_var_set_format): Likewise.
(mi_cmd_var_show_format): Likewise.
(mi_cmd_var_info_num_children): Likewise.
(mi_cmd_var_list_children): Likewise.
(mi_cmd_var_info_type): Likewise.
(mi_cmd_var_info_path_expression): Likewise.
(mi_cmd_var_info_expression): Likewise.
(mi_cmd_var_show_attributes): Likewise.
(mi_cmd_var_evaluate_expression): Likewise.
(mi_cmd_var_assign): Likewise.
(varobj_update_one): Likewise.
* mi/mi-interp.c (as_mi_interp): Likewise.
(mi_on_normal_stop_1): Likewise.
(mi_tsv_modified): Likewise.
(mi_breakpoint_created): Likewise.
(mi_breakpoint_modified): Likewise.
(mi_solib_loaded): Likewise.
(mi_solib_unloaded): Likewise.
(mi_command_param_changed): Likewise.
(mi_memory_changed): Likewise.
(mi_user_selected_context_changed): Likewise.
* mi/mi-main.c (print_one_inferior): Likewise.
(output_cores): Likewise.
(list_available_thread_groups): Likewise.
(mi_cmd_data_list_register_names): Likewise.
(mi_cmd_data_list_changed_registers): Likewise.
(output_register): Likewise.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Likewise.
(mi_cmd_data_read_memory_bytes): Likewise.
(mi_cmd_list_features): Likewise.
(mi_cmd_list_target_features): Likewise.
(mi_cmd_add_inferior): Likewise.
(mi_execute_command): Likewise.
(mi_load_progress): Likewise.
(print_variable_or_computed): Likewise.
(mi_cmd_trace_frame_collected): Likewise.
* mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise.
* osdata.c (info_osdata_command): Likewise.
* probe.c (gen_ui_out_table_header_info): Likewise.
(print_ui_out_not_applicables): Likewise.
(print_ui_out_info): Likewise.
(info_probes_for_ops): Likewise.
(enable_probes_command): Likewise.
(disable_probes_command): Likewise.
* progspace.c (print_program_space): Likewise.
* python/py-breakpoint.c (bppy_get_commands): Likewise.
* python/py-framefilter.c (py_print_type): Likewise.
(py_print_value): Likewise.
(py_print_single_arg): Likewise.
(enumerate_args): Likewise.
(enumerate_locals): Likewise.
(py_print_args): Likewise.
(py_print_frame): Likewise.
* record-btrace.c (btrace_ui_out_decode_error): Likewise.
(btrace_call_history_insn_range): Likewise.
(btrace_call_history_src_line): Likewise.
(btrace_call_history): Likewise.
* remote.c (show_remote_cmd): Likewise.
* skip.c (skip_info): Likewise.
* solib.c (info_sharedlibrary_command): Likewise.
* source.c (print_source_lines_base): Likewise.
* spu-tdep.c (info_spu_event_command): Likewise.
(info_spu_signal_command): Likewise.
(info_spu_mailbox_list): Likewise.
(info_spu_dma_cmdlist): Likewise.
(info_spu_dma_command): Likewise.
(info_spu_proxydma_command): Likewise.
* stack.c (print_stack_frame): Likewise.
(print_frame_arg): Likewise.
(read_frame_arg): Likewise.
(print_frame_args): Likewise.
(print_frame_info): Likewise.
(print_frame): Likewise.
* symfile.c (load_progress): Likewise.
(generic_load): Likewise.
(print_transfer_performance): Likewise.
* thread.c (do_captured_list_thread_ids): Likewise.
(print_thread_info_1): Likewise.
(restore_selected_frame): Likewise.
(do_captured_thread_select): Likewise.
(print_selected_thread_frame): Likewise.
* top.c (execute_command_to_string): Likewise.
* tracepoint.c (tvariables_info_1): Likewise.
(trace_status_mi): Likewise.
(tfind_1): Likewise.
(print_one_static_tracepoint_marker): Likewise.
(info_static_tracepoint_markers_command): Likewise.
* utils.c (do_ui_out_redirect_pop): Likewise.
(fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
|
|
|
uiout->text ("\n");
|
2008-12-02 08:57:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-05 20:21:35 +02:00
|
|
|
static void
|
Constify add_info
This patch constifies add_info and updates all the info commands. The
bulk of this patch was written using a script; and then I did a manual
pass to fix up the remaining compilation errors.
I could not compile every changed file; in particular nto-procfs.c,
gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the
correctness by inspection.
gdb/ChangeLog
2017-11-07 Tom Tromey <tom@tromey.com>
* frame.h (info_locals_command, info_args_command): Constify.
* auto-load.h (auto_load_info_scripts): Constify.
* inferior.h (registers_info): Constify.
* copying.c: Rebuild.
* copying.awk: Constify generated commands.
* auto-load.c (auto_load_info_scripts)
(info_auto_load_gdb_scripts): Constify.
* cli/cli-decode.c (struct cmd_list_element): Take a
cmd_const_cfunc_ftype.
* command.h (add_info): Take a cmd_const_cfunc_ftype.
* tui/tui-win.c (tui_all_windows_info): Constify.
* python/py-auto-load.c (info_auto_load_python_scripts):
Constify.
* cli/cli-cmds.c (show_command): Remove non-const overload.
* tracepoint.c (info_tvariables_command, info_scope_command):
Constify.
(info_static_tracepoint_markers_command): Constify.
* thread.c (info_threads_command): Constify.
(print_thread_info_1): Constify.
* target.c (info_target_command): Constify.
* symtab.c (info_sources_command, info_functions_command)
(info_types_command): Constify.
(info_variables_command): Remove non-const overload.
* symfile.c (info_ext_lang_command): Constify.
* stack.c (info_frame_command, info_locals_command)
(info_args_command): Constify.
(backtrace_command): Remove non-const overload.
* source.c (info_source_command, info_line_command): Constify.
* solib.c (info_sharedlibrary_command): Constify.
* skip.c (info_skip_command): Constify.
* ser-go32.c (info_serial_command): Constify.
* reverse.c (info_bookmarks_command): Constify.
* printcmd.c (info_symbol_command, info_address_command)
(info_display_command): Constify.
* osdata.c (info_osdata_command): Constify.
* objc-lang.c (info_selectors_command, info_classes_command):
Constify.
* nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify.
* memattr.c (info_mem_command): Constify.
* macrocmd.c (info_macro_command, info_macros_command): Constify.
* linux-fork.c (info_checkpoints_command): Constify.
* infrun.c (info_signals_command): Constify.
* inflow.c (info_terminal_command): Constify.
* inferior.c (info_inferiors_command): Constify.
(print_inferior): Constify.
* infcmd.c (info_program_command, info_all_registers_command)
(info_registers_command, info_vector_command)
(info_float_command): Constify.
(registers_info): Constify.
* gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd)
(info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd):
Constify.
* f-valprint.c (info_common_command): Constify.
* dcache.c (info_dcache_command): Constify.
(dcache_info_1): Constify.
* darwin-nat-info.c (info_mach_tasks_command)
(info_mach_task_command, info_mach_ports_command)
(info_mach_port_command, info_mach_threads_command)
(info_mach_thread_command, info_mach_regions_command)
(info_mach_regions_recurse_command, info_mach_region_command)
(info_mach_exceptions_command): Constify.
(get_task_from_args): Constify.
* cp-support.c (info_vtbl_command): Constify.
* breakpoint.c (info_watchpoints_command)
(info_tracepoints_command): Constify.
(info_breakpoints_command): Remove non-const overload.
* avr-tdep.c (avr_io_reg_read_command): Constify.
* auxv.c (info_auxv_command): Constify.
* ada-tasks.c (info_tasks_command): Constify.
(info_task): Constify.
* ada-lang.c (info_exceptions_command): Constify.
2017-10-14 06:07:26 +02:00
|
|
|
info_osdata_command (const char *arg, int from_tty)
|
2017-04-05 20:21:35 +02:00
|
|
|
{
|
|
|
|
info_osdata (arg);
|
|
|
|
}
|
|
|
|
|
2008-12-02 08:57:38 +01:00
|
|
|
void
|
|
|
|
_initialize_osdata (void)
|
|
|
|
{
|
|
|
|
add_info ("os", info_osdata_command,
|
|
|
|
_("Show OS data ARG."));
|
|
|
|
}
|