Giter Club home page Giter Club logo

core_analyzer's People

Contributors

celthi avatar yanqi27 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core_analyzer's Issues

error encountered using heap command

I successfully build gdb 7.11.1, but when I use to it analyze heap for a core file, error reported. The core file was generated by gcore command for a process which was running well. So, I believe there is no memory corruption.
glibc version is 2.17.

(gdb) heap
Failed to read heap_info at 0xec000000
Tuning params & stats:
mmap_threshold=131072
pagesize=4096
n_mmaps=0
n_mmaps_max=65536
total mmap regions created=0
mmapped_mem=0
sbrk_base=0xa268000
Main arena (0xf73a5420) owns regions:
[0x55202b2b354499c0 - 0x55202b2b354aa9b0] Total 387KBFailed to get the first chunk at 0x55202b2b354499b0

    Dynamic arena (0xede00010) owns regions:

1 Errors encountered while walking the heap!
[Error] Failed to walk heap

(gdb) heap /v
Tuning params & stats:
mmap_threshold=131072
pagesize=4096
n_mmaps=0
n_mmaps_max=65536
total mmap regions created=0
mmapped_mem=0
sbrk_base=0xa268000
Main arena (0xf73a5420) owns regions:
[0x55202b2b354499c0 - 0x55202b2b354aa9b0] Total 387KBFailed to get the first chunk at 0x55202b2b354499b0

    Dynamic arena (0xede00010) owns regions:

1 Errors encountered while walking the heap!
[Error] Failed to walk heap

Failed to walk heap for demo program with one thread

I got the following error while walking the heap for the following code,
error

Cannot find thread-local storage for process 92798, shared library /lib/x86_64-linux-gnu/libc.so.6:
Cannot find thread-local variables on this target

Code

int main() {
   int * p = new int(4);
   *p = 7;
   return 0;
  }

After debugging and searching, it seems for the program above, the ptmalloc will not have "thread-local variables tcache ".
Previously the gdb does not throw exception but now it throws exception. We might need to catch the exception.
Similar issue in cloudburst/libheap#24.

(gdb) bt
#0  0x00007ffff76aed1d in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x000055555573c914 in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR, 
    error=GENERIC_ERROR, fmt=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s", ap=0x7fffffffce30)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdbsupport/common-exceptions.c:200
#2  0x000055555573c99d in throw_verror (error=GENERIC_ERROR, fmt=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s", 
    ap=0x7fffffffce30) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdbsupport/common-exceptions.c:208
#3  0x0000555555a00d9a in verror (string=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s", args=0x7fffffffce30)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/utils.c:170
#4  0x0000555555741780 in error (fmt=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s")
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdbsupport/errors.c:43
#5  0x00005555559b0d50 in target_translate_tls_address (objfile=0x555556666b30, offset=64)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/target.c:755
#6  0x0000555555686632 in dwarf_evaluate_loc_desc::get_tls_address (this=0x7fffffffd270, offset=64)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:608
#7  0x0000555555679fca in dwarf_expr_context::execute_stack_op (this=0x7fffffffd270, op_ptr=0x7ffff60ab0a7 "\006\bNL", op_end=0x7ffff60ab0a7 "\006\bNL")
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2expr.c:1177
#8  0x0000555555677d2e in dwarf_expr_context::eval (this=0x7fffffffd270, addr=0x7ffff60ab09d "\016@", len=10)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2expr.c:302
#9  0x0000555555680f88 in dwarf2_evaluate_loc_desc_full (type=0x555556c81bc0, frame=0x0, data=0x7ffff60ab09d "\016@", size=10, per_cu=0x5555568c12e0, 
    subobj_type=0x555556c81bc0, subobj_byte_offset=0) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:2166
#10 0x000055555568175d in dwarf2_evaluate_loc_desc (type=0x555556c81bc0, frame=0x0, data=0x7ffff60ab09d "\016@", size=10, per_cu=0x5555568c12e0)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:2348
#11 0x0000555555683d3f in locexpr_read_variable (symbol=0x555556c81b70, frame=0x0)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:3524
#12 0x0000555555711a9e in default_read_var_value (var=0x555556c81b70, var_block=0x0, frame=0x0)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/findvar.c:610
#13 0x00005555557125f9 in read_var_value (var=0x555556c81b70, var_block=0x0, frame=0x0)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/findvar.c:815
#14 0x0000555555a108e3 in value_of_variable (var=0x555556c81b70, b=0x0) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/valops.c:1293
#15 0x000055555577d275 in thread_tcache (info=0x5555563467a0, data=0x0) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:919
#16 0x00005555559cdd7c in iterate_over_threads (callback=0x55555577d1cc <thread_tcache(thread_info*, void*)>, data=0x0)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/thread.c:572
#17 0x000055555577d504 in build_tcache () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:969
#18 0x000055555577f4f1 in build_heaps_internal (main_arena_vaddr=140737348127808, mparams_vaddr=140737348125312)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:1483
#19 0x000055555577f7c6 in build_heaps () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:1574
#20 0x000055555577b94b in init_heap () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:221
---Type <return> to continue, or q <return> to quit---
#21 0x00005555557227c6 in update_memory_segments_and_heaps () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdb_dep.c:428
#22 0x0000555555780e69 in heap_command (args=0x0, from_tty=1) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heapcmd.c:21
#23 0x00005555555bf9a4 in do_const_cfunc (c=0x5555562a7fa0, args=0x0, from_tty=1)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/cli/cli-decode.c:107
#24 0x00005555555c2ec3 in cmd_func (cmd=0x5555562a7fa0, args=0x0, from_tty=1)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/cli/cli-decode.c:1952
#25 0x00005555559d7c50 in execute_command (p=0x5555562509c4 "", from_tty=1) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/top.c:651
#26 0x00005555556fb92a in command_handler (command=0x5555562509c0 "heap") at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:587
#27 0x00005555556fbda4 in command_line_handler (rl=...) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:772
#28 0x00005555556fb08f in gdb_rl_callback_handler (rl=0x5555564f4930 "heap") at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:218
#29 0x0000555555a59dd2 in rl_callback_read_char () at /workspaces/core_analyzer/build/gdb-9.2/build/../readline/readline/callback.c:281
#30 0x00005555556faeb7 in gdb_rl_callback_read_char_wrapper_noexcept () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:176
#31 0x00005555556faf61 in gdb_rl_callback_read_char_wrapper (client_data=0x555556250730)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:193
#32 0x00005555556fb7bc in stdin_event_handler (error=0, client_data=0x555556250730)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:515
#33 0x00005555556f93c8 in handle_file_event (file_ptr=0x555556355d60, ready_mask=1)
    at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:731
#34 0x00005555556f9991 in gdb_wait_for_event (block=1) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:857
#35 0x00005555556f8797 in gdb_do_one_event () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:346
#36 0x00005555556f87c1 in start_event_loop () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:370
#37 0x000055555582a6e7 in captured_command_loop () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/main.c:359
#38 0x000055555582bf6c in captured_main (data=0x7fffffffe010) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/main.c:1202
#39 0x000055555582bfd2 in gdb_main (args=0x7fffffffe010) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/main.c:1217
#40 0x00005555554c8cb3 in main (argc=1, argv=0x7fffffffe118) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdb.c:32

How to use the tool?

Execute me, I can't find any introduction how to build and use, I don't find a makefile, a CMakeLists.txt or a configure, could you offer a Getting Started?
thank you

It seems there is a memory leak

Direct leak of 245 byte(s) in 7 object(s) allocated from:
    #0 0x7f31ef6e59a7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
    #1 0x55de40b3580c in set_segment_module_type /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/gdb_dep.c:302
    #2 0x55de40b360f1 in build_segments /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/gdb_dep.c:405
    #3 0x55de40b365c2 in update_memory_segments_and_heaps() /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/gdb_dep.c:467
    #4 0x55de40bcfc0a in ref_command /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/heapcmd.c:33
    #5 0x55de4077a24a in do_simple_func /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/cli/cli-decode.c:95
    #6 0x55de4078815b in cmd_func(cmd_list_element*, char const*, int) /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/cli/cli-decode.c:2514
    #7 0x55de4130ab98 in execute_command(char const*, int) /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/top.c:702
    #8 0x55de40ab67a2 in command_handler(char const*) /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:597
    #9 0x55de40ab7113 in command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:800
    #10 0x55de41378034 in tui_command_line_handler /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/tui/tui-interp.c:278
    #11 0x55de40ab5164 in gdb_rl_callback_handler /workspaces/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:229
    #12 0x55de41496257 in rl_callback_read_char /workspaces/core_analyzer/build/gdb-12.1/build/../readline/readline/callback.c:281

core_analyser on Redhat 7 with tcmalloc 2.6.1

