Alexandr,
I applied your 2nd patch as-is, but when I run crash on a live system (RHEL7),
it crashes with SIGSEGV during initialization with what appears to be to
recursive calls to get_member_data() from your patch:
Starting program: /root/crash.git/./crash
crash 7.1.5++
Copyright (C) 2002-2016 Red Hat, Inc.
Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
Copyright (C) 1999-2006 Hewlett-Packard Co
Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
Copyright (C) 2005, 2011 NEC Corporation
Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
This program is free software, covered by the GNU General Public License,
and you are welcome to change it and/or distribute copies of it under
certain conditions. Enter "help copying" to see the conditions.
This program has absolutely no warranty. Enter "help warranty" for details.
Detaching after fork from child process 11568.
Detaching after fork from child process 11569.
Detaching after fork from child process 11571.
Detaching after fork from child process 11572.
Detaching after fork from child process 11573.
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu"...
Detaching after fork from child process 11574.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6f2acda in _int_malloc () from /lib64/libc.so.6
(gdb)
#0 0x00007ffff6f2acda in _int_malloc () from /lib64/libc.so.6
#1 0x00007ffff6f2c87c in malloc () from /lib64/libc.so.6
#2 0x00000000007705c8 in xmalloc (size=size@entry=32) at ./common/common-utils.c:51
#3 0x00000000006371f6 in make_my_cleanup2 (free_arg=0x0, arg=0x0, function=0x637380
<null_cleanup>,
pmy_chain=0xce0f58 <cleanup_chain>) at cleanups.c:82
#4 make_my_cleanup (arg=0x0, function=0x637380 <null_cleanup>, pmy_chain=0xce0f58
<cleanup_chain>) at cleanups.c:108
#5 make_cleanup (function=0x637380 <null_cleanup>, arg=arg@entry=0x0) at
cleanups.c:119
#6 0x00000000006d42e5 in find_slot_in_mapped_hash (index=0x13dcb10,
name=name@entry=0x7fffffffc840 "vm_area_struct",
vec_out=vec_out@entry=0x7fffff7ff0e8) at dwarf2read.c:2565
#7 0x00000000006ec9f1 in dw2_symtab_iter_init (name=0x7fffffffc840
"vm_area_struct", domain=STRUCT_DOMAIN, block_index=0,
want_specific_block=1, index=<optimized out>, iter=0x7fffff7ff0d0) at
dwarf2read.c:3164
#8 dw2_lookup_symbol (objfile=<optimized out>, block_index=0, name=0x7fffffffc840
"vm_area_struct", domain=STRUCT_DOMAIN)
at dwarf2read.c:3255
#9 0x000000000065f64b in basic_lookup_transparent_type_quick
(objfile=objfile@entry=0x13bf190, kind=kind@entry=0,
name=name@entry=0x7fffffffc840 "vm_area_struct") at symtab.c:1856
#10 0x000000000065f845 in basic_lookup_transparent_type (name=0x7fffffffc840
"vm_area_struct") at symtab.c:1925
#11 0x000000000065c91e in lookup_transparent_type (name=<optimized out>) at
symtab.c:1839
#12 get_member_data (req=req@entry=0xf60a00 <shared_bufs>, type=0x4bfce90,
offset=77075392) at symtab.c:5497
#13 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77075392)
at symtab.c:5516
#14 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77073920)
at symtab.c:5516
#15 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77073920)
at symtab.c:5516
#16 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77072448)
at symtab.c:5516
#17 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77072448)
at symtab.c:5516
#18 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77070976)
at symtab.c:5516
#19 0x000000000065c8a4 in get_member_data (req=req@entry=0xf60a00 <shared_bufs>,
type=<optimized out>, offset=77070976)
... [ continues endlessly ] ...
I gave up following the backtrace after ~35000 calls to get_member_data().
Dave
----- Original Message -----
----- Original Message -----
> Dave,
>
> Please disregard the previous message. It looks like the patch is going to
> be
> more complicated:
Alexandr,
Can you make your symtab.c patches a discrete patchset that gets appended
to gdb-7.6.patch? It needs to be that way in order to get recognized and
applied correctly to a pre-existing source tree.
Thanks,
Dave
>
> diff --git a/gdb-7.6.patch b/gdb-7.6.patch
> index 794555f..4718b11 100644
> --- a/gdb-7.6.patch
> +++ b/gdb-7.6.patch
> @@ -351,7 +351,7 @@
> return lookup_symbol_in_language (name, block, domain,
> current_language->la_language,
> is_a_field_of_this);
> -@@ -5100,3 +5115,662 @@ When enabled, debugging messages are pri
> +@@ -5100,3 +5115,666 @@ When enabled, debugging messages are pri
>
> observer_attach_executable_changed
> (symtab_observer_executable_changed);
> }
> @@ -362,7 +362,7 @@
> +#define GDB_COMMON
> +#include "../../defs.h"
> +
> -+static void get_member_data(struct gnu_request *, struct type *);
> ++static void get_member_data(struct gnu_request *, struct type *, off_t);
> +static void dump_enum(struct type *, struct gnu_request *);
> +static void eval_enum(struct type *, struct gnu_request *);
> +static void gdb_get_line_number(struct gnu_request *);
> @@ -551,7 +551,7 @@
> + req->typecode = TYPE_CODE(sym->type);
> + req->length = TYPE_LENGTH(sym->type);
> + if (req->member)
> -+ get_member_data(req, sym->type);
> ++ get_member_data(req, sym->type, 0);
> +
> + if (TYPE_CODE(sym->type) == TYPE_CODE_ENUM) {
> + if (req->flags & GNU_PRINT_ENUMERATORS)
> @@ -621,7 +621,7 @@
> + }
> +
> + if (req->member)
> -+ get_member_data(req, type);
> ++ get_member_data(req, type, 0);
> +
> + break;
> +
> @@ -704,7 +704,7 @@
> + * member field, and when found, return its relevant data.
> + */
> +static void
> -+get_member_data(struct gnu_request *req, struct type *type)
> ++get_member_data(struct gnu_request *req, struct type *type, off_t offset)
> +{
> + register short i;
> + struct field *nextfield;
> @@ -729,13 +729,17 @@
> +
> + for (i = 0; i < nfields; i++) {
> + if (STREQ(req->member, nextfield->name)) {
> -+ req->member_offset = nextfield->loc.bitpos;
> ++ req->member_offset = offset + nextfield->loc.bitpos;
> + req->member_length = TYPE_LENGTH(nextfield->type);
> + req->member_typecode = TYPE_CODE(nextfield->type);
> + if ((req->member_typecode == TYPE_CODE_TYPEDEF) &&
> + (typedef_type = check_typedef(nextfield->type)))
> + req->member_length = TYPE_LENGTH(typedef_type);
> + return;
> ++ } else if (*nextfield->name == 0) { /* Anonymous struct/union */
> ++ get_member_data(req, nextfield->type, offset + nextfield->loc.bitpos);
> ++ if (req->member_offset != -1)
> ++ return;
> + }
> + nextfield++;
> + }
> @@ -930,7 +934,7 @@
> + }
> +
> + if (req->member)
> -+ get_member_data(req, type);
> ++ get_member_data(req, type, 0);
> +
> + do_cleanups (old_chain);
> +}
>
> Waiting for your comments.
>
> Thanks,
> Alexandr.
> ________________________________________
> From: crash-utility-bounces(a)redhat.com <crash-utility-bounces(a)redhat.com>
> on
> behalf of Alexandr Terekhov <Alexandr_Terekhov(a)epam.com>
> Sent: Monday, August 22, 2016 16:12
> To: Discussion list for crash utility usage, maintenance and development
> Subject: Re: [Crash-utility] Speed up list/tree '-s' output.
>
> Hi Dave,
>
> while I was working on your suggestions, I faced the following problem:
>
> (gdb) call datatype_info("page", "mapping", -3)
> $1 = 0
>
> It happens because entire anonymous structure is represented as single
> field
> with empty name within gdb.
> Please, consider the patch which fixes such behavior:
> (gdb) call datatype_info("page", "mapping", -3)
> $1 = 1
> (gdb) call datatype_info("page", "index", -3)
> $5 = 8
> (gdb) call datatype_info("page", "lru", -3)
> $6 = 3
> (gdb) call datatype_info("page", "objects", -3)
> $7 = 22
>
> diff --git a/gdb-7.6.patch b/gdb-7.6.patch
> index 794555f..8a61f20 100644
> --- a/gdb-7.6.patch
> +++ b/gdb-7.6.patch
> @@ -351,7 +351,7 @@
> return lookup_symbol_in_language (name, block, domain,
> current_language->la_language,
> is_a_field_of_this);
> -@@ -5100,3 +5115,662 @@ When enabled, debugging messages are pri
> +@@ -5100,3 +5115,666 @@ When enabled, debugging messages are pri
>
> observer_attach_executable_changed
> (symtab_observer_executable_changed);
> }
> @@ -736,6 +736,10 @@
> + (typedef_type =
> check_typedef(nextfield->type)))
> + req->member_length =
> TYPE_LENGTH(typedef_type);
> + return;
> ++ } else if (*nextfield->name == 0) { /* Anonymous
> struct/union
> */
> ++ get_member_data(req, nextfield->type);
> ++ if (req->member_offset != -1)
> ++ return;
> + }
> + nextfield++;
> + }
>
> ______________________________________
> From: crash-utility-bounces(a)redhat.com <crash-utility-bounces(a)redhat.com>
> on
> behalf of Dave Anderson <anderson(a)redhat.com>
> Sent: Thursday, August 18, 2016 23:39
> To: Discussion list for crash utility usage, maintenance and development
> Subject: Re: [Crash-utility] Speed up list/tree '-s' output.
>
> Another suggestion:
>
> Use MEMBER_TYPE(), or pass a datatype_member structure to datatype_info(),
> in
> order to determine whether a structure member is TYPE_CODE_PTR, and if so,
> always
> print the member in hexadecimal regardless of the current radix. (i.e.
> like
> gdb does)
>
> Dave
>
> --
> Crash-utility mailing list
> Crash-utility(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/crash-utility
>
> --
> Crash-utility mailing list
> Crash-utility(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/crash-utility
>
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility