2002-09-14 04:09:39 +02:00
|
|
|
/* Helper routines for C++ support in GDB.
|
2017-01-01 07:50:51 +01:00
|
|
|
Copyright (C) 2002-2017 Free Software Foundation, Inc.
|
2002-09-14 04:09:39 +02:00
|
|
|
|
|
|
|
Contributed by MontaVista Software.
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
Namespace support contributed by David Carlton.
|
2002-09-14 04:09:39 +02: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
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-09-14 04:09:39 +02:00
|
|
|
(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
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2002-09-14 04:09:39 +02:00
|
|
|
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
#ifndef CP_SUPPORT_H
|
|
|
|
#define CP_SUPPORT_H
|
|
|
|
|
2003-05-20 05:56:29 +02:00
|
|
|
/* We need this for 'domain_enum', alas... */
|
|
|
|
|
|
|
|
#include "symtab.h"
|
gdb/
Fix non-only rename list for Fortran modules import.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Adjust the
cp_add_using_directive caller.
(cp_add_using_directive): New parameter excludes, describe it. New
variables ix and param. Compare if also excludes match. Allocate NEW
with variable size, initialize EXCLUDES there.
(cp_lookup_symbol_imports): New variable excludep, test
current->EXCLUDES with it.
* cp-support.h: Include vec.h.
(struct using_direct): New field excludes, describe it.
(DEF_VEC_P (const_char_ptr)): New.
(cp_add_using_directive): New parameter excludes.
* defs.h (const_char_ptr): New typedef.
* dwarf2read.c (read_import_statement): New variables child_die,
excludes and cleanups, read in excludes.
(read_namespace): Adjust the cp_add_using_directive caller.
gdb/testsuite/
Fix non-only rename list for Fortran modules import.
* gdb.fortran/module.exp (print var_x, print var_y, print var_z): New
tests.
* gdb.fortran/module.f90 (module moduse): New.
(program module): use moduse, test var_x, var_y and var_z.
2011-06-30 00:05:16 +02:00
|
|
|
#include "vec.h"
|
2012-04-20 18:57:17 +02:00
|
|
|
#include "gdb_vecs.h"
|
2011-08-18 18:17:39 +02:00
|
|
|
#include "gdb_obstack.h"
|
gdb/
Fix non-only rename list for Fortran modules import.
* cp-namespace.c (cp_scan_for_anonymous_namespaces): Adjust the
cp_add_using_directive caller.
(cp_add_using_directive): New parameter excludes, describe it. New
variables ix and param. Compare if also excludes match. Allocate NEW
with variable size, initialize EXCLUDES there.
(cp_lookup_symbol_imports): New variable excludep, test
current->EXCLUDES with it.
* cp-support.h: Include vec.h.
(struct using_direct): New field excludes, describe it.
(DEF_VEC_P (const_char_ptr)): New.
(cp_add_using_directive): New parameter excludes.
* defs.h (const_char_ptr): New typedef.
* dwarf2read.c (read_import_statement): New variables child_die,
excludes and cleanups, read in excludes.
(read_namespace): Adjust the cp_add_using_directive caller.
gdb/testsuite/
Fix non-only rename list for Fortran modules import.
* gdb.fortran/module.exp (print var_x, print var_y, print var_z): New
tests.
* gdb.fortran/module.f90 (module moduse): New.
(program module): use moduse, test var_x, var_y and var_z.
2011-06-30 00:05:16 +02:00
|
|
|
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
/* Opaque declarations. */
|
|
|
|
|
2003-06-02 06:16:24 +02:00
|
|
|
struct symbol;
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
struct block;
|
2003-09-14 04:04:44 +02:00
|
|
|
struct objfile;
|
2003-12-05 05:25:09 +01:00
|
|
|
struct type;
|
2005-03-11 03:24:23 +01:00
|
|
|
struct demangle_component;
|
2015-07-22 15:30:57 +02:00
|
|
|
struct using_direct;
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
|
2011-05-31 23:54:07 +02:00
|
|
|
/* A string representing the name of the anonymous namespace used in GDB. */
|
|
|
|
|
|
|
|
#define CP_ANONYMOUS_NAMESPACE_STR "(anonymous namespace)"
|
|
|
|
|
|
|
|
/* The length of the string representing the anonymous namespace. */
|
|
|
|
|
|
|
|
#define CP_ANONYMOUS_NAMESPACE_LEN 21
|
|
|
|
|
2011-08-18 18:17:39 +02:00
|
|
|
/* The result of parsing a name. */
|
|
|
|
|
|
|
|
struct demangle_parse_info
|
|
|
|
{
|
2016-11-29 05:39:47 +01:00
|
|
|
demangle_parse_info ();
|
|
|
|
|
|
|
|
~demangle_parse_info ();
|
|
|
|
|
2011-08-18 18:17:39 +02:00
|
|
|
/* The memory used during the parse. */
|
|
|
|
struct demangle_info *info;
|
|
|
|
|
|
|
|
/* The result of the parse. */
|
|
|
|
struct demangle_component *tree;
|
|
|
|
|
|
|
|
/* Any temporary memory used during typedef replacement. */
|
|
|
|
struct obstack obstack;
|
|
|
|
};
|
|
|
|
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
|
|
|
|
/* Functions from cp-support.c. */
|
|
|
|
|
Use ui_file_as_string throughout more
This replaces most of the remaining ui_file_xstrdup calls with
ui_file_as_string calls. Whenever a call was replaced, that led to a
cascade of other necessary adjustments throughout, to make the code
use std::string instead of raw pointers. And then whenever I added a
std::string as member of a struct, I needed to adjust
allocation/destruction of said struct to use new/delete instead of
xmalloc/xfree.
The stopping point was once gdb built again. These doesn't seem to be
a way to reasonably split this out further.
Maybe-not-obvious changes:
- demangle_for_lookup returns a cleanup today. To get rid of that,
and avoid unnecessary string dupping/copying, this introduces a
demangle_result_storage type that the caller instantiates and
passes to demangle_for_lookup.
- Many methods returned a "char *" to indicate that the caller owns
the memory and must free it. Those are switched to return a
std::string instead. Methods that return a "view" into some
internal string return a "const char *" instead. I.e., we only
copy/allocate when necessary.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_name_for_lookup, type_as_string): Use and return
std::string.
(type_as_string_and_cleanup): Delete.
(ada_lookup_struct_elt_type): Use type_as_string.
* ada-lang.h (ada_name_for_lookup): Now returns std::string.
* ada-varobj.c (ada_varobj_scalar_image): Return a std::string.
(ada_varobj_describe_child): Make 'child_name' and
'child_path_expr' parameters std::string pointers.
(ada_varobj_describe_struct_child, ada_varobj_describe_ptr_child):
Likewise, and use string_printf.
(ada_varobj_describe_simple_array_child)
(ada_varobj_describe_child): Likewise.
(ada_varobj_get_name_of_child, ada_varobj_get_path_expr_of_child)
(ada_varobj_get_value_image)
(ada_varobj_get_value_of_array_variable)
(ada_varobj_get_value_of_variable, ada_name_of_variable)
(ada_name_of_child, ada_path_expr_of_child)
(ada_value_of_variable): Now returns std::string. Use
string_printf.
(ada_value_of_child): Adjust.
* break-catch-throw.c (check_status_exception_catchpoint): Adjust
to use std::string.
* breakpoint.c (watch_command_1): Adjust to use std::string.
* c-lang.c (c_get_string): Adjust to use std::string.
* c-typeprint.c (print_name_maybe_canonical): Use std::string.
* c-varobj.c (varobj_is_anonymous_child): Use ==/!= std::string
operators.
(c_name_of_variable): Now returns a std::string.
(c_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(c_name_of_child, c_path_expr_of_child, c_value_of_variable)
(cplus_number_of_children): Adjust to use std::string and
string_printf.
(cplus_name_of_variable): Now returns a std::string.
(cplus_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(cplus_name_of_child, cplus_path_expr_of_child)
(cplus_value_of_variable): Now returns a std::string.
* cp-abi.c (cplus_typename_from_type_info): Return std::string.
* cp-abi.h (cplus_typename_from_type_info): Return std::string.
(struct cp_abi_ops) <get_typename_from_type_info>: Return
std::string.
* cp-support.c (inspect_type): Use std::string.
(cp_canonicalize_string_full, cp_canonicalize_string_no_typedefs)
(cp_canonicalize_string): Return std::string and adjust.
* cp-support.h (cp_canonicalize_string)
(cp_canonicalize_string_no_typedefs, cp_canonicalize_string_full):
Return std::string.
* dbxread.c (read_dbx_symtab): Use std::string.
* dwarf2read.c (dwarf2_canonicalize_name): Adjust to use std::string.
* gdbcmd.h (lookup_struct_elt_type): Adjust to use std::string.
* gnu-v3-abi.c (gnuv3_get_typeid): Use std::string.
(gnuv3_get_typename_from_type_info): Return a std::string and
adjust.
(gnuv3_get_type_from_type_info): Adjust to use std::string.
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
std::string.
* infcmd.c (print_return_value_1): Adjust to use std::string.
* linespec.c (find_linespec_symbols): Adjust to
demangle_for_lookup API change. Use std::string.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_set_format)
(mi_cmd_var_info_type, mi_cmd_var_info_path_expression)
(mi_cmd_var_info_expression, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, varobj_update_one): Adjust to use std::string.
* minsyms.c (lookup_minimal_symbol): Use std::string.
* python/py-varobj.c (py_varobj_iter_next): Use new instead of
XNEW. vitem->name is a std::string now, adjust.
* rust-exp.y (convert_ast_to_type, convert_name): Adjust to use
std::string.
* stabsread.c (define_symbol): Adjust to use std::string.
* symtab.c (demangle_for_lookup): Now returns 'const char *'. Add
a demangle_result_storage parameter. Use it for storage.
(lookup_symbol_in_language)
(lookup_symbol_in_objfile_from_linkage_name): Adjust to new
demangle_for_lookup API.
* symtab.h (struct demangle_result_storage): New type.
(demangle_for_lookup): Now returns 'const char *'. Add a
demangle_result_storage parameter.
* typeprint.c (type_to_string): Return std::string and use
ui_file_as_string.
* value.h (type_to_string): Change return type to std::string.
* varobj-iter.h (struct varobj_item) <name>: Now a std::string.
(varobj_iter_delete): Use delete instead of xfree.
* varobj.c (create_child): Return std::string instead of char * in
output parameter.
(name_of_variable, name_of_child, my_value_of_variable): Return
std::string instead of char *.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
Adjust to std::string fields.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression): Return a std::string.
(varobj_list_children): Adjust to use std::string.
(varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
Adjust to std::string fields.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Change type of 'expression' parameter to
std::string. Use std::string.
(install_new_value): Use std::string.
(delete_variable_1): Adjust to use std::string.
(create_child): Change the 'name' parameter to a std::string
reference. Swap it into the new item's name.
(create_child_with_value): Swap item's name into the new child's
name. Use string_printf.
(new_variable): Use new instead of XNEW.
(free_variable): Don't xfree fields that are now std::string.
(name_of_variable, name_of_child): Now returns std::string.
(value_of_root): Adjust to use std::string.
(my_value_of_variable, varobj_value_get_print_value): Return
and use std::string.
(varobj_value_get_print_value): Adjust to use ui_file_as_string
and std::string.
* varobj.h (struct varobj) <name, path_expr, obj_name,
print_value>: Now std::string's.
<name_of_variable, name_of_child, path_expr_of_child,
value_of_variable>: Return std::string.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression, varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Constify 'expression' parameter.
(varobj_value_get_print_value): Return a std::string.
2016-11-08 16:26:47 +01:00
|
|
|
extern std::string cp_canonicalize_string (const char *string);
|
2005-03-11 03:24:23 +01:00
|
|
|
|
Use ui_file_as_string throughout more
This replaces most of the remaining ui_file_xstrdup calls with
ui_file_as_string calls. Whenever a call was replaced, that led to a
cascade of other necessary adjustments throughout, to make the code
use std::string instead of raw pointers. And then whenever I added a
std::string as member of a struct, I needed to adjust
allocation/destruction of said struct to use new/delete instead of
xmalloc/xfree.
The stopping point was once gdb built again. These doesn't seem to be
a way to reasonably split this out further.
Maybe-not-obvious changes:
- demangle_for_lookup returns a cleanup today. To get rid of that,
and avoid unnecessary string dupping/copying, this introduces a
demangle_result_storage type that the caller instantiates and
passes to demangle_for_lookup.
- Many methods returned a "char *" to indicate that the caller owns
the memory and must free it. Those are switched to return a
std::string instead. Methods that return a "view" into some
internal string return a "const char *" instead. I.e., we only
copy/allocate when necessary.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_name_for_lookup, type_as_string): Use and return
std::string.
(type_as_string_and_cleanup): Delete.
(ada_lookup_struct_elt_type): Use type_as_string.
* ada-lang.h (ada_name_for_lookup): Now returns std::string.
* ada-varobj.c (ada_varobj_scalar_image): Return a std::string.
(ada_varobj_describe_child): Make 'child_name' and
'child_path_expr' parameters std::string pointers.
(ada_varobj_describe_struct_child, ada_varobj_describe_ptr_child):
Likewise, and use string_printf.
(ada_varobj_describe_simple_array_child)
(ada_varobj_describe_child): Likewise.
(ada_varobj_get_name_of_child, ada_varobj_get_path_expr_of_child)
(ada_varobj_get_value_image)
(ada_varobj_get_value_of_array_variable)
(ada_varobj_get_value_of_variable, ada_name_of_variable)
(ada_name_of_child, ada_path_expr_of_child)
(ada_value_of_variable): Now returns std::string. Use
string_printf.
(ada_value_of_child): Adjust.
* break-catch-throw.c (check_status_exception_catchpoint): Adjust
to use std::string.
* breakpoint.c (watch_command_1): Adjust to use std::string.
* c-lang.c (c_get_string): Adjust to use std::string.
* c-typeprint.c (print_name_maybe_canonical): Use std::string.
* c-varobj.c (varobj_is_anonymous_child): Use ==/!= std::string
operators.
(c_name_of_variable): Now returns a std::string.
(c_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(c_name_of_child, c_path_expr_of_child, c_value_of_variable)
(cplus_number_of_children): Adjust to use std::string and
string_printf.
(cplus_name_of_variable): Now returns a std::string.
(cplus_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(cplus_name_of_child, cplus_path_expr_of_child)
(cplus_value_of_variable): Now returns a std::string.
* cp-abi.c (cplus_typename_from_type_info): Return std::string.
* cp-abi.h (cplus_typename_from_type_info): Return std::string.
(struct cp_abi_ops) <get_typename_from_type_info>: Return
std::string.
* cp-support.c (inspect_type): Use std::string.
(cp_canonicalize_string_full, cp_canonicalize_string_no_typedefs)
(cp_canonicalize_string): Return std::string and adjust.
* cp-support.h (cp_canonicalize_string)
(cp_canonicalize_string_no_typedefs, cp_canonicalize_string_full):
Return std::string.
* dbxread.c (read_dbx_symtab): Use std::string.
* dwarf2read.c (dwarf2_canonicalize_name): Adjust to use std::string.
* gdbcmd.h (lookup_struct_elt_type): Adjust to use std::string.
* gnu-v3-abi.c (gnuv3_get_typeid): Use std::string.
(gnuv3_get_typename_from_type_info): Return a std::string and
adjust.
(gnuv3_get_type_from_type_info): Adjust to use std::string.
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
std::string.
* infcmd.c (print_return_value_1): Adjust to use std::string.
* linespec.c (find_linespec_symbols): Adjust to
demangle_for_lookup API change. Use std::string.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_set_format)
(mi_cmd_var_info_type, mi_cmd_var_info_path_expression)
(mi_cmd_var_info_expression, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, varobj_update_one): Adjust to use std::string.
* minsyms.c (lookup_minimal_symbol): Use std::string.
* python/py-varobj.c (py_varobj_iter_next): Use new instead of
XNEW. vitem->name is a std::string now, adjust.
* rust-exp.y (convert_ast_to_type, convert_name): Adjust to use
std::string.
* stabsread.c (define_symbol): Adjust to use std::string.
* symtab.c (demangle_for_lookup): Now returns 'const char *'. Add
a demangle_result_storage parameter. Use it for storage.
(lookup_symbol_in_language)
(lookup_symbol_in_objfile_from_linkage_name): Adjust to new
demangle_for_lookup API.
* symtab.h (struct demangle_result_storage): New type.
(demangle_for_lookup): Now returns 'const char *'. Add a
demangle_result_storage parameter.
* typeprint.c (type_to_string): Return std::string and use
ui_file_as_string.
* value.h (type_to_string): Change return type to std::string.
* varobj-iter.h (struct varobj_item) <name>: Now a std::string.
(varobj_iter_delete): Use delete instead of xfree.
* varobj.c (create_child): Return std::string instead of char * in
output parameter.
(name_of_variable, name_of_child, my_value_of_variable): Return
std::string instead of char *.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
Adjust to std::string fields.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression): Return a std::string.
(varobj_list_children): Adjust to use std::string.
(varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
Adjust to std::string fields.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Change type of 'expression' parameter to
std::string. Use std::string.
(install_new_value): Use std::string.
(delete_variable_1): Adjust to use std::string.
(create_child): Change the 'name' parameter to a std::string
reference. Swap it into the new item's name.
(create_child_with_value): Swap item's name into the new child's
name. Use string_printf.
(new_variable): Use new instead of XNEW.
(free_variable): Don't xfree fields that are now std::string.
(name_of_variable, name_of_child): Now returns std::string.
(value_of_root): Adjust to use std::string.
(my_value_of_variable, varobj_value_get_print_value): Return
and use std::string.
(varobj_value_get_print_value): Adjust to use ui_file_as_string
and std::string.
* varobj.h (struct varobj) <name, path_expr, obj_name,
print_value>: Now std::string's.
<name_of_variable, name_of_child, path_expr_of_child,
value_of_variable>: Return std::string.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression, varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Constify 'expression' parameter.
(varobj_value_get_print_value): Return a std::string.
2016-11-08 16:26:47 +01:00
|
|
|
extern std::string cp_canonicalize_string_no_typedefs (const char *string);
|
2011-08-18 18:17:39 +02:00
|
|
|
|
2012-11-12 18:30:06 +01:00
|
|
|
typedef const char *(canonicalization_ftype) (struct type *, void *);
|
|
|
|
|
Use ui_file_as_string throughout more
This replaces most of the remaining ui_file_xstrdup calls with
ui_file_as_string calls. Whenever a call was replaced, that led to a
cascade of other necessary adjustments throughout, to make the code
use std::string instead of raw pointers. And then whenever I added a
std::string as member of a struct, I needed to adjust
allocation/destruction of said struct to use new/delete instead of
xmalloc/xfree.
The stopping point was once gdb built again. These doesn't seem to be
a way to reasonably split this out further.
Maybe-not-obvious changes:
- demangle_for_lookup returns a cleanup today. To get rid of that,
and avoid unnecessary string dupping/copying, this introduces a
demangle_result_storage type that the caller instantiates and
passes to demangle_for_lookup.
- Many methods returned a "char *" to indicate that the caller owns
the memory and must free it. Those are switched to return a
std::string instead. Methods that return a "view" into some
internal string return a "const char *" instead. I.e., we only
copy/allocate when necessary.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* ada-lang.c (ada_name_for_lookup, type_as_string): Use and return
std::string.
(type_as_string_and_cleanup): Delete.
(ada_lookup_struct_elt_type): Use type_as_string.
* ada-lang.h (ada_name_for_lookup): Now returns std::string.
* ada-varobj.c (ada_varobj_scalar_image): Return a std::string.
(ada_varobj_describe_child): Make 'child_name' and
'child_path_expr' parameters std::string pointers.
(ada_varobj_describe_struct_child, ada_varobj_describe_ptr_child):
Likewise, and use string_printf.
(ada_varobj_describe_simple_array_child)
(ada_varobj_describe_child): Likewise.
(ada_varobj_get_name_of_child, ada_varobj_get_path_expr_of_child)
(ada_varobj_get_value_image)
(ada_varobj_get_value_of_array_variable)
(ada_varobj_get_value_of_variable, ada_name_of_variable)
(ada_name_of_child, ada_path_expr_of_child)
(ada_value_of_variable): Now returns std::string. Use
string_printf.
(ada_value_of_child): Adjust.
* break-catch-throw.c (check_status_exception_catchpoint): Adjust
to use std::string.
* breakpoint.c (watch_command_1): Adjust to use std::string.
* c-lang.c (c_get_string): Adjust to use std::string.
* c-typeprint.c (print_name_maybe_canonical): Use std::string.
* c-varobj.c (varobj_is_anonymous_child): Use ==/!= std::string
operators.
(c_name_of_variable): Now returns a std::string.
(c_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(c_name_of_child, c_path_expr_of_child, c_value_of_variable)
(cplus_number_of_children): Adjust to use std::string and
string_printf.
(cplus_name_of_variable): Now returns a std::string.
(cplus_describe_child): The 'cname' and 'cfull_expression' output
parameters are now std::string pointers. Adjust.
(cplus_name_of_child, cplus_path_expr_of_child)
(cplus_value_of_variable): Now returns a std::string.
* cp-abi.c (cplus_typename_from_type_info): Return std::string.
* cp-abi.h (cplus_typename_from_type_info): Return std::string.
(struct cp_abi_ops) <get_typename_from_type_info>: Return
std::string.
* cp-support.c (inspect_type): Use std::string.
(cp_canonicalize_string_full, cp_canonicalize_string_no_typedefs)
(cp_canonicalize_string): Return std::string and adjust.
* cp-support.h (cp_canonicalize_string)
(cp_canonicalize_string_no_typedefs, cp_canonicalize_string_full):
Return std::string.
* dbxread.c (read_dbx_symtab): Use std::string.
* dwarf2read.c (dwarf2_canonicalize_name): Adjust to use std::string.
* gdbcmd.h (lookup_struct_elt_type): Adjust to use std::string.
* gnu-v3-abi.c (gnuv3_get_typeid): Use std::string.
(gnuv3_get_typename_from_type_info): Return a std::string and
adjust.
(gnuv3_get_type_from_type_info): Adjust to use std::string.
* guile/guile.c (gdbscm_execute_gdb_command): Adjust to use
std::string.
* infcmd.c (print_return_value_1): Adjust to use std::string.
* linespec.c (find_linespec_symbols): Adjust to
demangle_for_lookup API change. Use std::string.
* mi/mi-cmd-var.c (print_varobj, mi_cmd_var_set_format)
(mi_cmd_var_info_type, mi_cmd_var_info_path_expression)
(mi_cmd_var_info_expression, mi_cmd_var_evaluate_expression)
(mi_cmd_var_assign, varobj_update_one): Adjust to use std::string.
* minsyms.c (lookup_minimal_symbol): Use std::string.
* python/py-varobj.c (py_varobj_iter_next): Use new instead of
XNEW. vitem->name is a std::string now, adjust.
* rust-exp.y (convert_ast_to_type, convert_name): Adjust to use
std::string.
* stabsread.c (define_symbol): Adjust to use std::string.
* symtab.c (demangle_for_lookup): Now returns 'const char *'. Add
a demangle_result_storage parameter. Use it for storage.
(lookup_symbol_in_language)
(lookup_symbol_in_objfile_from_linkage_name): Adjust to new
demangle_for_lookup API.
* symtab.h (struct demangle_result_storage): New type.
(demangle_for_lookup): Now returns 'const char *'. Add a
demangle_result_storage parameter.
* typeprint.c (type_to_string): Return std::string and use
ui_file_as_string.
* value.h (type_to_string): Change return type to std::string.
* varobj-iter.h (struct varobj_item) <name>: Now a std::string.
(varobj_iter_delete): Use delete instead of xfree.
* varobj.c (create_child): Return std::string instead of char * in
output parameter.
(name_of_variable, name_of_child, my_value_of_variable): Return
std::string instead of char *.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
Adjust to std::string fields.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression): Return a std::string.
(varobj_list_children): Adjust to use std::string.
(varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
Adjust to std::string fields.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Change type of 'expression' parameter to
std::string. Use std::string.
(install_new_value): Use std::string.
(delete_variable_1): Adjust to use std::string.
(create_child): Change the 'name' parameter to a std::string
reference. Swap it into the new item's name.
(create_child_with_value): Swap item's name into the new child's
name. Use string_printf.
(new_variable): Use new instead of XNEW.
(free_variable): Don't xfree fields that are now std::string.
(name_of_variable, name_of_child): Now returns std::string.
(value_of_root): Adjust to use std::string.
(my_value_of_variable, varobj_value_get_print_value): Return
and use std::string.
(varobj_value_get_print_value): Adjust to use ui_file_as_string
and std::string.
* varobj.h (struct varobj) <name, path_expr, obj_name,
print_value>: Now std::string's.
<name_of_variable, name_of_child, path_expr_of_child,
value_of_variable>: Return std::string.
(varobj_create, varobj_get_handle): Constify 'objname' parameter.
(varobj_get_objname): Return a const char * instead of a char *.
(varobj_get_expression, varobj_get_type): Return a std::string.
(varobj_get_path_expr): Return a const char * instead of a char *.
(varobj_get_formatted_value, varobj_get_value): Return a
std::string.
(varobj_set_value): Constify 'expression' parameter.
(varobj_value_get_print_value): Return a std::string.
2016-11-08 16:26:47 +01:00
|
|
|
extern std::string cp_canonicalize_string_full (const char *string,
|
|
|
|
canonicalization_ftype *finder,
|
|
|
|
void *data);
|
2012-11-12 18:30:06 +01:00
|
|
|
|
2004-07-06 21:29:31 +02:00
|
|
|
extern char *cp_class_name_from_physname (const char *physname);
|
2002-09-14 04:09:39 +02:00
|
|
|
|
|
|
|
extern char *method_name_from_physname (const char *physname);
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
|
|
|
|
extern unsigned int cp_find_first_component (const char *name);
|
|
|
|
|
|
|
|
extern unsigned int cp_entire_prefix_len (const char *name);
|
|
|
|
|
2004-02-02 21:44:53 +01:00
|
|
|
extern char *cp_func_name (const char *full_name);
|
|
|
|
|
* ax-gdb.c (gen_var_ref): Use SYMBOL_LINKAGE_NAME.
* blockframe.c (find_pc_partial_function): Likewise.
* buildsym.c (find_symbol_in_list): Likewise.
* c-valprint.c (c_val_print): Likewise.
* coffread.c (patch_opaque_types, process_coff_symbol): Likewise.
(coff_read_enum_type): Likewise. Use SYMBOL_SET_LINKAGE_NAME.
* cp-support.c (cp_remove_params): Renamed from remove_params and
made global.
(overload_list_add_symbol): Update call to remove_params.
* cp-support.h (cp_remove_params): Declare.
* dwarf2read.c (process_enumeration_scope): Use SYMBOL_LINKAGE_NAME.
(dwarf2_const_value): Use SYMBOL_PRINT_NAME.
* expprint.c (dump_subexp_body_standard): Likewise.
* f-valprint.c (info_common_command, there_is_a_visible_common_named):
Use SYMBOL_LINKAGE_NAME to find symbols and SYMBOL_PRINT_NAME
for messages.
* findvar.c (read_var_value): Use SYMBOL_LINKAGE_NAME.
* gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise.
* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline)
(hppa_hpux_skip_trampoline_code): Use SYMBOL_LINKAGE_NAME to find
symbols and SYMBOL_PRINT_NAME for messages.
* jv-lang.c (add_class_symbol): Use SYMBOL_SET_LINKAGE_NAME.
* linespec.c (decode_line_2): Use SYMBOL_LINKAGE_NAME.
* mdebugread.c (parse_symbol): Use SYMBOL_LINKAGE_NAME and
SYMBOL_SET_LINKAGE_NAME.
(mylookup_symbol): Use SYMBOL_LINKAGE_NAME.
* minsyms.c (add_minsym_to_demangled_hash_table): Use
SYMBOL_SEARCH_NAME.
(lookup_minimal_symbol): Use SYMBOL_LINKAGE_NAME or
SYMBOL_MATCHES_SEARCH_NAME, depending on the pass.
* objfiles.h (ALL_OBJFILE_MSYMBOLS): Use SYMBOL_LINKAGE_NAME.
* printcmd.c (build_address_symbolic): Use SYMBOL_LINKAGE_NAME.
(address_info): Use SYMBOL_PRINT_NAME for messages and
SYMBOL_LINKAGE_NAME for lookups.
* sol-thread.c (info_cb): Use SYMBOL_PRINT_NAME for messages.
* stabsread.c (patch_block_stabs, define_symbol)
(read_type, read_enum_type, common_block_end)
(cleanup_undefined_types_1, scan_file_globals): Use
SYMBOL_LINKAGE_NAME, SYMBOL_SET_LINKAGE_NAME, ALL_OBJFILE_MSYMBOLS,
and SYMBOL_PRINT_NAME.
* stack.c (print_frame_args): Use SYMBOL_LINKAGE_NAME.
(print_frame, frame_info): Use SYMBOL_PRINT_NAME for output. Use
cp_remove_params instead of cplus_demangle.
(print_block_frame_labels, print_frame_arg_vars): Use
SYMBOL_LINKAGE_NAME.
* symmisc.c (dump_msymbols): Use ALL_OBJFILE_MSYMBOLS and
SYMBOL_LINKAGE_NAME.
(dump_symtab_1, print_symbol, print_partial_symbols)
(maintenance_check_symtabs): Use SYMBOL_LINKAGE_NAME.
* symtab.h (DEPRECATED_SYMBOL_NAME): Delete.
(SYMBOL_SET_LINKAGE_NAME): New.
(SYMBOL_SET_NAMES): Add a comment.
* tracepoint.c (set_traceframe_context, validate_actionline)
(collect_symbol, scope_info): Use SYMBOL_LINKAGE_NAME for
lookups and SYMBOL_PRINT_NAME for output.
* typeprint.c (typedef_print): Use SYMBOL_LINKAGE_NAME.
* xcoffread.c (process_xcoff_symbol): Use SYMBOL_SET_LINKAGE_NAME.
2008-08-21 20:14:39 +02:00
|
|
|
extern char *cp_remove_params (const char *demangled_name);
|
|
|
|
|
2004-02-02 21:44:53 +01:00
|
|
|
extern struct symbol **make_symbol_overload_list (const char *,
|
|
|
|
const char *);
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
|
2010-05-07 16:46:28 +02:00
|
|
|
extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types,
|
|
|
|
int nargs,
|
|
|
|
const char *func_name);
|
|
|
|
|
2003-12-05 05:25:09 +01:00
|
|
|
extern struct type *cp_lookup_rtti_type (const char *name,
|
|
|
|
struct block *block);
|
|
|
|
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
/* Functions/variables from cp-namespace.c. */
|
|
|
|
|
2014-12-13 07:33:26 +01:00
|
|
|
extern int cp_is_in_anonymous (const char *symbol_name);
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
|
2011-10-20 22:06:14 +02:00
|
|
|
extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol,
|
|
|
|
struct objfile *objfile);
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
|
Replace the block_found global with explicit data-flow
As Pedro suggested on gdb-patches@ (see
https://sourceware.org/ml/gdb-patches/2015-05/msg00714.html), this
change makes symbol lookup functions return a structure that includes
both the symbol found and the block in which it was found. This makes
it possible to get rid of the block_found global variable and thus makes
block hunting explicit.
gdb/
* ada-exp.y (write_object_renaming): Replace struct
ada_symbol_info with struct block_symbol. Update field
references accordingly.
(block_lookup, select_possible_type_sym): Likewise.
(find_primitive_type): Likewise. Also update call to
ada_lookup_symbol to extract the symbol itself.
(write_var_or_type, write_name_assoc): Likewise.
* ada-lang.h (struct ada_symbol_info): Remove.
(ada_lookup_symbol_list): Replace struct ada_symbol_info with
struct block_symbol.
(ada_lookup_encoded_symbol, user_select_syms): Likewise.
(ada_lookup_symbol): Return struct block_symbol instead of a
mere symbol.
* ada-lang.c (defns_collected): Replace struct ada_symbol_info
with struct block_symbol.
(resolve_subexp, ada_resolve_function, sort_choices,
user_select_syms, is_nonfunction, add_defn_to_vec,
num_defns_collected, defns_collected,
symbols_are_identical_enums, remove_extra_symbols,
remove_irrelevant_renamings, add_lookup_symbol_list_worker,
ada_lookup_symbol_list, ada_iterate_over_symbols,
ada_lookup_encoded_symbol, get_var_value): Likewise.
(ada_lookup_symbol): Return a block_symbol instead of a mere
symbol. Replace struct ada_symbol_info with struct
block_symbol.
(ada_lookup_symbol_nonlocal): Likewise.
(standard_lookup): Make block passing explicit through
lookup_symbol_in_language.
* ada-tasks.c (get_tcb_types_info): Update the calls to
lookup_symbol_in_language to extract the mere symbol out of the
returned value.
(ada_tasks_inferior_data_sniffer): Likewise.
* ax-gdb.c (gen_static_field): Likewise for the call to
lookup_symbol.
(gen_maybe_namespace_elt): Deal with struct symbol_in_block from
lookup functions.
(gen_expr): Likewise.
* c-exp.y: Likewise. Remove uses of block_found.
(lex_one_token, classify_inner_name, c_print_token): Likewise.
(classify_name): Likewise. Rename the "sym" local variable to
"bsym".
* c-valprint.c (print_unpacked_pointer): Likewise.
* compile/compile-c-symbols.c (convert_symbol_sym): Promote the
"sym" parameter from struct symbol * to struct block_symbol.
Use it to remove uses of block_found. Deal with struct
symbol_in_block from lookup functions.
(gcc_convert_symbol): Likewise. Update the call to
convert_symbol_sym.
* compile/compile-object-load.c (compile_object_load): Deal with
struct symbol_in_block from lookup functions.
* cp-namespace.c (cp_lookup_nested_symbol_1,
cp_lookup_nested_symbol, cp_lookup_bare_symbol,
cp_search_static_and_baseclasses,
cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports,
cp_lookup_symbol_imports_or_template,
cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace,
lookup_namespace_scope, cp_lookup_nonlocal,
find_symbol_in_baseclass): Return struct symbol_in_block instead
of mere symbols and deal with struct symbol_in_block from lookup
functions.
* cp-support.c (inspect_type, replace_typedefs,
cp_lookup_rtti_type): Deal with struct symbol_in_block from
lookup functions.
* cp-support.h (cp_lookup_symbol_nonlocal,
cp_lookup_symbol_from_namespace,
cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol):
Return struct symbol_in_block instead of mere symbols.
* d-exp.y (d_type_from_name, d_module_from_name, push_variable,
push_module_name):
Deal with struct symbol_in_block from lookup functions. Remove
uses of block_found.
* eval.c (evaluate_subexp_standard): Update call to
cp_lookup_symbol_namespace.
* f-exp.y: Deal with struct symbol_in_block from lookup
functions. Remove uses of block_found.
(yylex): Likewise.
* gdbtypes.c (lookup_typename, lookup_struct, lookup_union,
lookup_enum, lookup_template_type, check_typedef): Deal with
struct symbol_in_block from lookup functions.
* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
* guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise.
(gdbscm_lookup_global_symbol): Likewise.
* gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise.
* go-exp.y: Likewise. Remove uses of block_found.
(package_name_p, classify_packaged_name, classify_name):
Likewise.
* infrun.c (insert_exception_resume_breakpoint): Likewise.
* jv-exp.y (push_variable): Likewise.
* jv-lang.c (java_lookup_class, get_java_object_type): Likewise.
* language.c (language_bool_type): Likewise.
* language.h (struct language_defn): Update
la_lookup_symbol_nonlocal to return a struct symbol_in_block
rather than a mere symbol.
* linespec.c (find_label_symbols): Deal with struct
symbol_in_block from lookup functions.
* m2-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* objc-lang.c (lookup_struct_typedef, find_imps): Likewise.
* p-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
* parse.c (write_dollar_variable): Likewise. Remove uses of
block_found.
* parser-defs.h (struct symtoken): Turn the SYM field into a
struct symbol_in_block.
* printcmd.c (address_info): Deal with struct symbol_in_block
from lookup functions.
* python/py-frame.c (frapy_read_var): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol,
gdbpy_lookup_global_symbol): Likewise.
* skip.c (skip_function_command): Likewise.
* solib-darwin.c (darwin_lookup_lib_symbol): Return a struct
symbol_in_block instead of a mere symbol.
* solib-spu.c (spu_lookup_lib_symbol): Likewise.
* solib-svr4.c (elf_lookup_lib_symbol): Likewise.
* solib.c (solib_global_lookup): Likewise.
* solist.h (solib_global_lookup): Likewise.
(struct target_so_ops): Update lookup_lib_global_symbol to
return a struct symbol_in_block rather than a mere symbol.
* source.c (select_source_symtab): Deal with struct
symbol_in_block from lookup functions.
* stack.c (print_frame_args, iterate_over_block_arg_vars):
Likewise.
* symfile.c (set_initial_language): Likewise.
* symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct
symbol_in_block.
(SYMBOL_LOOKUP_FAILED_P): New predicate as a macro.
(struct symbol_cache_slot): Turn the FOUND field into a struct
symbol_in_block.
(block_found): Remove.
(eq_symbol_entry): Update to deal with struct symbol_in_block in
cache slots.
(symbol_cache_lookup): Return a struct symbol_in_block rather
than a mere symbol.
(symbol_cache_mark_found): Add a BLOCK parameter to fill
appropriately the cache slots. Update callers.
(symbol_cache_dump): Update cache slots handling to the type
change.
(lookup_symbol_in_language, lookup_symbol, lookup_language_this,
lookup_symbol_aux, lookup_local_symbol,
lookup_symbol_in_objfile, lookup_global_symbol_from_objfile,
lookup_symbol_in_objfile_symtabs,
lookup_symbol_in_objfile_from_linkage_name,
lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal,
lookup_symbol_in_static_block, lookup_static_symbol,
lookup_global_symbol):
Return a struct symbol_in_block rather than a mere symbol. Deal
with struct symbol_in_block from other lookup functions. Remove
uses of block_found.
(lookup_symbol_in_block): Remove uses of block_found.
(struct global_sym_lookup_data): Turn the RESULT field into a
struct symbol_in_block.
(lookup_symbol_global_iterator_cb): Update references to the
RESULT field.
(search_symbols): Deal with struct symbol_in_block from lookup
functions.
* symtab.h (struct symbol_in_block): New structure.
(block_found): Remove.
(lookup_symbol_in_language, lookup_symbol,
basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block,
looku_static_symbol, lookup_global_symbol,
lookup_symbol_in_block, lookup_language_this,
lookup_global_symbol_from_objfile): Return a struct
symbol_in_block rather than just a mere symbol. Update comments
to remove mentions of block_found.
* valops.c (find_function_in_inferior,
value_struct_elt_for_reference, value_maybe_namespace_elt,
value_of_this): Deal with struct symbol_in_block from lookup
functions.
* value.c (value_static_field, value_fn_field): Likewise.
2015-07-21 17:02:15 +02:00
|
|
|
extern struct block_symbol cp_lookup_symbol_nonlocal
|
2014-12-23 16:24:48 +01:00
|
|
|
(const struct language_defn *langdef,
|
|
|
|
const char *name,
|
|
|
|
const struct block *block,
|
|
|
|
const domain_enum domain);
|
2003-05-20 05:56:29 +02:00
|
|
|
|
Replace the block_found global with explicit data-flow
As Pedro suggested on gdb-patches@ (see
https://sourceware.org/ml/gdb-patches/2015-05/msg00714.html), this
change makes symbol lookup functions return a structure that includes
both the symbol found and the block in which it was found. This makes
it possible to get rid of the block_found global variable and thus makes
block hunting explicit.
gdb/
* ada-exp.y (write_object_renaming): Replace struct
ada_symbol_info with struct block_symbol. Update field
references accordingly.
(block_lookup, select_possible_type_sym): Likewise.
(find_primitive_type): Likewise. Also update call to
ada_lookup_symbol to extract the symbol itself.
(write_var_or_type, write_name_assoc): Likewise.
* ada-lang.h (struct ada_symbol_info): Remove.
(ada_lookup_symbol_list): Replace struct ada_symbol_info with
struct block_symbol.
(ada_lookup_encoded_symbol, user_select_syms): Likewise.
(ada_lookup_symbol): Return struct block_symbol instead of a
mere symbol.
* ada-lang.c (defns_collected): Replace struct ada_symbol_info
with struct block_symbol.
(resolve_subexp, ada_resolve_function, sort_choices,
user_select_syms, is_nonfunction, add_defn_to_vec,
num_defns_collected, defns_collected,
symbols_are_identical_enums, remove_extra_symbols,
remove_irrelevant_renamings, add_lookup_symbol_list_worker,
ada_lookup_symbol_list, ada_iterate_over_symbols,
ada_lookup_encoded_symbol, get_var_value): Likewise.
(ada_lookup_symbol): Return a block_symbol instead of a mere
symbol. Replace struct ada_symbol_info with struct
block_symbol.
(ada_lookup_symbol_nonlocal): Likewise.
(standard_lookup): Make block passing explicit through
lookup_symbol_in_language.
* ada-tasks.c (get_tcb_types_info): Update the calls to
lookup_symbol_in_language to extract the mere symbol out of the
returned value.
(ada_tasks_inferior_data_sniffer): Likewise.
* ax-gdb.c (gen_static_field): Likewise for the call to
lookup_symbol.
(gen_maybe_namespace_elt): Deal with struct symbol_in_block from
lookup functions.
(gen_expr): Likewise.
* c-exp.y: Likewise. Remove uses of block_found.
(lex_one_token, classify_inner_name, c_print_token): Likewise.
(classify_name): Likewise. Rename the "sym" local variable to
"bsym".
* c-valprint.c (print_unpacked_pointer): Likewise.
* compile/compile-c-symbols.c (convert_symbol_sym): Promote the
"sym" parameter from struct symbol * to struct block_symbol.
Use it to remove uses of block_found. Deal with struct
symbol_in_block from lookup functions.
(gcc_convert_symbol): Likewise. Update the call to
convert_symbol_sym.
* compile/compile-object-load.c (compile_object_load): Deal with
struct symbol_in_block from lookup functions.
* cp-namespace.c (cp_lookup_nested_symbol_1,
cp_lookup_nested_symbol, cp_lookup_bare_symbol,
cp_search_static_and_baseclasses,
cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports,
cp_lookup_symbol_imports_or_template,
cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace,
lookup_namespace_scope, cp_lookup_nonlocal,
find_symbol_in_baseclass): Return struct symbol_in_block instead
of mere symbols and deal with struct symbol_in_block from lookup
functions.
* cp-support.c (inspect_type, replace_typedefs,
cp_lookup_rtti_type): Deal with struct symbol_in_block from
lookup functions.
* cp-support.h (cp_lookup_symbol_nonlocal,
cp_lookup_symbol_from_namespace,
cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol):
Return struct symbol_in_block instead of mere symbols.
* d-exp.y (d_type_from_name, d_module_from_name, push_variable,
push_module_name):
Deal with struct symbol_in_block from lookup functions. Remove
uses of block_found.
* eval.c (evaluate_subexp_standard): Update call to
cp_lookup_symbol_namespace.
* f-exp.y: Deal with struct symbol_in_block from lookup
functions. Remove uses of block_found.
(yylex): Likewise.
* gdbtypes.c (lookup_typename, lookup_struct, lookup_union,
lookup_enum, lookup_template_type, check_typedef): Deal with
struct symbol_in_block from lookup functions.
* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
* guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise.
(gdbscm_lookup_global_symbol): Likewise.
* gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise.
* go-exp.y: Likewise. Remove uses of block_found.
(package_name_p, classify_packaged_name, classify_name):
Likewise.
* infrun.c (insert_exception_resume_breakpoint): Likewise.
* jv-exp.y (push_variable): Likewise.
* jv-lang.c (java_lookup_class, get_java_object_type): Likewise.
* language.c (language_bool_type): Likewise.
* language.h (struct language_defn): Update
la_lookup_symbol_nonlocal to return a struct symbol_in_block
rather than a mere symbol.
* linespec.c (find_label_symbols): Deal with struct
symbol_in_block from lookup functions.
* m2-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* objc-lang.c (lookup_struct_typedef, find_imps): Likewise.
* p-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
* parse.c (write_dollar_variable): Likewise. Remove uses of
block_found.
* parser-defs.h (struct symtoken): Turn the SYM field into a
struct symbol_in_block.
* printcmd.c (address_info): Deal with struct symbol_in_block
from lookup functions.
* python/py-frame.c (frapy_read_var): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol,
gdbpy_lookup_global_symbol): Likewise.
* skip.c (skip_function_command): Likewise.
* solib-darwin.c (darwin_lookup_lib_symbol): Return a struct
symbol_in_block instead of a mere symbol.
* solib-spu.c (spu_lookup_lib_symbol): Likewise.
* solib-svr4.c (elf_lookup_lib_symbol): Likewise.
* solib.c (solib_global_lookup): Likewise.
* solist.h (solib_global_lookup): Likewise.
(struct target_so_ops): Update lookup_lib_global_symbol to
return a struct symbol_in_block rather than a mere symbol.
* source.c (select_source_symtab): Deal with struct
symbol_in_block from lookup functions.
* stack.c (print_frame_args, iterate_over_block_arg_vars):
Likewise.
* symfile.c (set_initial_language): Likewise.
* symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct
symbol_in_block.
(SYMBOL_LOOKUP_FAILED_P): New predicate as a macro.
(struct symbol_cache_slot): Turn the FOUND field into a struct
symbol_in_block.
(block_found): Remove.
(eq_symbol_entry): Update to deal with struct symbol_in_block in
cache slots.
(symbol_cache_lookup): Return a struct symbol_in_block rather
than a mere symbol.
(symbol_cache_mark_found): Add a BLOCK parameter to fill
appropriately the cache slots. Update callers.
(symbol_cache_dump): Update cache slots handling to the type
change.
(lookup_symbol_in_language, lookup_symbol, lookup_language_this,
lookup_symbol_aux, lookup_local_symbol,
lookup_symbol_in_objfile, lookup_global_symbol_from_objfile,
lookup_symbol_in_objfile_symtabs,
lookup_symbol_in_objfile_from_linkage_name,
lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal,
lookup_symbol_in_static_block, lookup_static_symbol,
lookup_global_symbol):
Return a struct symbol_in_block rather than a mere symbol. Deal
with struct symbol_in_block from other lookup functions. Remove
uses of block_found.
(lookup_symbol_in_block): Remove uses of block_found.
(struct global_sym_lookup_data): Turn the RESULT field into a
struct symbol_in_block.
(lookup_symbol_global_iterator_cb): Update references to the
RESULT field.
(search_symbols): Deal with struct symbol_in_block from lookup
functions.
* symtab.h (struct symbol_in_block): New structure.
(block_found): Remove.
(lookup_symbol_in_language, lookup_symbol,
basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block,
looku_static_symbol, lookup_global_symbol,
lookup_symbol_in_block, lookup_language_this,
lookup_global_symbol_from_objfile): Return a struct
symbol_in_block rather than just a mere symbol. Update comments
to remove mentions of block_found.
* valops.c (find_function_in_inferior,
value_struct_elt_for_reference, value_maybe_namespace_elt,
value_of_this): Deal with struct symbol_in_block from lookup
functions.
* value.c (value_static_field, value_fn_field): Likewise.
2015-07-21 17:02:15 +02:00
|
|
|
extern struct block_symbol
|
|
|
|
cp_lookup_symbol_namespace (const char *the_namespace,
|
|
|
|
const char *name,
|
|
|
|
const struct block *block,
|
|
|
|
const domain_enum domain);
|
2010-03-15 18:29:36 +01:00
|
|
|
|
Replace the block_found global with explicit data-flow
As Pedro suggested on gdb-patches@ (see
https://sourceware.org/ml/gdb-patches/2015-05/msg00714.html), this
change makes symbol lookup functions return a structure that includes
both the symbol found and the block in which it was found. This makes
it possible to get rid of the block_found global variable and thus makes
block hunting explicit.
gdb/
* ada-exp.y (write_object_renaming): Replace struct
ada_symbol_info with struct block_symbol. Update field
references accordingly.
(block_lookup, select_possible_type_sym): Likewise.
(find_primitive_type): Likewise. Also update call to
ada_lookup_symbol to extract the symbol itself.
(write_var_or_type, write_name_assoc): Likewise.
* ada-lang.h (struct ada_symbol_info): Remove.
(ada_lookup_symbol_list): Replace struct ada_symbol_info with
struct block_symbol.
(ada_lookup_encoded_symbol, user_select_syms): Likewise.
(ada_lookup_symbol): Return struct block_symbol instead of a
mere symbol.
* ada-lang.c (defns_collected): Replace struct ada_symbol_info
with struct block_symbol.
(resolve_subexp, ada_resolve_function, sort_choices,
user_select_syms, is_nonfunction, add_defn_to_vec,
num_defns_collected, defns_collected,
symbols_are_identical_enums, remove_extra_symbols,
remove_irrelevant_renamings, add_lookup_symbol_list_worker,
ada_lookup_symbol_list, ada_iterate_over_symbols,
ada_lookup_encoded_symbol, get_var_value): Likewise.
(ada_lookup_symbol): Return a block_symbol instead of a mere
symbol. Replace struct ada_symbol_info with struct
block_symbol.
(ada_lookup_symbol_nonlocal): Likewise.
(standard_lookup): Make block passing explicit through
lookup_symbol_in_language.
* ada-tasks.c (get_tcb_types_info): Update the calls to
lookup_symbol_in_language to extract the mere symbol out of the
returned value.
(ada_tasks_inferior_data_sniffer): Likewise.
* ax-gdb.c (gen_static_field): Likewise for the call to
lookup_symbol.
(gen_maybe_namespace_elt): Deal with struct symbol_in_block from
lookup functions.
(gen_expr): Likewise.
* c-exp.y: Likewise. Remove uses of block_found.
(lex_one_token, classify_inner_name, c_print_token): Likewise.
(classify_name): Likewise. Rename the "sym" local variable to
"bsym".
* c-valprint.c (print_unpacked_pointer): Likewise.
* compile/compile-c-symbols.c (convert_symbol_sym): Promote the
"sym" parameter from struct symbol * to struct block_symbol.
Use it to remove uses of block_found. Deal with struct
symbol_in_block from lookup functions.
(gcc_convert_symbol): Likewise. Update the call to
convert_symbol_sym.
* compile/compile-object-load.c (compile_object_load): Deal with
struct symbol_in_block from lookup functions.
* cp-namespace.c (cp_lookup_nested_symbol_1,
cp_lookup_nested_symbol, cp_lookup_bare_symbol,
cp_search_static_and_baseclasses,
cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports,
cp_lookup_symbol_imports_or_template,
cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace,
lookup_namespace_scope, cp_lookup_nonlocal,
find_symbol_in_baseclass): Return struct symbol_in_block instead
of mere symbols and deal with struct symbol_in_block from lookup
functions.
* cp-support.c (inspect_type, replace_typedefs,
cp_lookup_rtti_type): Deal with struct symbol_in_block from
lookup functions.
* cp-support.h (cp_lookup_symbol_nonlocal,
cp_lookup_symbol_from_namespace,
cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol):
Return struct symbol_in_block instead of mere symbols.
* d-exp.y (d_type_from_name, d_module_from_name, push_variable,
push_module_name):
Deal with struct symbol_in_block from lookup functions. Remove
uses of block_found.
* eval.c (evaluate_subexp_standard): Update call to
cp_lookup_symbol_namespace.
* f-exp.y: Deal with struct symbol_in_block from lookup
functions. Remove uses of block_found.
(yylex): Likewise.
* gdbtypes.c (lookup_typename, lookup_struct, lookup_union,
lookup_enum, lookup_template_type, check_typedef): Deal with
struct symbol_in_block from lookup functions.
* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
* guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise.
(gdbscm_lookup_global_symbol): Likewise.
* gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise.
* go-exp.y: Likewise. Remove uses of block_found.
(package_name_p, classify_packaged_name, classify_name):
Likewise.
* infrun.c (insert_exception_resume_breakpoint): Likewise.
* jv-exp.y (push_variable): Likewise.
* jv-lang.c (java_lookup_class, get_java_object_type): Likewise.
* language.c (language_bool_type): Likewise.
* language.h (struct language_defn): Update
la_lookup_symbol_nonlocal to return a struct symbol_in_block
rather than a mere symbol.
* linespec.c (find_label_symbols): Deal with struct
symbol_in_block from lookup functions.
* m2-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* objc-lang.c (lookup_struct_typedef, find_imps): Likewise.
* p-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
* parse.c (write_dollar_variable): Likewise. Remove uses of
block_found.
* parser-defs.h (struct symtoken): Turn the SYM field into a
struct symbol_in_block.
* printcmd.c (address_info): Deal with struct symbol_in_block
from lookup functions.
* python/py-frame.c (frapy_read_var): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol,
gdbpy_lookup_global_symbol): Likewise.
* skip.c (skip_function_command): Likewise.
* solib-darwin.c (darwin_lookup_lib_symbol): Return a struct
symbol_in_block instead of a mere symbol.
* solib-spu.c (spu_lookup_lib_symbol): Likewise.
* solib-svr4.c (elf_lookup_lib_symbol): Likewise.
* solib.c (solib_global_lookup): Likewise.
* solist.h (solib_global_lookup): Likewise.
(struct target_so_ops): Update lookup_lib_global_symbol to
return a struct symbol_in_block rather than a mere symbol.
* source.c (select_source_symtab): Deal with struct
symbol_in_block from lookup functions.
* stack.c (print_frame_args, iterate_over_block_arg_vars):
Likewise.
* symfile.c (set_initial_language): Likewise.
* symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct
symbol_in_block.
(SYMBOL_LOOKUP_FAILED_P): New predicate as a macro.
(struct symbol_cache_slot): Turn the FOUND field into a struct
symbol_in_block.
(block_found): Remove.
(eq_symbol_entry): Update to deal with struct symbol_in_block in
cache slots.
(symbol_cache_lookup): Return a struct symbol_in_block rather
than a mere symbol.
(symbol_cache_mark_found): Add a BLOCK parameter to fill
appropriately the cache slots. Update callers.
(symbol_cache_dump): Update cache slots handling to the type
change.
(lookup_symbol_in_language, lookup_symbol, lookup_language_this,
lookup_symbol_aux, lookup_local_symbol,
lookup_symbol_in_objfile, lookup_global_symbol_from_objfile,
lookup_symbol_in_objfile_symtabs,
lookup_symbol_in_objfile_from_linkage_name,
lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal,
lookup_symbol_in_static_block, lookup_static_symbol,
lookup_global_symbol):
Return a struct symbol_in_block rather than a mere symbol. Deal
with struct symbol_in_block from other lookup functions. Remove
uses of block_found.
(lookup_symbol_in_block): Remove uses of block_found.
(struct global_sym_lookup_data): Turn the RESULT field into a
struct symbol_in_block.
(lookup_symbol_global_iterator_cb): Update references to the
RESULT field.
(search_symbols): Deal with struct symbol_in_block from lookup
functions.
* symtab.h (struct symbol_in_block): New structure.
(block_found): Remove.
(lookup_symbol_in_language, lookup_symbol,
basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block,
looku_static_symbol, lookup_global_symbol,
lookup_symbol_in_block, lookup_language_this,
lookup_global_symbol_from_objfile): Return a struct
symbol_in_block rather than just a mere symbol. Update comments
to remove mentions of block_found.
* valops.c (find_function_in_inferior,
value_struct_elt_for_reference, value_maybe_namespace_elt,
value_of_this): Deal with struct symbol_in_block from lookup
functions.
* value.c (value_static_field, value_fn_field): Likewise.
2015-07-21 17:02:15 +02:00
|
|
|
extern struct block_symbol cp_lookup_symbol_imports_or_template
|
2010-07-28 18:23:59 +02:00
|
|
|
(const char *scope,
|
|
|
|
const char *name,
|
|
|
|
const struct block *block,
|
|
|
|
const domain_enum domain);
|
|
|
|
|
Replace the block_found global with explicit data-flow
As Pedro suggested on gdb-patches@ (see
https://sourceware.org/ml/gdb-patches/2015-05/msg00714.html), this
change makes symbol lookup functions return a structure that includes
both the symbol found and the block in which it was found. This makes
it possible to get rid of the block_found global variable and thus makes
block hunting explicit.
gdb/
* ada-exp.y (write_object_renaming): Replace struct
ada_symbol_info with struct block_symbol. Update field
references accordingly.
(block_lookup, select_possible_type_sym): Likewise.
(find_primitive_type): Likewise. Also update call to
ada_lookup_symbol to extract the symbol itself.
(write_var_or_type, write_name_assoc): Likewise.
* ada-lang.h (struct ada_symbol_info): Remove.
(ada_lookup_symbol_list): Replace struct ada_symbol_info with
struct block_symbol.
(ada_lookup_encoded_symbol, user_select_syms): Likewise.
(ada_lookup_symbol): Return struct block_symbol instead of a
mere symbol.
* ada-lang.c (defns_collected): Replace struct ada_symbol_info
with struct block_symbol.
(resolve_subexp, ada_resolve_function, sort_choices,
user_select_syms, is_nonfunction, add_defn_to_vec,
num_defns_collected, defns_collected,
symbols_are_identical_enums, remove_extra_symbols,
remove_irrelevant_renamings, add_lookup_symbol_list_worker,
ada_lookup_symbol_list, ada_iterate_over_symbols,
ada_lookup_encoded_symbol, get_var_value): Likewise.
(ada_lookup_symbol): Return a block_symbol instead of a mere
symbol. Replace struct ada_symbol_info with struct
block_symbol.
(ada_lookup_symbol_nonlocal): Likewise.
(standard_lookup): Make block passing explicit through
lookup_symbol_in_language.
* ada-tasks.c (get_tcb_types_info): Update the calls to
lookup_symbol_in_language to extract the mere symbol out of the
returned value.
(ada_tasks_inferior_data_sniffer): Likewise.
* ax-gdb.c (gen_static_field): Likewise for the call to
lookup_symbol.
(gen_maybe_namespace_elt): Deal with struct symbol_in_block from
lookup functions.
(gen_expr): Likewise.
* c-exp.y: Likewise. Remove uses of block_found.
(lex_one_token, classify_inner_name, c_print_token): Likewise.
(classify_name): Likewise. Rename the "sym" local variable to
"bsym".
* c-valprint.c (print_unpacked_pointer): Likewise.
* compile/compile-c-symbols.c (convert_symbol_sym): Promote the
"sym" parameter from struct symbol * to struct block_symbol.
Use it to remove uses of block_found. Deal with struct
symbol_in_block from lookup functions.
(gcc_convert_symbol): Likewise. Update the call to
convert_symbol_sym.
* compile/compile-object-load.c (compile_object_load): Deal with
struct symbol_in_block from lookup functions.
* cp-namespace.c (cp_lookup_nested_symbol_1,
cp_lookup_nested_symbol, cp_lookup_bare_symbol,
cp_search_static_and_baseclasses,
cp_lookup_symbol_in_namespace, cp_lookup_symbol_via_imports,
cp_lookup_symbol_imports_or_template,
cp_lookup_symbol_via_all_imports, cp_lookup_symbol_namespace,
lookup_namespace_scope, cp_lookup_nonlocal,
find_symbol_in_baseclass): Return struct symbol_in_block instead
of mere symbols and deal with struct symbol_in_block from lookup
functions.
* cp-support.c (inspect_type, replace_typedefs,
cp_lookup_rtti_type): Deal with struct symbol_in_block from
lookup functions.
* cp-support.h (cp_lookup_symbol_nonlocal,
cp_lookup_symbol_from_namespace,
cp_lookup_symbol_imports_or_template, cp_lookup_nested_symbol):
Return struct symbol_in_block instead of mere symbols.
* d-exp.y (d_type_from_name, d_module_from_name, push_variable,
push_module_name):
Deal with struct symbol_in_block from lookup functions. Remove
uses of block_found.
* eval.c (evaluate_subexp_standard): Update call to
cp_lookup_symbol_namespace.
* f-exp.y: Deal with struct symbol_in_block from lookup
functions. Remove uses of block_found.
(yylex): Likewise.
* gdbtypes.c (lookup_typename, lookup_struct, lookup_union,
lookup_enum, lookup_template_type, check_typedef): Deal with
struct symbol_in_block from lookup functions.
* guile/scm-frame.c (gdbscm_frame_read_var): Likewise.
* guile/scm-symbol.c (gdbscm_lookup_symbol): Likewise.
(gdbscm_lookup_global_symbol): Likewise.
* gnu-v3-abi.c (gnuv3_get_typeid_type): Likewise.
* go-exp.y: Likewise. Remove uses of block_found.
(package_name_p, classify_packaged_name, classify_name):
Likewise.
* infrun.c (insert_exception_resume_breakpoint): Likewise.
* jv-exp.y (push_variable): Likewise.
* jv-lang.c (java_lookup_class, get_java_object_type): Likewise.
* language.c (language_bool_type): Likewise.
* language.h (struct language_defn): Update
la_lookup_symbol_nonlocal to return a struct symbol_in_block
rather than a mere symbol.
* linespec.c (find_label_symbols): Deal with struct
symbol_in_block from lookup functions.
* m2-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
* objc-lang.c (lookup_struct_typedef, find_imps): Likewise.
* p-exp.y: Likewise. Remove uses of block_found.
(yylex): Likewise.
* p-valprint.c (pascal_val_print): Likewise.
* parse.c (write_dollar_variable): Likewise. Remove uses of
block_found.
* parser-defs.h (struct symtoken): Turn the SYM field into a
struct symbol_in_block.
* printcmd.c (address_info): Deal with struct symbol_in_block
from lookup functions.
* python/py-frame.c (frapy_read_var): Likewise.
* python/py-symbol.c (gdbpy_lookup_symbol,
gdbpy_lookup_global_symbol): Likewise.
* skip.c (skip_function_command): Likewise.
* solib-darwin.c (darwin_lookup_lib_symbol): Return a struct
symbol_in_block instead of a mere symbol.
* solib-spu.c (spu_lookup_lib_symbol): Likewise.
* solib-svr4.c (elf_lookup_lib_symbol): Likewise.
* solib.c (solib_global_lookup): Likewise.
* solist.h (solib_global_lookup): Likewise.
(struct target_so_ops): Update lookup_lib_global_symbol to
return a struct symbol_in_block rather than a mere symbol.
* source.c (select_source_symtab): Deal with struct
symbol_in_block from lookup functions.
* stack.c (print_frame_args, iterate_over_block_arg_vars):
Likewise.
* symfile.c (set_initial_language): Likewise.
* symtab.c (SYMBOL_LOOKUP_FAILED): Turn into a struct
symbol_in_block.
(SYMBOL_LOOKUP_FAILED_P): New predicate as a macro.
(struct symbol_cache_slot): Turn the FOUND field into a struct
symbol_in_block.
(block_found): Remove.
(eq_symbol_entry): Update to deal with struct symbol_in_block in
cache slots.
(symbol_cache_lookup): Return a struct symbol_in_block rather
than a mere symbol.
(symbol_cache_mark_found): Add a BLOCK parameter to fill
appropriately the cache slots. Update callers.
(symbol_cache_dump): Update cache slots handling to the type
change.
(lookup_symbol_in_language, lookup_symbol, lookup_language_this,
lookup_symbol_aux, lookup_local_symbol,
lookup_symbol_in_objfile, lookup_global_symbol_from_objfile,
lookup_symbol_in_objfile_symtabs,
lookup_symbol_in_objfile_from_linkage_name,
lookup_symbol_via_quick_fns, basic_lookup_symbol_nonlocal,
lookup_symbol_in_static_block, lookup_static_symbol,
lookup_global_symbol):
Return a struct symbol_in_block rather than a mere symbol. Deal
with struct symbol_in_block from other lookup functions. Remove
uses of block_found.
(lookup_symbol_in_block): Remove uses of block_found.
(struct global_sym_lookup_data): Turn the RESULT field into a
struct symbol_in_block.
(lookup_symbol_global_iterator_cb): Update references to the
RESULT field.
(search_symbols): Deal with struct symbol_in_block from lookup
functions.
* symtab.h (struct symbol_in_block): New structure.
(block_found): Remove.
(lookup_symbol_in_language, lookup_symbol,
basic_lookup_symbol_nonlocal, lookup_symbol_in_static_block,
looku_static_symbol, lookup_global_symbol,
lookup_symbol_in_block, lookup_language_this,
lookup_global_symbol_from_objfile): Return a struct
symbol_in_block rather than just a mere symbol. Update comments
to remove mentions of block_found.
* valops.c (find_function_in_inferior,
value_struct_elt_for_reference, value_maybe_namespace_elt,
value_of_this): Deal with struct symbol_in_block from lookup
functions.
* value.c (value_static_field, value_fn_field): Likewise.
2015-07-21 17:02:15 +02:00
|
|
|
extern struct block_symbol
|
|
|
|
cp_lookup_nested_symbol (struct type *parent_type,
|
|
|
|
const char *nested_name,
|
|
|
|
const struct block *block,
|
|
|
|
const domain_enum domain);
|
2003-09-25 18:39:39 +02:00
|
|
|
|
2004-01-24 00:03:31 +01:00
|
|
|
struct type *cp_lookup_transparent_type (const char *name);
|
|
|
|
|
2013-11-25 22:37:08 +01:00
|
|
|
/* See description in cp-namespace.c. */
|
|
|
|
|
2014-12-17 07:13:57 +01:00
|
|
|
struct type *cp_find_type_baseclass_by_name (struct type *parent_type,
|
|
|
|
const char *name);
|
2013-11-25 22:37:08 +01:00
|
|
|
|
2007-10-22 16:37:36 +02:00
|
|
|
/* Functions from cp-name-parser.y. */
|
2005-03-11 03:24:23 +01:00
|
|
|
|
2016-11-29 05:39:47 +01:00
|
|
|
extern std::unique_ptr<demangle_parse_info> cp_demangled_name_to_comp
|
2011-08-18 18:17:39 +02:00
|
|
|
(const char *demangled_name, const char **errmsg);
|
2005-03-11 03:24:23 +01:00
|
|
|
|
|
|
|
extern char *cp_comp_to_string (struct demangle_component *result,
|
|
|
|
int estimated_len);
|
|
|
|
|
2011-08-18 18:17:39 +02:00
|
|
|
extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *,
|
|
|
|
struct demangle_component *,
|
|
|
|
struct demangle_parse_info *);
|
|
|
|
|
2003-09-11 David Carlton <carlton@kealia.com>
* gdbtypes.h: Add TYPE_CODE_NAMESPACE.
* gdbtypes.c (init_type): Handle TYPE_CODE_NAMESPACE.
(recursive_dump_type): Ditto.
* printcmd.c (print_formatted): Ditto.
* typeprint.c (print_type_scalar): Ditto.
* c-typeprint.c (c_type_print_varspec_prefix): Ditto.
(c_type_print_varspec_suffix, c_type_print_base): Ditto.
* cp-support.h: Declare cp_check_possible_namespace_symbols,
maint_cplus_cmd_list.
* cp-support.c: Make maint_cplus_cmd_list extern.
* cp-namespace.c: Include objfiles.h, gdbtypes.h, dictionary.h,
command.h.
(lookup_symbol_file): Look in possible namespace blocks when
appropriate.
(initialize_namespace_symtab): New.
(get_possible_namespace_block, free_namespace_block)
(check_possible_namespace_symbols)
(check_possible_namespace_symbols_loop)
(check_one_possible_namespace_symbol)
(lookup_possible_namespace_symbol, maintenance_cplus_namespace)
(_initialize_cp_namespace): Ditto.
* block.h: Declare allocate_block.
* block.c (allocate_block): New.
* jv-lang.c (get_java_class_symtab): Allocate blocks via
allocate_block.
* symfile.h: Update declaration of add_psymbol_to_list.
* symfile.c (add_psymbol_to_list): Return the partial symbol in
question.
* dwarf2read.c (dwarf2_build_psymtabs_hard): Add argument to
scan_partial_symbols_call.
(scan_partial_symbols): Add NAMESPACE argument; update calls to
helper functions.
(add_partial_symbol): If necessary, scan mangled names for names
of namespaces.
(add_partial_namespace): Add NAMESPACE argument; generate partial
symbols associated to namespaces.
(add_partial_enumeration): Add NAMESPACE argument.
(new_symbol): Allow namespace syms.
(read_namespace): Generate namespace syms.
* objfiles.h: Add opaque declaration of struct symtab.
(struct objfile): Add cp_namespace_symtab member.
* objfiles.c (allocate_objfile): Set
objfile->cp_namespace_symtab.
* Makefile.in (cp-namespace.o): Depend on objfiles_h, gdbtypes_h,
dictionary_h, command_h.
2003-09-11 David Carlton <carlton@kealia.com>
* gdb.c++/namespace.exp: Add tests for namespace types.
* gdb.c++/maint.exp (test_help): Test 'help maint cp namespace'.
(test_namespace): New.
2003-09-11 21:49:20 +02:00
|
|
|
/* The list of "maint cplus" commands. */
|
|
|
|
|
|
|
|
extern struct cmd_list_element *maint_cplus_cmd_list;
|
|
|
|
|
2013-04-15 19:30:36 +02:00
|
|
|
/* A wrapper for bfd_demangle. */
|
|
|
|
|
|
|
|
char *gdb_demangle (const char *name, int options);
|
|
|
|
|
2016-05-26 23:04:07 +02:00
|
|
|
/* Like gdb_demangle, but suitable for use as la_sniff_from_mangled_name. */
|
|
|
|
|
|
|
|
int gdb_sniff_from_mangled_name (const char *mangled, char **demangled);
|
|
|
|
|
2003-04-15 David Carlton <carlton@math.stanford.edu>
* Makefile.in (SFILES): Add cp-namespace.c.
(COMMON_OBS): Add cp-namespace.o.
(block.o): Depend on gdb_obstack_h and cp_support_h.
(buildsym.o): Depend on cp_support_h.
(cp-namespace.o): New.
(cp-support.o): Depend on gdb_string_h, demangle_h, gdb_assert_h,
gdb_obstack_h, symtab_h, symfile_h, and gdbcmd_h.
(dwarf2read.o): Depend on cp_support_h.
* jv-lang.c (get_java_class_symtab): Set BLOCK_NAMESPACE.
* dwarf2read.c (process_die): Set processing_has_namespace_info,
processing_current_namespace.
(read_namespace): Update processing_current_namespace; check for
anonymous namespaces.
(dwarf2_name): New function.
(dwarf2_extension): Ditto.
* cp-support.h: Update copyright, contributors.
Add inclusion guards.
Add opaque declaration for structs obstack, block, symbol.
(struct using_direct): New struct.
Add declarations for cp_find_first_component,
cp_entire_prefix_len, processing_has_namespace_info,
processing_current_namespace, cp_is_anonymous,
cp_add_using_directive, cp_initialize_namespace,
cp_finalize_namespace, cp_set_block_scope,
cp_scan_for_anonymous_namespaces.
* cp-namespace.c: New file.
* cp-support.c: Update copyright.
Include ctype.h, gdb_assert.h, gdbcmd.h.
New variable maint_cplus_cmd_list.
(cp_find_first_component): New function.
(cp_entire_prefix_len, maint_cplus_command)
(first_component_command, _initialize_cp_support): Ditto.
* buildsym.c: Include cp-support.h.
New variable using_list.
(add_symbol_to_list): Check for anonymous namespaces.
(finish_block): Set block's scope.
(start_symtab): Initialize C++ namespace support.
(end_symtab): Finalize C++ namespace support.
* block.h: Add opaque declarations for structs
block_namespace_info, using_direct, and obstack.
Add declarations for block_set_scope and block_set_using.
(struct block): Add 'language_specific' member.
(BLOCK_NAMESPACE): New macro.
* block.c: Include gdb_obstack.h and cp-support.h.
(struct block_namespace_info): New struct.
(block_set_scope): New function.
(block_set_using, block_initialize_namespace): Ditto.
2003-04-15 David Carlton <carlton@math.stanford.edu>
* gdb.c++/maint.exp: New file.
2003-04-16 01:07:11 +02:00
|
|
|
#endif /* CP_SUPPORT_H */
|