Trying to get core_analyzer running on a 64-bit RedHat 7.2 running with tcmalloc 2.6.1

The standalone core_analyzer doesn't seem to have a makefile for building with tcmalloc support -- is that the case?

Tried building gdb-7.11.1 instead.

Looking in gdbplus/gdb-7.11.1/gdb I see two Makefile.in files. assume Makefile.in.tcmalloc if for the tcmalloc build.. Used that in the gdb source tree.

The build for gdb broke here

CONFIG_HEADERS=config.h:config.in \
  CONFIG_COMMANDS="default depdir" \
  CONFIG_FILES= \
  CONFIG_LINKS= \
  /bin/sh config.status
./observer.sh h ./doc/observer.texi observer.h
./observer.sh inc ./doc/observer.texi observer.inc
Creating observer.itmp
Creating observer.htmp
make[2]: *** No rule to make target `common/linux-osdata.c', needed by `linux-osdata.o'.  Stop.

I got gdb to compile by using the gdbplus/gdb-7.11.1/gdb/Makefile.in and changed all instances of ptmalloc to tcmalloc.

Next issue was getting the heap command to run in gdb.

(gdb) heap
Failed to lookup type "TCMalloc_PageMap3<35>::Leaf" and "tcmalloc::Span"
Do you forget to download debug symbol of libtcmalloc?
tcmalloc heap was not initialized successfully
[Error] Failed to walk heap

Looks like that message is coming from this section in parse_pagemap.c

	leaf_type = lookup_transparent_type("TCMalloc_PageMap3<35>::Leaf");
	span_type = lookup_transparent_type("tcmalloc::Span");
	if (leaf_type == NULL || span_type == NULL) {
		CA_PRINT("Failed to lookup type "
		    "\"TCMalloc_PageMap3<35>::Leaf\" and "
		    "\"tcmalloc::Span\"\n");
		CA_PRINT("Do you forget to download debug symbol of "
		    "libtcmalloc?\n");
		return false;
	}

When I look for those symbols manually in gdb, I do see tcmalloc::Span, but not TCMalloc_PageMap3<35>::Leaf

(gdb) ptype tcmalloc::Span
type = struct tcmalloc::Span {
    PageID start;
    Length length;
    tcmalloc::Span *next;
    tcmalloc::Span *prev;
    void *objects;
    unsigned int refcount : 16;
    unsigned int sizeclass : 8;
    unsigned int location : 2;
    unsigned int sample : 1;
}

(gdb) ptype TCMalloc_PageMap3<35>::Leaf
No symbol "TCMalloc_PageMap3<35>" in current context.

Enclosing the symbol with double quotes seems to make it visible.

(gdb) ptype "TCMalloc_PageMap3<35>::Leaf"
type = char [28]

Any ideas how to proceed?

I have installed libc6-dbg,“(gdb) heap Failed to extract heap metadata from gv mp_ == The memory manager is assumed to be glibc 2.31 == == If this is not true, please debug with another machine with matching glibc ==

failed to init heap command


1.
dpkg -s libc6-dbg
Package: libc6-dbg
Status: install ok installed
Priority: optional
Section: debug
Installed-Size: 29293
Maintainer: Ubuntu Developers [email protected]
Architecture: amd64
Multi-Arch: same
Source: glibc
Version: 2.31-0ubuntu9.9
Provides: libc-dbg
Depends: libc6 (= 2.31-0ubuntu9.9)
Description: GNU C Library: detached debugging symbols
This package contains the detached debugging symbols for the GNU C
library.
Homepage: https://www.gnu.org/software/libc/libc.html
Build-Ids: 00329f3d85e153a01672b77b853beda0faf0dee6 00c4ae3a65bc87ea96986b3b2441e892c8a433f0 00cd9124f765fe93560701d55d5c61c37be4657a 01177dee353e3e44244586eed35b15f161a63908 03505bbb2b0381d376b10ba11b0d82f36a29155d 03c1af6b8e962c17f07c5bea32165949660247d7 03f2e8478015abbd5470fef1563891e73f50feb3 05843abad5bc67a085e946f5ec426432fadf9086 05c14e24b1b2c812a1562ccd088eb0c1aaefe986 06f472d792b9657763598d176e803e33b310df2d 07c3def9d91e67555518771f0ab9c4f7d8b4c5f5 08a4b38da60fb6b41e3d10eb8627d08d8185f12a 094e706d84e9825d421496d5a7ce130ee8277ec4 097e37c0bea103373b3741b8bdca0772e6cfecf6 0c0e2959ab6a676c25d954521955902933e940c0 0cbc03e1cdf23ebd100ec83a8bf024a40210c1ce 0cd7222ce7ccb36bd00574b88e763beb2d71f4d1 0e6d0cbb2d401ec427997c2c3bec0cc461e4801d 0e82e05bb8a77614e55d4e94a3a111acdedf99d8 0ebd68a83bda746684483d7c63958c5b42be1c6b 0f55867a69716900ba6b7a3e43a350a912a74b68 10ec8356b1c7ec55f7b297dbeb40e83d64ab8292 11bd9fe7778d95a0dd93124f416754137c9b097c 121e85d062973da7e3f0736bfb2bb2d30f4a8d5d 12ca5ba6012d816eec6b6add4d23b883f2b830e3 1326af6014e3796af39155a836a0886843d1097b 13316643db72f54092be4ed62327bba6a12054fa 1355e78564f5c0fb3dd0e6fa9170250932d57346 1369b9a1a0ed2dfab09490bca78eb250fc234b2c 141b9f727e7e8afb2190e46521d4b99009bfb040 14c0ed437f22045a47de6669a2287bd4defb543

.gdbinit
set debug-file-directory /usr/lib/debug

./a.out core-a.out-54759-1665391675 --data-directory=/usr/local/gdb12/share/gdb
GNU gdb (GDB) 12.1
Copyright (C) 2022 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
https://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...

warning: exec file is newer than core file.
[New LWP 54759]
Core was generated by `./a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000056016c2fa161 in main () at t1.c:6
6 *p = 1;
(gdb) bt
#0 0x000056016c2fa161 in main () at t1.c:6
(gdb) heap
Failed to extract heap metadata from gv mp_
== The memory manager is assumed to be glibc 2.31 ==
== If this is not true, please debug with another machine with matching glibc ==
failed to init heap
(gdb)

Argument required (expression to compute). When using heap /u <expr>

Environment: Self-complied gdb with core_analyzer, gdb 7.11, Debian9 & 5.4.56.xxx-amd64 (xxx is an inner version).

Version: master, 037f54e

Seems a bug at

expr = option;

expr is a pointer to a myargs, which is freed at

free(myargs);

then we use expr at

if (expr)
causing gdb got bad argument.

Maybe we should copy expr and free it after evalute?

can't use heap cmd in gdb which compiled by gdb-12.1 with core_analyzer src

problem:

(gdb) heap
Cannot get the "__libc_version" from the debugee, read it from the host machine. This might not be accurate.
Cannot get the "__libc_version" from the debugee, read it from the host machine. This might not be accurate.
Cannot get the "_libc_version" from the debugee, read it from the host machine. This might not be accurate.
Failed to get the addresses of global variables main_arena & mp

failed to init heap

my src:
1 #include
2 using namespace std;
3
4 void mem_leak_test() {
5 for (int i = 0; i < 10; i++) {
6 char *p = new char[10];
7 }
8 }
10 int main() {
11 mem_leak_test();
12
13 return 0;
14 }

how to force rebuild heap info while living debug

While I stepping my programming, core_analyzer walk failed util /proc/pid/maps changes.
so I have to use gdb over gdb to hack linux_nat_find_memory_regions return false.

Step 1: re-walk heap failed after step throng some functions

(gdb) heap /v
        Tuning params & stats:
                mmap_threshold=131072
                pagesize=4096
                n_mmaps=0
                n_mmaps_max=65536
                total mmap regions created=0
                mmapped_mem=0
                sbrk_base=0x555555771000
        Main arena (0x7ffff779f6e0) owns regions:
                [0x555555771010 - 0x555555792000] Total 131KB
Error: chunk at 0x54552e53555f6e65 in fastbin[0] is misaligned
        Chunk address comes from previous fastbin chunk at 0x555555771000 with fd=0x54552e53555f6e65

Error: chunk at 0x555555771010 witch bk=0x81 that does not point to previous chunk
        Chunk address comes from previous bin[1] chunk at 0x555555771020 with {fd=0x555555771010, bk=0x7ffff6b105e0}


1 Errors encountered while walking the heap!

Step2: use ANOTHER gdb to hijack linux_nat_find_memory_regions

(gdb) return false
Make linux_nat_find_memory_regions(bool) return now? (y or n) y

#0  0x00000000005d7a2f in update_memory_segments_and_heaps () at gdb_dep.c:457
457                     if (g_debug_core || linux_nat_find_memory_regions(false))

step 3: now heap walk works.

(gdb) heap /v
Target process has changed. Rebuild heap information
        Tuning params & stats:
                mmap_threshold=131072
                pagesize=4096
                n_mmaps=0
                n_mmaps_max=65536
                total mmap regions created=0
                mmapped_mem=0
                sbrk_base=0x555555771000
        Main arena (0x7ffff779f6e0) owns regions:
                [0x555555771010 - 0x555555792000] Total 131KB in-use 9(2KB) free 2(129KB)

        There are 1 arenas Total 131KB
        Total 9 blocks in-use of 2KB
        Total 2 blocks free of 129KB

        ========== In-use Memory Histogram ==========
        Size-Range     Count       Total-Bytes
        16 - 32        1(11%)      24(0%)
        64 - 128       4(44%)      432(15%)
        128 - 256      1(11%)      216(7%)
        256 - 512      1(11%)      440(15%)
        512 - 1024     2(22%)      1KB(60%)
        Total          9           2KB
        ========== Free Memory Histogram ==========
        Size-Range     Count       Total-Bytes
        64 - 128       1(50%)      72(0%)
        128KB - 256KB  1(50%)      129KB(99%)
        Total          2           129KB

Rebuild policy expect to be more smart or support manual.

Best regards.

Compile failed in WSL

tried gdb 12.1 and 9.2, the same problem on WSL or Redhat 7.4

configure: updating cache ./config.cache
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile.gnulib.inc
config.status: creating Makefile
config.status: creating import/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default commands
make[1]: Leaving directory `/data/home/ricky/core_analyzer-2.22.0/build/gdb-12.1/build'
make: *** [all] Error 2

make check failed on with rhel 7.6

Hi,

Test failed on RHEL 7.6 both with prebuilt and source compiled gdb-8.1.

The source version 2.21.0

$ git describe --tags 
2.21.0

With prebuilt gdb-8.1 and --data-directory=/opt/rh/devtoolset-8/root/usr/share/gdb/

$ make check
../bin/Linux/ptmalloc/gdb-8.1/gdb --data-directory=/opt/rh/devtoolset-8/root/usr/share/gdb/  mallocTest -q -x verify.py | grep ca_test
[ca_test] ==== Test Against Live Process ====
[ca_test] Checking heap blocks ...
[ca_test]	Verified 8209 heap blocks
[ca_test] Checking biggest heap blocks ...
[ca_test]	Found top 16 biggest heap blocks
[ca_test] Checking heap walk ...
[ca_test] Heap walk misses in-use block: addr=0x7ffff0000b40 size=648
[ca_test] Test Failed
[ca_test] Test failed

Then with gdb-8.1 compiled from source:

$ /home/xxx/dks/opt/bin/gdb --version
GNU gdb (GDB) 8.1
Copyright (C) 2018 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
$ make check
g++ -g -m64 -fpermissive -c mallocTest.cpp
g++ -g -m64 -fpermissive -o mallocTest mallocTest.o -lpthread 
/home/xxx/dks/opt/bin/gdb --data-directory=/home/xxx/dks/opt/share/gdb  mallocTest -q -x verify.py | grep ca_test
[ca_test] ==== Test Against Live Process ====
[ca_test] Checking heap blocks ...
[ca_test]	Verified 8209 heap blocks
[ca_test] Checking biggest heap blocks ...
[ca_test]	Found top 16 biggest heap blocks
[ca_test] Checking heap walk ...
[ca_test] Heap walk misses in-use block: addr=0x7ffff0000a90 size=776
[ca_test] Test Failed
[ca_test] Test failed

Build v2.20 stand alone binary on CentOs 7.8 failed

hi Michael,

I ran the following command and got error, can you help?

cd core_analyzer-2.20.0/app/Linux
make

And I got the following error:

make: *** No rule to make target search.o', needed by core_analyzer'. Stop.

BTW, my local gdb version is 7.6.1

segfault in Core Analyzer

I try to analyze dump witch was created by gcore. And Core Analyzer crushed

{ "signal": 11
, "executable": "/home/korden/core_analyzer-2.17.0/app/Linux/core_analyzer"
, "stacktrace":
[ { "crash_thread": true
, "frames":
[ { "address": 4242143
, "build_id": "d4eced4303dcf56ece60431a2702f7a48a26c422"
, "build_id_offset": 47839
, "function_name": "walk_inuse_blocks(inuse_block*, unsigned long*)"
, "file_name": "/home/korden/core_analyzer-2.17.0/app/Linux/core_analyzer"
}
, { "address": 4228774
, "build_id": "d4eced4303dcf56ece60431a2702f7a48a26c422"
, "build_id_offset": 34470
, "function_name": "build_inuse_heap_blocks(unsigned long*)"
, "file_name": "/home/korden/core_analyzer-2.17.0/app/Linux/core_analyzer"
}
, { "address": 4229154
, "build_id": "d4eced4303dcf56ece60431a2702f7a48a26c422"
, "build_id_offset": 34850
, "function_name": "display_heap_leak_candidates()"
, "file_name": "/home/korden/core_analyzer-2.17.0/app/Linux/core_analyzer"
}
, { "address": 4202550
, "build_id": "d4eced4303dcf56ece60431a2702f7a48a26c422"
, "build_id_offset": 8246
, "function_name": "main"
, "file_name": "/home/korden/core_analyzer-2.17.0/app/Linux/core_analyzer"
} ]
} ]
}

#0 0x000000000040badf in walk_inuse_blocks (opBlocks=, opCount=0x7ffc52656438) at ../heap_ptmalloc.cpp:643
#1 0x00000000004086a6 in build_inuse_heap_blocks (opCount=0x7ffc526564a8) at ../heap.cpp:555
#2 0x0000000000408822 in display_heap_leak_candidates () at ../heap.cpp:1132
#3 0x0000000000402036 in main (argc=, argv=) at ../main.cpp:256

(gdb)
638 {
639 struct ca_heap* heap = g_sorted_heaps[heap_index];
640 union ca_malloc_chunk achunk;
641
642 // For mmap heap, there is only one block and in-use
643 if (heap->mArena->mType == ENUM_HEAP_MMAP_BLOCK)
644 {
645 if (!read_memory_wrapper(NULL, heap->mStartAddr - size_t_sz, &achunk, mchunk_sz))
646 continue;
647 (*opCount)++;
(gdb) p *heap
$1 = {mArena = 0x7f5f852e9770, mpNext = 0x1f3ecb0, mSegment = 0x7f5fa763da00, mStartAddr = 139714547941416, mEndAddr = 139714550190080, mChunks = 0x0, mNumChunks = 0, mCorrupted = 0, mResearved = 0}
(gdb) p heap->mArena
$2 = (ca_arena *) 0x7f5f852e9770
(gdb) p *(heap->mArena)
Cannot access memory at address 0x7f5f852e9770

can we remove big binaries from history

There are too much binaries in history, work-tree is only 4MiB, but .git is 427MiB.
Too much time for clone.
So can history be rewritten?

[root core_analyzer]#git log --stat -- bin/
commit 0c50b34a34cb690ff88a89725a93ce4314cbe97d
Author: Michael Yan <[email protected]>
Date:   Mon Jun 20 10:22:21 2022 -0400

    Object search (#55)

    * src/search: object search command does not include references by default

    * object search for gdb 9.2

    * gdbplus/gdb-9.2: ensure command's args are not nullptr

    * fix dt command bug

    * update gdb-12.1

    * simplify code with stl container

    * update the command help messages

    * revert changes to gdb-8.1

    * restore gdb-7.11.1 and gdb-8.1 to single heap manager

    * remove prebuilt gdb binaries since it is much easy to build with container and script

    * disallow try/catch in gdb-7.11.1

    * rename src/heapcmd.cpp to src/heapcmd.c

    Co-authored-by: Michael Yan <[email protected]>

 bin/Darwin/gdb.tgz                 | Bin 2024067 -> 0 bytes
 bin/Linux/README.md                |   2 --
 bin/Linux/ptmalloc/gdb-9.2/gdb.tgz | Bin 52251473 -> 0 bytes
 bin/Linux/tcmalloc/gdb-9.2/gdb.tgz | Bin 52233782 -> 0 bytes
 bin/readme.md                      |   5 -----
 5 files changed, 7 deletions(-)

commit a44f8d176c94fa106ac26947dade05d5c7e47dc6
Author: Michael Yan <[email protected]>
Date:   Fri Dec 31 18:22:18 2021 -0500

    test build tcmalloc 4.5.3/gdb 9.2

 bin/Darwin/gdb                                           | Bin 6262688 -> 0 bytes
 bin/Darwin/gdb.tgz                                       | Bin 0 -> 2024067 bytes
 bin/Linux/ptmalloc/gdb-7.11.1/gdb.tgz                    | Bin 19976006 -> 0 bytes
 bin/Linux/tcmalloc/gdb-7.11.1/gdb.tgz                    | Bin 19970990 -> 0 bytes
 bin/Linux/tcmalloc/gdb-8.1/gdb.tgz                       | Bin 38273293 -> 0 bytes
 bin/Linux/{ptmalloc/gdb-8.1 => tcmalloc/gdb-9.2}/gdb.tgz | Bin 38284573 -> 52233782 bytes
 6 files changed, 0 insertions(+), 0 deletions(-)

commit 57c58e78164d7810dfef8e6faea789e968d260a8
Author: Michael Yan <[email protected]>
Date:   Fri Dec 31 10:10:35 2021 -0500

    Windbg extension DLL build with VS2019 (#34)

    * clean up old files

    * Add support for Windows LFH(low fragmentation heap)

    * enhance ref.dll test; fix sizeof HEAP_ENTRY bug"

    * restore soft links

    * suppor python 3

    * support gdb 9.2 with python 3

    * compress binary gdb files

    * test/mallocTest.cpp remove dead/debug code

 bin/Linux/ptmalloc/gdb-7.11.1/gdb.tgz                           | Bin 0 -> 19976006 bytes
 bin/Linux/{tcmalloc/gdb-7.11.1/gdb => ptmalloc/gdb-8.1/gdb.tgz} | Bin 42659088 -> 38284573 bytes
 bin/Linux/ptmalloc/{gdb-8.1/gdb => gdb-9.2/gdb.tgz}             | Bin 85991592 -> 52251473 bytes
 bin/Linux/tcmalloc/gdb-7.11.1/gdb.tgz                           | Bin 0 -> 19970990 bytes
 bin/Linux/tcmalloc/gdb-8.1/gdb                                  | Bin 85963032 -> 0 bytes
 bin/Linux/{ptmalloc/gdb-7.11.1/gdb => tcmalloc/gdb-8.1/gdb.tgz} | Bin 42688280 -> 38273293 bytes
 6 files changed, 0 insertions(+), 0 deletions(-)

commit bc08f8bbbb1c4a9dfae48587cee97436cb46a10e
Author: Michael Yan <[email protected]>
Date:   Thu Dec 19 22:33:42 2019 -0500

    bin/Linux: rebuild binaries

 bin/Linux/{ptmalloc => }/README.md |   0
 bin/Linux/ptmalloc/gdb-7.11.1/gdb  | Bin 43620680 -> 42688280 bytes
 bin/Linux/ptmalloc/gdb-8.1/gdb     | Bin 83674496 -> 85991592 bytes
 bin/Linux/tcmalloc/README.md       |   1 -
 bin/Linux/tcmalloc/gdb-7.11.1/gdb  | Bin 43594064 -> 42659088 bytes
 bin/Linux/tcmalloc/gdb-8.1/gdb     | Bin 85907832 -> 85963032 bytes
 6 files changed, 1 deletion(-)

commit 7bd015e7e09f13f8dd04b54b01e0b648086ad608 (tag: 2.21.0)
Author: Michael Yan <[email protected]>
Date:   Mon Oct 29 15:14:18 2018 -0400

    app: remove command line program

 bin/Linux/ptmalloc/core_analyzer | Bin 493120 -> 0 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

commit 341e0b721a75aa19051ae3fbc7765b0ad198653a
Author: Michael Yan <[email protected]>
Date:   Mon Oct 29 12:09:39 2018 -0400

    Integrate with gdb 8.1 (#13)

 bin/Linux/ptmalloc/README.md            |   2 ++
 bin/Linux/ptmalloc/gdb-7.11.1/README.md |   2 --
 bin/Linux/ptmalloc/gdb-7.11.1/gdb       | Bin 43595112 -> 43620680 bytes
 bin/Linux/ptmalloc/gdb-7.7/gdb          | Bin 30324424 -> 0 bytes
 bin/Linux/ptmalloc/gdb-8.1/gdb          | Bin 0 -> 83674496 bytes
 bin/Linux/tcmalloc/README.md            |   1 +
 bin/Linux/tcmalloc/gdb-7.11.1/README.md |   1 -
 bin/Linux/tcmalloc/gdb-7.7/gdb          | Bin 30326816 -> 0 bytes
 bin/Linux/tcmalloc/gdb-8.1/gdb          | Bin 0 -> 85907832 bytes
 9 files changed, 3 insertions(+), 3 deletions(-)

commit 645f36a930dc0722bfcd5b860a49c2ef975ce461 (tag: 2.20.0)
Author: Michael Yan <[email protected]>
Date:   Wed Oct 17 09:51:39 2018 -0400

    bin/Linux/tcmalloc/gdb-7.11.1: add README

 bin/Linux/tcmalloc/gdb-7.11.1/README.md | 1 +
 1 file changed, 1 insertion(+)

commit 2f2c36358d29dce4aa6dc76114063f0203fd1ef1
Author: Michael Yan <[email protected]>
Date:   Wed Oct 17 09:41:10 2018 -0400

    support tcmalloc 2.6 and 2.7 (#12)

    * src/heap_tcmalloc: support gperftools/tcmalloc 2.27

    * src/heap_tcmalloc: fix tcmalloc 2.6

    * bin/Linux/tcmalloc/gdb-7.11.1: update binary

 bin/Linux/tcmalloc/gdb-7.11.1/gdb | Bin 33292400 -> 43594064 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

commit be023744720143baeadcec439b78b342d0dfe31c
Author: Michael Yan <[email protected]>
Date:   Fri Oct 5 17:13:59 2018 -0400

    support ptmalloc with glibc 2.27 on Linux (#11)

    * src/heap_ptmalloc: remove 32-bit support

    * src/heap_ptmalloc: iterate all threads for tcache

    * src/heap_ptmalloc: put chunks of tcache and fastbins in a sorted array

 bin/Linux/ptmalloc/gdb-7.11.1/README.md |   2 ++
 bin/Linux/ptmalloc/gdb-7.11.1/gdb       | Bin 33282856 -> 43595112 bytes
 2 files changed, 2 insertions(+)

commit 46404c7df0002f19932076213ba5105c2bda74de
Author: Michael Yan <[email protected]>
Date:   Wed Dec 28 17:46:43 2016 -0500

    gdbplus: add support for gdb-7.11.1 and more test

 bin/Linux/ptmalloc/gdb-7.11.1/gdb    | Bin 0 -> 33282856 bytes
 bin/Linux/ptmalloc/{ => gdb-7.7}/gdb | Bin
 bin/Linux/tcmalloc/gdb-7.11.1/gdb    | Bin 0 -> 33292400 bytes
 bin/Linux/tcmalloc/{ => gdb-7.7}/gdb | Bin
 4 files changed, 0 insertions(+), 0 deletions(-)

commit 6f4005cf8835461c44bd94a03711496c9c37efb1
Author: Michael Yan <[email protected]>
Date:   Thu Dec 15 17:47:41 2016 -0500

    fix: wrong ptmalloc gdb built

 bin/Linux/ptmalloc/gdb | Bin 30326816 -> 30324424 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

commit 525467d3e8af285206eebb433431a8e5d02f59c6
Author: Michael Yan <[email protected]>
Date:   Sat Sep 17 22:33:04 2016 -0400

    ptmalloc: back support of glibc 2.13

 bin/Linux/ptmalloc/core_analyzer | Bin 493200 -> 493120 bytes
 bin/Linux/ptmalloc/gdb           | Bin 30359696 -> 30326816 bytes
 2 files changed, 0 insertions(+), 0 deletions(-)

commit bce14961388ca922621ad6cccf0658083b12b22f (tag: 2.17.0)
Author: Michael Yan <[email protected]>
Date:   Sun Sep 11 22:38:14 2016 -0400

    add support to TCMalloc memory allocator

 bin/Darwin/gdb                   | Bin 0 -> 6262688 bytes
 bin/Linux/ptmalloc/core_analyzer | Bin 0 -> 493200 bytes
 bin/Linux/ptmalloc/gdb           | Bin 0 -> 30359696 bytes
 bin/Linux/tcmalloc/gdb           | Bin 0 -> 30326816 bytes
 bin/readme.md                    |   5 +++++
 5 files changed, 5 insertions(+)
[root core_analyzer]#git rev-list --objects --all |   git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |   sed -n 's/^blob //p' |   sort --numeric-sort --key=2 |   cut -c 1-12,41- |   $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
.
.
.
6b82aa00d407  365KiB app/Linux/core_analyzer
bdb3ee3b7321  411KiB app/Linux/core_analyzer
2527ee083b9a  411KiB app/Linux/core_analyzer
fad164929bab  459KiB app/Linux/core_analyzer
5be8ed956d65  482KiB bin/Linux/ptmalloc/core_analyzer
22f2743a1a6a  482KiB bin/Linux/ptmalloc/core_analyzer
3fb09a98ba16  680KiB Windbg_ext/pta/objfre_wlh_amd64/amd64/ref.dll
22d10305c44f  1.9MiB bin/Darwin/gdb.tgz
2d4e5f48eceb  6.0MiB bin/Darwin/gdb
36096a94074a   19MiB bin/Linux/tcmalloc/gdb-7.11.1/gdb.tgz
2d5d9244f5d8   19MiB bin/Linux/ptmalloc/gdb-7.11.1/gdb.tgz
85fb5455a9f1   28MiB gdbplus/gdb-7.7/gdb/gdb
b67ff8d21a34   28MiB gdbplus/gdb-7.7/gdb/gdb
4f88bf628c02   29MiB bin/Linux/ptmalloc/gdb-7.7/gdb
38e87315366e   29MiB bin/Linux/tcmalloc/gdb-7.7/gdb
6094dd529a6a   29MiB bin/Linux/ptmalloc/gdb
ad8bade6c284   32MiB bin/Linux/ptmalloc/gdb-7.11.1/gdb
cc364f44c3ab   32MiB bin/Linux/tcmalloc/gdb-7.11.1/gdb
66926983d609   34MiB gdbplus/gdb-7.7/gdb/gdb
10803cd155f1   37MiB bin/Linux/tcmalloc/gdb-8.1/gdb.tgz
d85b0e5ab835   37MiB bin/Linux/ptmalloc/gdb-8.1/gdb.tgz
7c108b4aac00   41MiB bin/Linux/tcmalloc/gdb-7.11.1/gdb
c1ba2ec8d4fb   41MiB bin/Linux/ptmalloc/gdb-7.11.1/gdb
4a7131eaec63   42MiB bin/Linux/tcmalloc/gdb-7.11.1/gdb
c21935a17627   42MiB bin/Linux/ptmalloc/gdb-7.11.1/gdb
33fe4417afb8   42MiB bin/Linux/ptmalloc/gdb-7.11.1/gdb
6a4d5f1fe4c4   50MiB bin/Linux/tcmalloc/gdb-9.2/gdb.tgz
4f0271f0e1ae   50MiB bin/Linux/ptmalloc/gdb-9.2/gdb.tgz
23fac76d29ab   80MiB bin/Linux/ptmalloc/gdb-8.1/gdb
738b9cc090d5   82MiB bin/Linux/tcmalloc/gdb-8.1/gdb
fad3f215bf95   82MiB bin/Linux/tcmalloc/gdb-8.1/gdb
173fbb85a9e7   82MiB bin/Linux/ptmalloc/gdb-8.1/gdb

crash when typing heap /u 5

(gdb) heap /u 5
Input expression doesn't reference any heap memory
free(): invalid pointer


Fatal signal: Aborted
----- Backtrace -----
0xaaaaba8226e7 gdb_internal_backtrace_1
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/bt-utils.c:122
0xaaaaba8226e7 _Z22gdb_internal_backtracev
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/bt-utils.c:168
0xaaaaba91c06f handle_fatal_signal
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:904
0xffff8fa5e7db ???
0xffff8eeaf200 __pthread_kill_implementation
        ./nptl/pthread_kill.c:44
0xffff8ee6a67b __GI_raise
        ../sysdeps/posix/raise.c:26
0xffff8ee5712f __GI_abort
        ./stdlib/abort.c:79
0xffff8eea3307 __libc_message
        ../sysdeps/posix/libc_fatal.c:155
0xffff8eeb957b malloc_printerr
        ./malloc/malloc.c:5664
0xffff8eebb2c3 _int_free
        ./malloc/malloc.c:4439
0xffff8eebdc83 __GI___libc_free
        ./malloc/malloc.c:3391
0xaaaaba964603 _Z17heap_command_implPc
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/heap.c:278
0xaaaaba972c2b heap_command
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/heapcmd.c:29
0xaaaaba853283 _Z8cmd_funcP16cmd_list_elementPKci
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/cli/cli-decode.c:2514
0xaaaabab6347f _Z15execute_commandPKci
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/top.c:702
0xaaaaba91cfe3 _Z15command_handlerPKc
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:597
0xaaaaba91d373 _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:800
0xaaaaba91dbc3 gdb_rl_callback_handler
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:229
0xaaaabac0ef07 rl_callback_read_char
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../readline/readline/callback.c:281
0xaaaaba91c293 gdb_rl_callback_read_char_wrapper_noexcept
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:187
0xaaaaba91da4b gdb_rl_callback_read_char_wrapper
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:204
0xaaaaba91be57 _Z19stdin_event_handleriPv
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:524
0xaaaabacfd483 gdb_wait_for_event
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdbsupport/event-loop.cc:700
0xaaaabacfd837 gdb_wait_for_event
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdbsupport/event-loop.cc:596
0xaaaabacfd837 _Z16gdb_do_one_eventv
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdbsupport/event-loop.cc:237
0xaaaaba9e2fbb start_event_loop
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/main.c:421
0xaaaaba9e2fbb captured_command_loop
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/main.c:481
0xaaaaba9e49a3 captured_main
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/main.c:1351
0xaaaaba9e49a3 _Z8gdb_mainP18captured_main_args
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/main.c:1366
0xaaaaba763c07 main
        /home/ubuntu/core_analyzer/build/gdb-12.1/build/../gdb/gdb.c:32
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.  GDB will now terminate.

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

Aborted (core dumped)

build_gdb.sh error!

when i exec the build_gdb.sh script,it reports the error below:
Makefile:1000: recipe for target 'all' failed
make: *** [all] Error 2
if you want to remove the build folder, please run "rm -rf /home/deepctrl/core_analyzer/build"

so, what should i do to erase the error

How to compile gdb (properly) for Debian 9 (codename Stretch)

For a number of reason my environment is bound to Debian 9 Stretch.

However I can't (properly) compile core_analyzer's patched gdb for Debian 9:

  • the default 12.1 version is compiled but doesn't work because libthread_db installed in the system doesn't match the inferior one
  • 7.11.1 doesn't compile because gdb-7.11.1/gdb/segment.h contains C++ template function ca_read_variable without any C++ protector, C code including the header obviously fails to compile
  • 7.12 (Debian 9 "native" version) also fails to compile due to multiple compilation errors.

Is 7.xx really supported at the moment?

Please suggest

Cannot get the "__libc_version" from the debugee

_libc_version and main_arena & mp not find

[ca_test] Checking heap blocks ...
Cannot get the "__libc_version" from the debugee, read it from the host machine. This might not be accurate.
Cannot get the "__libc_version" from the debugee, read it from the host machine. This might not be accurate.
Cannot get the "_libc_version" from the debugee, read it from the host machine. This might not be accurate.
Failed to get the addresses of global variables main_arena & mp

failed to init heap

os info:
ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.7) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

nm ./a.out | grep libc
00000000000011f0 T __libc_csu_fini
0000000000001180 T __libc_csu_init
U __libc_start_main@@GLIBC_2.2.5

strings /lib/x86_64-linux-gnu/libc-2.31.so | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_2.22
GLIBC_2.23
GLIBC_2.24
GLIBC_2.25
GLIBC_2.26
GLIBC_2.27
GLIBC_2.28
GLIBC_2.29
GLIBC_2.30
GLIBC_PRIVATE
GNU C Library (Ubuntu GLIBC 2.31-0ubuntu9.7) stable release version 2.31.

[compile error]configure: error: python is missing or unusable

My environment is centos and kernal is 3.10.0_3-0-0-26 #1 SMP Tue Mar 19 16:20:29 CST 2019 x86_64 GNU/Linux. I download source code of gdb 7.11.1 and compile as follows,
cd gdb-7.11.1 && cp ../core_analyzer/gdbplus/gdb-7.11.1/gdb/* gdb/ -r && ./configure --with-python --prefix=/usr/local && make -j 20. Then I encountered error configure: error: python is missing or unusable. I can use python in my terminal as follows

gdb-7.11.1 20:18:08 $ python
Python 2.7.3 (default, Mar 28 2019, 15:45:17)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

`xxx.so` is not found

Hi, I download the whole project and run directly as ./core_analyzer/bin/Linux/tcmalloc/gdb-7.11.1/gdb bin core.17027. I get xxx.so not found error, eg. ./core_analyzer/bin/Linux/tcmalloc/gdb-7.11.1/gdb: /lib64/libc.so.6: version GLIBC_2.15' not found (required by ./core_analyzer/bin/Linux/tcmalloc/gdb-7.11.1/gdb).
So, is it my environment version not ok? My kernal is as follow,
Linux 3.10.0_3-0-0-11 #5 SMP Thu Sep 21 13:16:48 CST 2017 x86_64 x86_64 x86_64 GNU/Linux

Error running core_analyzer_2_16 with redhat 7.0

Hi,
Trying to run core_analyzer_2_16 on redhat7.0(maipo). I get the following glibc version error.
"""
The memory manager of glibc 2.17 is not supported in this release
Fail to initialize core analyzer
"""

Can you let me know if this issue is known/already fixed.
Please let me know if any other information is required.

Thanks

Adding issue template

Let's add one issue template to ask for the following information.

  1. OS version
  2. Heap manager, version.
  3. Lib version
  4. Confirm debug symbol loaded.
  5. The gdb version.

tcentry's list is too long > 1024

Hi, Yan Qi, when i try to use ./core_analyzer-master/bin/Linux/tcmalloc/gdb-7.7/gdb
to analyze my coredump file, and entered gdb, this ERROR occurs:

...
(gdb) heap
tcentry's list is too long > 1024
tcmalloc heap was not initialized successfully
[Error] Failed to walk heap

Is this limit just a arbitrary one, and can I change it?

PS. my coredump file might be generated by a mem leak bug, and the size of it is about 14G (sounds too large).

Thanks!

Glibc 2.13 support

Hi Michael,
core_analyzer is not supported for glibc 2.13 version. Could you please let me know how we can add support for glibc 2.13. IF you can provide support or give us some pointers to add support, much appreciated.

release 2.23.0 miss i386-decode.c

In latest release (2.23) only “i386-decode.c.REMOVED.git-id” in tgz

https://github.com/yanqi27/core_analyzer/archive/refs/tags/2.23.0.tar.gz

$ls core_analyzer-2.23.0/gdbplus/gdb-12.1/gdb/
decode.c                      heap.h                        heap_ptmalloc_2_35.c          i386-decode.c.REMOVED.git-id  search.h
decode.h                      heap_jemalloc.c               heap_ptmalloc_common.c        Makefile.in                   segment.c
gdb_dep.c                     heap_jemalloc.h               heap_ptmalloc.h               python/                       segment.h
heap.c                        heap_ptmalloc_2_27.c          heap_tcmalloc.c               ref.h                         x_dep.h
heapcmd.c                     heap_ptmalloc_2_31.c          heap_tcmalloc.h               search.c                      x_type.h

$cat core_analyzer-2.23.0/gdbplus/gdb-12.1/gdb/i386-decode.c.REMOVED.git-id
d571e6ea06e2df8d96d4ee8356c2b09c6c6e2024

Finally my build failed with such error:

make[2]: *** No rule to make target 'i386-decode.c', needed by 'i386-decode.o'.  Stop.

Glibc 2.22 support

Hi, I am trying to run core_analyzer against my application but I am getting this error message:

./core_analyzer -b ./my_application mycore
The memory manager of glibc 2.22 is not supported in this release
Fail to initialize core analyzer

App crash when calling ref in GDB 12.1

Hi,

I have compiled GDB 12.1 and tried to work with a coredump.

(gdb) heap /tu 8
----------------------------------------------------------------------------------
[1] [heap block] 0x7f18cae75010--0x7f18cb7ff000 size=10002416
    |--> 9MB (1 blocks)
[2] [stack] thread 9 frame 19 rsp+8400 @0x7f1902668010: 0x7f1902668090
    |--> 3MB (1 blocks)
[3] [stack] thread 9 frame 19 rsp+8480 @0x7f1902668060: 0x7f1902668095
    |--> 3MB (1 blocks)
[4] [stack] thread 9 frame 19 rsp+8808 @0x7f19026681a8: 0x7f1902668228
    |--> 3MB (1 blocks)
[5] [stack] thread 9 frame 19 rsp+8888 @0x7f19026681f8: 0x7f190266822d
    |--> 3MB (1 blocks)
[6] [stack] thread 9 frame 19 rsp+9216 @0x7f1902668340: 0x7f19026683c0
    |--> 3MB (1 blocks)
[7] [stack] thread 9 frame 19 rsp+9296 @0x7f1902668390: 0x7f19026683c5
    |--> 3MB (1 blocks)
[8] [stack] thread 9 frame 19 rsp+9624 @0x7f19026684d8: 0x7f1902668558
    |--> 3MB (1 blocks)
(gdb) ref 0x7f18cae75010
Search for object type associated with 0x7f18cae75010
Address 0x7f18cae75010 belongs to heap block [0x7f18cae75010, 0x7f18cb7ff000] size=10002416


Fatal signal: Segmentation fault
----- Backtrace -----
0x4fb1b3 gdb_internal_backtrace_1
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/bt-utils.c:122
0x4fb1b3 _Z22gdb_internal_backtracev
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/bt-utils.c:168
0x5f0321 handle_fatal_signal
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:904
0x5f0464 handle_sigsegv
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:977
0x7fafcd9ce62f ???
        /usr/src/debug/glibc-2.17-c758a686/nptl/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7fafcc904876 ???
0x7afd45 _Z19read_memory_wrapperP10ca_segmentmPvm
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/segment.c:546
0x641712 fill_heap_block
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/heap_ptmalloc_2_35.c:1823
0x7ab33e search_value_internal
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/search.c:308
0x7ad2e0 _Z16find_object_typem
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/search.c:875
0x632237 _Z16ref_command_implPc
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/heap.c:362
0x6479ba ref_command
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/heapcmd.c:46
0x52d1e4 _Z8cmd_funcP16cmd_list_elementPKci
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/cli/cli-decode.c:2514
0x830661 _Z15execute_commandPKci
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/top.c:702
0x5f128c _Z15command_handlerPKc
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:597
0x5f15aa _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:800
0x5f1c1f gdb_rl_callback_handler
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:229
0x88e257 rl_callback_read_char
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../readline/readline/callback.c:281
0x5f04bd gdb_rl_callback_read_char_wrapper_noexcept
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:187
0x5f1b0d gdb_rl_callback_read_char_wrapper
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:204
0x5f016f _Z19stdin_event_handleriPv
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/event-top.c:524
0x9bdec5 gdb_wait_for_event
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdbsupport/event-loop.cc:700
0x9be14e gdb_wait_for_event
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdbsupport/event-loop.cc:596
0x9be14e _Z16gdb_do_one_eventv
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdbsupport/event-loop.cc:237
0x6c96e4 start_event_loop
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/main.c:421
0x6c96e4 captured_command_loop
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/main.c:481
0x6cb044 captured_main
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/main.c:1351
0x6cb044 _Z8gdb_mainP18captured_main_args
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/main.c:1366
0x433474 main
        /myspace/projects/core_analyzer/build/gdb-12.1/build/../gdb/gdb.c:32
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.  GDB will now terminate.

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

Architecture is
The target architecture is set to "auto" (currently "i386:x86-64").
Any hints on where to start the investigation?

ref.dll referenced in the source bundle

I looked in git for the ref.dll that was referenced as being in the source bundle, as well as in the tag zip, but didn't see it. Briefly looked into building it but ran into toolkit/sdk compatibility issues... back to wondering if I just missed the binary somewhere, thanks.

python undefined reference when compiling for gdb 7.11.x

Hi
It would help if you could share the detailed steps on how to build from scratch.
Ive tried a lot of things but keep ending up with something like this

gcc -g -O2      \
        -o gdb gdb.o amd64-tdep.o amd64-linux-tdep.o i386-tdep.o i387-tdep.o i386-linux-tdep.o glibc-tdep.o solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o ser-base.o ser-unix.o ser-pipe.o ser-tcp.o inf-ptrace.o fork-child.o x86-nat.o x86-dregs.o amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-nat.o linux-osdata.o proc-service.o linux-thread-db.o linux-fork.o linux-procfs.o linux-ptrace.o linux-btrace.o linux-waitpid.o linux-personality.o x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o linux-namespaces.o remote.o dcache.o tracepoint.o ax-general.o ax-gdb.o remote-fileio.o remote-notif.o ctf.o tracefile.o tracefile-tfile.o  cli-dump.o cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-logging.o cli-interp.o cli-utils.o mi-out.o mi-console.o mi-cmds.o mi-cmd-catch.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o mi-cmd-info.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o tui-command.o tui-data.o tui-disasm.o tui-file.o tui-hooks.o tui-interp.o tui-io.o tui-layout.o tui-out.o tui-regs.o tui-source.o tui-stack.o tui-win.o tui-windata.o tui-wingeneral.o tui-winsource.o tui.o python.o py-arch.o py-auto-load.o py-block.o py-bpevent.o py-breakpoint.o py-cmd.o py-continueevent.o py-xmethods.o py-event.o py-evtregistry.o py-evts.o py-exitedevent.o py-finishbreakpoint.o py-frame.o py-framefilter.o py-function.o py-gdb-readline.o py-inferior.o py-infevents.o py-infthread.o py-lazy-string.o py-linetable.o py-newobjfileevent.o py-objfile.o py-param.o py-prettyprint.o py-progspace.o py-signalevent.o py-stopevent.o py-symbol.o py-symtab.o py-threadevent.o py-type.o py-unwind.o py-utils.o py-value.o py-varobj.o guile.o elfread.o stap-probe.o dtrace-probe.o posix-hdep.o posix-strerror.o c-exp.o cp-name-parser.o ada-exp.o jv-exp.o d-exp.o f-exp.o go-exp.o m2-exp.o p-exp.o version.o annotate.o addrmap.o auto-load.o auxv.o agent.o bfd-target.o blockframe.o breakpoint.o break-catch-sig.o break-catch-throw.o break-catch-syscall.o findvar.o regcache.o cleanups.o charset.o continuations.o corelow.o disasm.o dummy-frame.o dfp.o source.o value.o eval.o valops.o valarith.o valprint.o printcmd.o block.o symtab.o psymtab.o symfile.o symfile-debug.o symmisc.o linespec.o dictionary.o namespace.o location.o infcall.o infcmd.o infrun.o expprint.o environ.o stack.o tid-parse.o thread.o thread-fsm.o exceptions.o extension.o filesystem.o filestuff.o inf-child.o interps.o minidebug.o main.o macrotab.o macrocmd.o macroexp.o macroscope.o mi-common.o event-loop.o event-top.o inf-loop.o completer.o gdbarch.o arch-utils.o gdbtypes.o gdb_bfd.o gdb_obstack.o osabi.o copying.o memattr.o mem-break.o target.o target-dcache.o parse.o language.o build-id.o buildsym.o findcmd.o std-regs.o signals.o exec.o reverse.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o dbxread.o coffread.o coff-pe-read.o dwarf2read.o mipsread.o stabsread.o corefile.o dwarf2expr.o dwarf2loc.o dwarf2-frame.o dwarf2-frame-tailcall.o ada-lang.o c-lang.o d-lang.o f-lang.o objc-lang.o ada-tasks.o ada-varobj.o c-varobj.o ui-out.o cli-out.o varobj.o vec.o go-lang.o go-valprint.o go-typeprint.o jv-lang.o jv-valprint.o jv-typeprint.o jv-varobj.o m2-lang.o opencl-lang.o p-lang.o p-typeprint.o p-valprint.o sentinel-frame.o complaints.o typeprint.o ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o ada-valprint.o c-valprint.o cp-valprint.o d-valprint.o f-valprint.o m2-valprint.o serial.o mdebugread.o top.o utils.o ui-file.o user-regs.o frame.o frame-unwind.o doublest.o frame-base.o inline-frame.o gnu-v2-abi.o gnu-v3-abi.o cp-abi.o cp-support.o cp-namespace.o d-namespace.o reggroups.o trad-frame.o tramp-frame.o solib.o solib-target.o prologue-value.o memory-map.o memrange.o xml-support.o xml-syscall.o xml-utils.o target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o gdb_vecs.o jit.o progspace.o skip.o probe.o common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o format.o registry.o btrace.o record-btrace.o waitstatus.o print-utils.o rsp-low.o errors.o common-debug.o debug.o common-exceptions.o btrace-common.o fileio.o common-regcache.o compile.o compile-c-symbols.o compile-c-types.o compile-object-load.o compile-object-run.o compile-loc2c.o compile-c-support.o inflow.o    init.o \
           ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a -L./../zlib -lz  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -ldl -ldl -lncurses -lm -ldl   -L/data/isuser/temp/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic     ../libiberty/libiberty.a  build-gnulib/import/libgnu.a  -ldl -Wl,--dynamic-list=./proc-service.list
/data/isuser/temp/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/root/tools/Python-2.7.9/./Modules/posixmodule.c:7575: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/data/isuser/temp/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/root/tools/Python-2.7.9/./Modules/posixmodule.c:7522: warning: the use of `tempnam' is dangerous, better use `mkstemp'
python.o: In function `_initialize_python':
/data/isuser/tools/gdb-7.11.1/gdb/./python/python.c:1834: undefined reference to `gdbpy_initialize_heap_block'
/data/isuser/tools/gdb-7.11.1/gdb/./python/python.c:1835: undefined reference to `gdbpy_initialize_object_ref'
python.o:(.data+0x428): undefined reference to `gdbpy_heap_block'
python.o:(.data+0x448): undefined reference to `gdbpy_heap_walk'
python.o:(.data+0x468): undefined reference to `gdbpy_big_blocks'
python.o:(.data+0x488): undefined reference to `gdbpy_cpp_object'
python.o:(.data+0x4a8): undefined reference to `gdbpy_shared_object'
python.o:(.data+0x4c8): undefined reference to `gdbpy_ref'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1410: gdb] Error 1
make[2]: Leaving directory '/data/isuser/tools/gdb-7.11.1/gdb'
make[1]: *** [Makefile:9157: all-gdb] Error 2
make[1]: Leaving directory '/data/isuser/tools/gdb-7.11.1'
make: *** [Makefile:847: all] Error 2

I did copy the python files from gdbplus to gdb-7.11.1/gdb/python folder as suggested in one of the issues.
I have configured this against python2.7.

Can you let me know what else I am missing?

Jemalloc support

Is there any plan to support jemalloc?

We are using jemalloc and changing malloc library means restart program, restart make memory allocation changes and hard to reproduce some problems.

Make file absent

Could you please provide a way to build it? The binary needs a specific glibc version.

3 Errors encountered while walking the heap!`

my shell code:

./core_analyzer -b `which python` ../../../core.210738
	Tuning params & stats:
		mmap_threshold=31944704
		pagesize=4096
		n_mmaps=5
		n_mmaps_max=65536
		total mmap regions created=7
		mmapped_mem=465895424
		sbrk_base=0x1
	Main arena (0x7fd12ad6d760) owns regions:
		[0x304f300f - 0x304f3000] Total 17179869184.0GBFailed to get the first chunk at 0x304f2fff

	Dynamic arena (0x7fcc94000020) owns regions:
		[0x7fcc940008c0 - 0x7fcc94021000] Total 129KBFailed to get the first chunk at 0x0 in bin[1]
Failed to get the first chunk at 0x0 in bin[4]
Failed to get the first chunk at 0x10c91 in bin[8]
Failed to get the first chunk at 0x7f1268d147b8 in bin[10]
Failed to get the first chunk at 0x0 in bin[12]

	Dynamic arena (0x7fcca4000020) owns regions:
		[0x7fcca40008c0 - 0x7fcca406e000] Total 437KB in-use 3941(402KB) free 12(4KB)
	Dynamic arena (0x7fcca0000020) owns regions:
		[0x7fcca00008c0 - 0x7fcca0021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcca8000020) owns regions:
		[0x7fcca80008c0 - 0x7fcca8021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fccbc000020) owns regions:
		[0x7fccbc0008c0 - 0x7fccbc021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fccb4000020) owns regions:
		[0x7fccb40008c0 - 0x7fccb4021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcccc000020) owns regions:
		[0x7fcccc0008c0 - 0x7fcccc021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fccd8000020) owns regions:
		[0x7fccd80008c0 - 0x7fccd8021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcce4000020) owns regions:
		[0x7fcce40008c0 - 0x7fcce4021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcd74000020) owns regions:
		[0x7fcd740008c0 - 0x7fcd74021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcd70000020) owns regions:
		[0x7fcd700008c0 - 0x7fcd70021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcd78000020) owns regions:
		[0x7fcd780008c0 - 0x7fcd78021000] Total 129KB in-use 1(88) free 5(129KB)
	Dynamic arena (0x7fcd84000020) owns regions:
		[0x7fcd840008c0 - 0x7fcd84021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fcd90000020) owns regions:
		[0x7fcd900008c0 - 0x7fcd90021000] Total 129KB in-use 4(21KB) free 6(107KB)
	Dynamic arena (0x7fcd9c000020) owns regions:
		[0x7fcd9c0008c0 - 0x7fcd9ca30000] Total 10MB in-use 11706(8MB) free 22(2MB)
	Dynamic arena (0x7fcda8000020) owns regions:
		[0x7fcda80008c0 - 0x7fcda8021000] Total 129KB in-use 7(21KB) free 12(107KB)
	Dynamic arena (0x7fcdb4000020) owns regions:
		[0x7fcdb40008c0 - 0x7fcdb4026000] Total 149KB in-use 119(34KB) free 36(113KB)
	Dynamic arena (0x7fcdc4000020) owns regions:
		[0x7fcdc40008c0 - 0x7fcdc519e000] Total 17MB in-use 76802(12MB) free 1941(4MB)
	Dynamic arena (0x7fcdc8000020) owns regions:
		[0x7fcdc80008c0 - 0x7fcdc8032000] Total 197KB in-use 60(25KB) free 61(171KB)
	Dynamic arena (0x7fcdcc000020) owns regions:
		[0x7fcdcc0008c0 - 0x7fcdcc029000] Total 161KB in-use 68(25KB) free 306(133KB)
	Dynamic arena (0x7fcdfc000020) owns regions:
		[0x7fcdfc0008c0 - 0x7fcdfc021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce10000020) owns regions:
		[0x7fce100008c0 - 0x7fce10021000] Total 129KB in-use 1(40) free 1(129KB)
	Dynamic arena (0x7fce0c000020) owns regions:
		[0x7fce0c0008c0 - 0x7fce0c021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce20000020) owns regions:
		[0x7fce200008c0 - 0x7fce20021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce14000020) owns regions:
		[0x7fce140008c0 - 0x7fce14021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce30000020) owns regions:
		[0x7fce300008c0 - 0x7fce30021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce3c000020) owns regions:
		[0x7fce3c0008c0 - 0x7fce3c021000] Total 129KB in-use 27(29KB) free 4(100KB)
	Dynamic arena (0x7fce48000020) owns regions:
		[0x7fce480008c0 - 0x7fce48021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce54000020) owns regions:
		[0x7fce540008c0 - 0x7fce54021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce68000020) owns regions:
		[0x7fce680008c0 - 0x7fce68021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce64000020) owns regions:
		[0x7fce640008c0 - 0x7fce64021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce6c000020) owns regions:
		[0x7fce6c0008c0 - 0x7fce6c021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fce7c000020) owns regions:
		[0x7fce7c0008c0 - 0x7fce7ca06000] Total 10MB in-use 10(2KB) free 3(10MB)
	Dynamic arena (0x7fce88000020) owns regions:
		[0x7fce880008c0 - 0x7fce88021000] Total 129KB in-use 2(10KB) free 1(119KB)
	Dynamic arena (0x7fceb0000020) owns regions:
		[0x7fceb00008c0 - 0x7fceb00de000] Total 885KB in-use 66(230KB) free 3(654KB)
	Dynamic arena (0x7fcebc000020) owns regions:
		[0x7fcebc0008c0 - 0x7fcebc021000] Total 129KB in-use 18(1KB) free 1(128KB)
	Dynamic arena (0x7fcec8000020) owns regions:
		[0x7fcec80008c0 - 0x7fcecacbb000] Total 44MBFailed to get chunk at 0x7fcec8540ff0

	mmap-ed large memory blocks:
		[0x10651010 - 0x10751000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x12cda010 - 0x12dda000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x151ed010 - 0x152ed000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x1a600010 - 0x1a700000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x1d97d010 - 0x1da7d000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x1edbe010 - 0x1eebe000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x21084010 - 0x21184000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x21416010 - 0x21516000] Total 1023KB in-use 1(1023KB) free 0(0)
		[0x2cd5d010 - 0x2cd62000] Total 19KB in-use 1(19KB) free 0(0)
		[0x7fce82bf5010 - 0x7fce8310c000] Total 5MB in-use 1(5MB) free 0(0)
		[0x7fce93ffc010 - 0x7fce9bffd000] Total 128MB in-use 1(128MB) free 0(0)
		[0x7fce9bffd010 - 0x7fcea3ffe000] Total 128MB in-use 1(128MB) free 0(0)
		[0x7fcea3ffe010 - 0x7fceabfff000] Total 128MB in-use 1(128MB) free 0(0)
		[0x7fcee2b89010 - 0x7fcee318a000] Total 6MB in-use 1(6MB) free 0(0)
		14 mmap-ed large memory blocks are found, however, 5 is recorded in mp_

3 Errors encountered while walking the heap!

heap /tu 2 will hang

I'm not sure if it is taking super long time to return or it is hanging.
But the cursor and end do look strange to me

(gdb) p/x cursor
$14 = 0x55555c03fde8
(gdb) p/x end
$15 = 0x7ffff7fb1000

Failed to lookup gv "mp_"

Hi,

I'm using SLES12SP3 64bit, but debuggin 32bit process and core files.
I have all debug symbols, stock gdb 8.3.1 can resolve mp_:

(gdb) show version
GNU gdb (GDB; SUSE Linux Enterprise 12) 8.3.1
(gdb) p mp_
$1 = {trim_threshold = 131072, top_pad = 131072, mmap_threshold = 131072, arena_test = 2, arena_max = 0, n_mmaps = 1, n_mmaps_max = 65536, max_n_mmaps = 1,
  no_dyn_threshold = 0, mmapped_mem = 4096, max_mmapped_mem = 4096, max_total_mem = 0, sbrk_base = 0x8d4b000 ""}
(gdb) p &mp_
$2 = (malloc_par *) 0xf61bc0e0 <mp_>

My compiled gdb 8.1 gdb 9.2 (with gdbplus) complains about no debug:

(gdb) heap
Failed to lookup gv "mp_"
Failed to extract heap metadata from gv mp_
==================================================================================
== The memory manager is assumed to be glibc 2.22                                ==
== If this is not true, please debug with another machine with matching glibc   ==
==================================================================================
[Error] Failed to walk heap
(gdb) p mp_
'mp_' has unknown type; cast it to its declared type
(gdb) p &mp_
$1 = (<data variable, no debug info> *) 0xf61bc0e0 <mp_>
(gdb) show version
GNU gdb (GDB) 8.1

Same with 9.2:

(gdb) show version
GNU gdb (GDB) 9.2
Copyright (C) 2020 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-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) heap
Failed to lookup gv "mp_"
Failed to extract heap metadata from gv mp_
==================================================================================
== The memory manager is assumed to be glibc 2.22                                ==
== If this is not true, please debug with another machine with matching glibc   ==
==================================================================================
[Error] Failed to walk heap
(gdb) p &mp_
$1 = (<data variable, no debug info> *) 0xf61bc0e0 <mp_>

(gdb) info sym
Argument required (address).
(gdb) info shared
From        To          Syms Read   Shared Object Library
...
0xf641cd60  0xf642055a  Yes (*)     /lib/librt.so.1
0xf6416bf0  0xf6417a8c  Yes (*)     /lib/libdl.so.2
0xf62c2f20  0xf63acaec  Yes (*)     /usr/lib/libstdc++.so.6
0xf6200a20  0xf622f4b5  Yes (*)     /lib/libm.so.6
0xf61e0590  0xf61f4995  Yes (*)     /lib/libgcc_s.so.1
0xf61c6860  0xf61d42b7  Yes (*)     /lib/libpthread.so.0
0xf602db00  0xf616529b  Yes (*)     /lib/libc.so.6
0xf5ffcc40  0xf6009c13  Yes (*)     /lib/libnsl.so.1
0xf76f7840  0xf7710b9c  Yes (*)     /lib/ld-linux.so.2
0xf5fc39e0  0xf5fcc5bd  Yes (*)     /lib/libcrypt.so.1

Any suggestion?

Thanks,

GDB 8.2 support

Hi Michael
I failed to build core_analyzer under gdb-8.2.
It seems the failure related to some changed between gdb8.1 and gdb8.2.
Details as follows:
[ 2246s] ../../gdb/python/py-ref.c: In function 'PyObject* object_ref_str(PyObject*)':
[ 2246s] ../../gdb/python/py-ref.c:348:16: error: 'type_name_no_tag' was not declared in this scope
[ 2246s] if (type && type_name_no_tag(type))
[ 2246s] ^~~~~~~~~~~~~~~~
[ 2246s] ../../gdb/python/py-ref.c:348:16: note: suggested alternative: 'type_name'
[ 2246s] if (type && type_name_no_tag(type))
[ 2246s] ^~~~~~~~~~~~~~~~
[ 2246s] type_name

After examining ChangeLog of gdb, i found this API has been removed.

  • gdbtypes.c (type_name_no_tag): Remove.
  • gdbtypes.h (type_name_no_tag): Remove.

Are there any other methods to solve these problems?

File is NOT an executable

My executable type is the following:

ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f8fce2ac06c227029782df82440c800e3393f33a, with debug_info, not stripped

It seems some version 2.27 is not supported

When I run the test with the glibc 2.27, I get the following error
The tcache_perthread_struct's size is 576

bminor/glibc@1f50f2a

Internal error: "struct tcache_perthread_struct" is incorrect
Assumed tcache size=640 while gdb sees size=576
Internal error: "struct tcache_perthread_struct" is incorrect
Assumed tcache size=640 while gdb sees size=576
Internal error: "struct tcache_perthread_struct" is incorrect
Assumed tcache size=640 while gdb sees size=576

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.