Update to gdb-10.2

Release: crash-7.3.0-4

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
Lianbo Jiang 2021-10-12 16:56:15 +08:00
parent df2c4da980
commit f1cd67284d
30 changed files with 12613 additions and 5 deletions

1
.gitignore vendored
View File

@ -45,3 +45,4 @@ crash-5.0.6.tar.gz
/crash-7.2.9.tar.gz
/crash-7.3.0.tar.gz
/gdb-7.6.tar.gz
/gdb-10.2.tar.gz

View File

@ -0,0 +1,156 @@
From 80334ed25820cc08d147de5da361f427885cdd9e Mon Sep 17 00:00:00 2001
From: Aaron Tomlin <atomlin@redhat.com>
Date: Tue, 13 Jul 2021 14:24:49 +0100
Subject: [PATCH 01/27] kmem: Add support to -S option to specify a range of
CPU-specific slab data
With this patch, it is now possible for one to explicitly specify a range
of CPU-specific slab data to list. For example:
Note: This is only applicable to a Linux kernel with Kconfig
CONFIG_SLUB enabled. The optional argument GNU extension
for getopt(3) is utilized; and, the CPU range must be
specified as expected
crash> kmem -S=1,4 kmalloc-512
CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME
ffff8d3f07c06c00 512 1916 3680 115 16k kmalloc-512
CPU 1 KMEM_CACHE_CPU:
ffff8d461fa6f140
CPU 1 SLAB:
SLAB MEMORY NODE TOTAL ALLOCATED FREE
fffff540df7c4000 ffff8d45df100000 0 32 8 24
FREE / [ALLOCATED]
ffff8d45df100000 (cpu 1 cache)
[ffff8d45df100200]
ffff8d45df101000 (cpu 1 cache)
...skipped ...
CPU 4 KMEM_CACHE_CPU:
ffff8d461fb2f140
CPU 4 SLAB:
SLAB MEMORY NODE TOTAL ALLOCATED FREE
fffff540dfde3800 ffff8d45f78e0000 0 32 8 24
FREE / [ALLOCATED]
[ffff8d45f78e0000]
ffff8d45f78e0200 (cpu 4 cache)
ffff8d45f78e0400 (cpu 4 cache)
...skipped ...
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
help.c | 5 ++++-
memory.c | 37 ++++++++++++++++++++++++++++++++++---
2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/help.c b/help.c
index 99be7cb4e17c..6c262a3ffcbb 100644
--- a/help.c
+++ b/help.c
@@ -6601,7 +6601,7 @@ char *help_kmem[] = {
"kmem",
"kernel memory",
"[-f|-F|-c|-C|-i|-v|-V|-n|-z|-o|-h] [-p | -m member[,member]]\n"
-" [[-s|-S|-r] [slab] [-I slab[,slab]]] [-g [flags]] [[-P] address]]",
+" [[-s|-S|-S=cpu[s]|-r] [slab] [-I slab[,slab]]] [-g [flags]] [[-P] address]]",
" This command displays information about the use of kernel memory.\n",
" -f displays the contents of the system free memory headers.",
" also verifies that the page count equals nr_free_pages.",
@@ -6649,6 +6649,9 @@ char *help_kmem[] = {
" slab data for each per-cpu slab is displayed, along with the",
" address of each kmem_cache_node, its count of full and partial",
" slabs, and a list of all tracked slabs.",
+" Note: one can specify the per-cpu slab data to be displayed;",
+" the cpu[s] can be given as \"1,3,5\", \"1-3\", \"1,3,5-7,10\",",
+" \"all\", or \"a\" (shortcut for \"all\").",
" -r displays the accumulated basic kmalloc() slab data of each",
" root slab cache and its children. The kernel must contain the",
" \"slab_root_caches\" list_head. (currently only available if",
diff --git a/memory.c b/memory.c
index cbe90eebe748..ca4c633e5074 100644
--- a/memory.c
+++ b/memory.c
@@ -48,6 +48,7 @@ struct meminfo { /* general purpose memory information structure */
int slab_offset;
char *reqname;
char *curname;
+ ulong *spec_cpumask;
ulong *addrlist;
int *kmem_bufctl;
ulong *cpudata[NR_CPUS];
@@ -4851,10 +4852,13 @@ cmd_kmem(void)
struct meminfo meminfo;
ulonglong value[MAXARGS];
char buf[BUFSIZE];
+ char arg_buf[BUFSIZE];
char *p1;
- int spec_addr, escape;
+ ulong *cpus;
+ int spec_addr, escape, choose_cpu;
- spec_addr = 0;
+ cpus = NULL;
+ spec_addr = choose_cpu = 0;
sflag = Sflag = pflag = fflag = Fflag = Pflag = zflag = oflag = 0;
vflag = Cflag = cflag = iflag = nflag = lflag = Lflag = Vflag = 0;
gflag = hflag = rflag = 0;
@@ -4863,7 +4867,7 @@ cmd_kmem(void)
BZERO(&value[0], sizeof(ulonglong)*MAXARGS);
pc->curcmd_flags &= ~HEADER_PRINTED;
- while ((c = getopt(argcnt, args, "gI:sSrFfm:pvczCinl:L:PVoh")) != EOF) {
+ while ((c = getopt(argcnt, args, "gI:sS::rFfm:pvczCinl:L:PVoh")) != EOF) {
switch(c)
{
case 'V':
@@ -4903,6 +4907,29 @@ cmd_kmem(void)
break;
case 'S':
+ if (choose_cpu)
+ error(FATAL, "only one -S option allowed\n");
+ /* Use the GNU extension with getopt(3) ... */
+ if (optarg) {
+ if (!(vt->flags & KMALLOC_SLUB))
+ error(FATAL,
+ "can only use -S=cpu(s) with a kernel \n"
+ "that is built with CONFIG_SLUB support.\n");
+ if (optarg[0] != '=')
+ error(FATAL,
+ "CPU-specific slab data to be displayed "
+ "must be written as expected only e.g. -S=1,45.\n");
+ /* Skip = ... */
+ optarg++;
+
+ choose_cpu = 1;
+ BZERO(arg_buf, BUFSIZE);
+ strcpy(arg_buf, optarg);
+
+ cpus = get_cpumask_buf();
+ make_cpumask(arg_buf, cpus, FAULT_ON_ERROR, NULL);
+ meminfo.spec_cpumask = cpus;
+ }
Sflag = 1; sflag = rflag = 0;
break;
@@ -5185,6 +5212,8 @@ cmd_kmem(void)
meminfo.flags = VERBOSE;
vt->dump_kmem_cache(&meminfo);
}
+ if (choose_cpu)
+ FREEBUF(cpus);
}
if (vflag == 1)
@@ -19083,6 +19112,8 @@ do_kmem_cache_slub(struct meminfo *si)
per_cpu = (ulong *)GETBUF(sizeof(ulong) * vt->numnodes);
for (i = 0; i < kt->cpus; i++) {
+ if (si->spec_cpumask && !NUM_IN_BITMAP(si->spec_cpumask, i))
+ continue;
if (hide_offline_cpu(i)) {
fprintf(fp, "CPU %d [OFFLINE]\n", i);
continue;
--
2.30.2

View File

@ -0,0 +1,125 @@
From 4631320e96f8a63c897fbbce4e87e3c47af40bc9 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolshakov@yadro.com>
Date: Thu, 17 Jun 2021 02:27:32 +0300
Subject: [PATCH 02/27] diskdump: Fail readmem() early if dump is incomplete
kdump format description [1] says:
[...] zero page has its own offset not equal 0. So when reading page
from incomplete core, only the page lost by ENOSPACE errors has 0 in its
corresponding page descriptor's member offset.
crash has special treatment for page descriptors with zero offset only if
DUMP_DH_COMPRESSED_INCOMPLETE is set in dump header. However,
makedumpfile places the flag after ENOSPC is hit and only if dump header
modification went without errors.
In case if crashkernel environment was terminated early (e.g. by BMC) or
some other reason, DUMP_DH_COMPRESSED_INCOMPLETE won't be set on the
dump header. Then cache_page() would be performed on pages with
pd.offset == 0 and due to pd.size == 0 it'll skip read into
compressed_page and then non related pre-existing contents of
compressed_page will copied into page cache for the non-present page.
Ultimately, it'll lead to a cryptic failure, like:
crash: invalid kernel virtual address: 72288cacacf427f8 [...]
The failure would be a bit cleaner if crash explicitly fails on the page
that is an outcome of incomplete dump:
crash: page incomplete: kernel virtual address: c000003fff9d17e8 [...]
Debugging level 8 would also produce exact offset from data_offset to
print descriptor value with ease:
read_diskdump/cache_page: descriptor with zero offset found at paddr/pfn/pos: 3fff9d0000/3fff9d/743dd
That helps in inspecting broken descriptor with hexdump or similar tools:
hexdump -s (data_offset + pos * 0x18) -n 0x18
[1] https://github.com/makedumpfile/makedumpfile/blob/master/IMPLEMENTATION
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
defs.h | 1 +
diskdump.c | 16 +++++++++++-----
memory.c | 7 +++++++
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/defs.h b/defs.h
index c91177a245fd..eb1c71b5333a 100644
--- a/defs.h
+++ b/defs.h
@@ -361,6 +361,7 @@ struct number_option {
#define READ_ERROR (-2)
#define WRITE_ERROR (-3)
#define PAGE_EXCLUDED (-4)
+#define PAGE_INCOMPLETE (-5)
#define RESTART() (longjmp(pc->main_loop_env, 1))
#define RESUME_FOREACH() (longjmp(pc->foreach_loop_env, 1))
diff --git a/diskdump.c b/diskdump.c
index 668069585080..59b79e1bce95 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -1146,10 +1146,9 @@ cache_page(physaddr_t paddr)
if (FLAT_FORMAT()) {
if (!read_flattened_format(dd->dfd, pd.offset, dd->compressed_page, pd.size))
return READ_ERROR;
- } else if (is_incomplete_dump() && (0 == pd.offset)) {
+ } else if (0 == pd.offset) {
/*
- * If the incomplete flag has been set in the header,
- * first check whether zero_excluded has been set.
+ * First check whether zero_excluded has been set.
*/
if (*diskdump_flags & ZERO_EXCLUDED) {
if (CRASHDEBUG(8))
@@ -1158,8 +1157,15 @@ cache_page(physaddr_t paddr)
"paddr/pfn: %llx/%lx\n",
(ulonglong)paddr, pfn);
memset(dd->compressed_page, 0, dd->block_size);
- } else
- return READ_ERROR;
+ } else {
+ if (CRASHDEBUG(8))
+ fprintf(fp,
+ "read_diskdump/cache_page: "
+ "descriptor with zero offset found at "
+ "paddr/pfn/pos: %llx/%lx/%lx\n",
+ (ulonglong)paddr, pfn, desc_pos);
+ return PAGE_INCOMPLETE;
+ }
} else {
if (lseek(dd->dfd, pd.offset, SEEK_SET) == failed)
return SEEK_ERROR;
diff --git a/memory.c b/memory.c
index ca4c633e5074..86c02c132890 100644
--- a/memory.c
+++ b/memory.c
@@ -2213,6 +2213,7 @@ accessible(ulong kva)
#define READ_ERRMSG "read error: %s address: %llx type: \"%s\"\n"
#define WRITE_ERRMSG "write error: %s address: %llx type: \"%s\"\n"
#define PAGE_EXCLUDED_ERRMSG "page excluded: %s address: %llx type: \"%s\"\n"
+#define PAGE_INCOMPLETE_ERRMSG "page incomplete: %s address: %llx type: \"%s\"\n"
#define RETURN_ON_PARTIAL_READ() \
if ((error_handle & RETURN_PARTIAL) && (size < orig_size)) { \
@@ -2378,6 +2379,12 @@ readmem(ulonglong addr, int memtype, void *buffer, long size,
error(INFO, PAGE_EXCLUDED_ERRMSG, memtype_string(memtype, 0), addr, type);
goto readmem_error;
+ case PAGE_INCOMPLETE:
+ RETURN_ON_PARTIAL_READ();
+ if (PRINT_ERROR_MESSAGE)
+ error(INFO, PAGE_INCOMPLETE_ERRMSG, memtype_string(memtype, 0), addr, type);
+ goto readmem_error;
+
default:
break;
}
--
2.30.2

View File

@ -0,0 +1,36 @@
From 41cda195c6421fbde72ed67b32b8c1ab3eb0c56f Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolshakov@yadro.com>
Date: Thu, 17 Jun 2021 02:27:33 +0300
Subject: [PATCH 03/27] netdump: Permit --zero_excluded for incomplete ELF
dumps
DUMP_ELF_INCOMPLETE is set very late after ENOSPC error is hit by
makedumpfile. Any following error that prevents modification of ELF
header would result in effectively incomplete core that doesn't have the
flag. zero_excluded flag doesn't work for such kind of incomplete core.
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
netdump.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/netdump.c b/netdump.c
index aaea945aaca7..e8721d89f1a3 100644
--- a/netdump.c
+++ b/netdump.c
@@ -819,10 +819,9 @@ read_netdump(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
read_ret = read(nd->ndfd, bufptr, cnt);
if (read_ret != cnt) {
/*
- * If the incomplete flag has been set in the header,
- * first check whether zero_excluded has been set.
+ * First check whether zero_excluded has been set.
*/
- if (is_incomplete_dump() && (read_ret >= 0) &&
+ if ((read_ret >= 0) &&
(*diskdump_flags & ZERO_EXCLUDED)) {
if (CRASHDEBUG(8))
fprintf(fp, "read_netdump: zero-fill: "
--
2.30.2

View File

@ -0,0 +1,52 @@
From 1425b0504b1e79d88a2d188d7e4c0e7fceba4501 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolshakov@yadro.com>
Date: Thu, 17 Jun 2021 02:27:34 +0300
Subject: [PATCH 04/27] diskdump: Print total number of dumpable pages
It's not clear how broken an incomplete dump from the existing debugging
prints. Aggregate number of valid pages helps to figure out approximate
size of the dump. Size of a complete dump is roughly:
EXPECTED_CORE_SIZE = a few pages (kdump headers + bitmaps + descriptors) +
(total_valid_pages * block_size) * compression rate
An incomplete core would be significantly smaller than:
total_valid_pages * block_size
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
diskdump.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/diskdump.c b/diskdump.c
index 59b79e1bce95..0f9402248d51 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -74,6 +74,7 @@ struct diskdump_data {
ulong evictions; /* total evictions done */
ulong cached_reads;
ulong *valid_pages;
+ int max_sect_len; /* highest bucket of valid_pages */
ulong accesses;
ulong snapshot_task;
};
@@ -877,6 +878,7 @@ restart:
}
dd->valid_pages = calloc(sizeof(ulong), max_sect_len + 1);
+ dd->max_sect_len = max_sect_len;
for (i = 1; i < max_sect_len + 1; i++) {
dd->valid_pages[i] = dd->valid_pages[i - 1];
for (j = 0; j < BITMAP_SECT_LEN; j++, pfn++)
@@ -2089,6 +2091,7 @@ __diskdump_memory_dump(FILE *fp)
else
fprintf(fp, "\n");
fprintf(fp, " valid_pages: %lx\n", (ulong)dd->valid_pages);
+ fprintf(fp, " total_valid_pages: %ld\n", dd->valid_pages[dd->max_sect_len]);
return 0;
}
--
2.30.2

View File

@ -0,0 +1,67 @@
From 881f33d97cee9895796829d0cc969b51dd34d831 Mon Sep 17 00:00:00 2001
From: Roman Bolshakov <r.bolshakov@yadro.com>
Date: Thu, 17 Jun 2021 02:27:35 +0300
Subject: [PATCH 05/27] diskdump: Introduce read_pd()
Standalone function for reading of page descriptors is needed later for
of expected core size and detection of incomplete dumps.
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
diskdump.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/diskdump.c b/diskdump.c
index 0f9402248d51..de3eeb2c720c 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -510,6 +510,27 @@ arm_kdump_header_adjust(int header_version)
}
#endif /* __i386__ && (ARM || MIPS) */
+/*
+ * Read page descriptor.
+ */
+static int
+read_pd(int fd, off_t offset, page_desc_t *pd)
+{
+ const off_t failed = (off_t)-1;
+
+ if (FLAT_FORMAT()) {
+ if (!read_flattened_format(fd, offset, pd, sizeof(*pd)))
+ return READ_ERROR;
+ } else {
+ if (lseek(fd, offset, SEEK_SET) == failed)
+ return SEEK_ERROR;
+ if (read(fd, pd, sizeof(*pd)) != sizeof(*pd))
+ return READ_ERROR;
+ }
+
+ return 0;
+}
+
static int
read_dump_header(char *file)
{
@@ -1130,15 +1151,9 @@ cache_page(physaddr_t paddr)
+ (off_t)(desc_pos - 1)*sizeof(page_desc_t);
/* read page descriptor */
- if (FLAT_FORMAT()) {
- if (!read_flattened_format(dd->dfd, seek_offset, &pd, sizeof(pd)))
- return READ_ERROR;
- } else {
- if (lseek(dd->dfd, seek_offset, SEEK_SET) == failed)
- return SEEK_ERROR;
- if (read(dd->dfd, &pd, sizeof(pd)) != sizeof(pd))
- return READ_ERROR;
- }
+ ret = read_pd(dd->dfd, seek_offset, &pd);
+ if (ret)
+ return ret;
/* sanity check */
if (pd.size > block_size)
--
2.30.2

View File

@ -0,0 +1,66 @@
From 44e5801d9016987b6b4ebd571bfde8ae3e75da7b Mon Sep 17 00:00:00 2001
From: Philipp Rudo <prudo@redhat.com>
Date: Thu, 5 Aug 2021 15:19:37 +0200
Subject: [PATCH 06/27] x86_64: Fix check for __per_cpu_offset initialization
Since at least kernel v2.6.30 the __per_cpu_offset gets initialized to
__per_cpu_load. So first check if the __per_cpu_offset was set to a
proper value before reading any per cpu variable to prevent potential
bugs.
[ kh: added check for the existence of __per_cpu_load ]
Signed-off-by: Philipp Rudo <prudo@redhat.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
x86_64.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/x86_64.c b/x86_64.c
index 6eb7d6708db0..87cbeaeb4f06 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -1285,6 +1285,7 @@ x86_64_per_cpu_init(void)
struct machine_specific *ms;
struct syment *irq_sp, *curr_sp, *cpu_sp, *hardirq_stack_ptr_sp;
ulong hardirq_stack_ptr;
+ ulong __per_cpu_load = 0;
ms = machdep->machspec;
@@ -1326,7 +1327,12 @@ x86_64_per_cpu_init(void)
else if (!ms->stkinfo.isize)
ms->stkinfo.isize = 16384;
+ if (kernel_symbol_exists("__per_cpu_load"))
+ __per_cpu_load = symbol_value("__per_cpu_load");
+
for (i = cpus = 0; i < NR_CPUS; i++) {
+ if (__per_cpu_load && kt->__per_cpu_offset[i] == __per_cpu_load)
+ break;
if (!readmem(cpu_sp->value + kt->__per_cpu_offset[i],
KVADDR, &cpunumber, sizeof(int),
"cpu number (per_cpu)", QUIET|RETURN_ON_ERROR))
@@ -5595,14 +5601,18 @@ x86_64_get_smp_cpus(void)
char *cpu_pda_buf;
ulong level4_pgt, cpu_pda_addr;
struct syment *sp;
+ ulong __per_cpu_load = 0;
if (!VALID_STRUCT(x8664_pda)) {
if (!(sp = per_cpu_symbol_search("per_cpu__cpu_number")) ||
!(kt->flags & PER_CPU_OFF))
return 1;
+ if (kernel_symbol_exists("__per_cpu_load"))
+ __per_cpu_load = symbol_value("__per_cpu_load");
+
for (i = cpus = 0; i < NR_CPUS; i++) {
- if (kt->__per_cpu_offset[i] == 0)
+ if (__per_cpu_load && kt->__per_cpu_offset[i] == __per_cpu_load)
break;
if (!readmem(sp->value + kt->__per_cpu_offset[i],
KVADDR, &cpunumber, sizeof(int),
--
2.30.2

View File

@ -0,0 +1,77 @@
From 4b34197508578bb43639e6d169fb91fb0489fa2b Mon Sep 17 00:00:00 2001
From: James Hsu <james.hsu@mediatek.com>
Date: Wed, 18 Aug 2021 15:45:47 +0800
Subject: [PATCH 07/27] arm64: Get CPU registers from ELF notes even without
crash_notes symbol
Currently arm64 crash retrieves the CPU registers from crash_notes symbol
or ELF notes only when the symbol exists, but there are dumpfiles which
have the registers in ELF notes without the symbol.
With the patch, crash can retrieve the registers from ELF notes without
the crash_notes symbol.
Signed-off-by: James Hsu <james.hsu@mediatek.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
arm64.c | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/arm64.c b/arm64.c
index d73d5c5a4fed..7069312671cf 100644
--- a/arm64.c
+++ b/arm64.c
@@ -3698,14 +3698,48 @@ arm64_get_crash_notes(void)
{
struct machine_specific *ms = machdep->machspec;
ulong crash_notes;
- Elf64_Nhdr *note;
+ Elf64_Nhdr *note = NULL;
ulong offset;
char *buf, *p;
ulong *notes_ptrs;
ulong i, found;
- if (!symbol_exists("crash_notes"))
+ if (!symbol_exists("crash_notes")) {
+ if (DISKDUMP_DUMPFILE() || KDUMP_DUMPFILE()) {
+ if (!(ms->panic_task_regs = calloc((size_t)kt->cpus, sizeof(struct arm64_pt_regs))))
+ error(FATAL, "cannot calloc panic_task_regs space\n");
+
+ for (i = found = 0; i < kt->cpus; i++) {
+ if (DISKDUMP_DUMPFILE())
+ note = diskdump_get_prstatus_percpu(i);
+ else if (KDUMP_DUMPFILE())
+ note = netdump_get_prstatus_percpu(i);
+
+ if (!note) {
+ error(WARNING, "cpu %d: cannot find NT_PRSTATUS note\n", i);
+ continue;
+ }
+
+ /*
+ * Find correct location of note data. This contains elf_prstatus
+ * structure which has registers etc. for the crashed task.
+ */
+ offset = sizeof(Elf64_Nhdr);
+ offset = roundup(offset + note->n_namesz, 4);
+ p = (char *)note + offset; /* start of elf_prstatus */
+
+ BCOPY(p + OFFSET(elf_prstatus_pr_reg), &ms->panic_task_regs[i],
+ sizeof(struct arm64_pt_regs));
+
+ found++;
+ }
+ if (!found) {
+ free(ms->panic_task_regs);
+ ms->panic_task_regs = NULL;
+ }
+ }
return;
+ }
crash_notes = symbol_value("crash_notes");
--
2.30.2

View File

@ -0,0 +1,34 @@
From 3db5fff2e9d7b8762d1bd46d8d2c47ba4c7e374f Mon Sep 17 00:00:00 2001
From: Ritesh Harjani <riteshh@linux.ibm.com>
Date: Thu, 26 Aug 2021 02:31:08 +0530
Subject: [PATCH 08/27] .gitignore: Add cscope, ctags & compile_commands.json
Add cscope, ctags & compile_commands.json in .gitignore file.
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
.gitignore | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/.gitignore b/.gitignore
index 5b2ba1d34012..b39832fa71df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,14 @@ gdb-7.6/
extensions/defs.h
extensions/*.so
extensions/eppic
+
+# cscope files
+cscope.*
+ncscope.*
+
+# ctags files
+tags
+TAGS
+
+# Clang's compilation database file
+/compile_commands.json
--
2.30.2

View File

@ -0,0 +1,28 @@
From 15765867c0f1d937db5ec06f51adb6bfd13354ea Mon Sep 17 00:00:00 2001
From: Ritesh Harjani <riteshh@linux.ibm.com>
Date: Thu, 26 Aug 2021 02:31:10 +0530
Subject: [PATCH 09/27] ppc64: Add MMU type info in machdep command
This adds MMU type info in "machdep" command.
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
ppc64.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ppc64.c b/ppc64.c
index f368bf8e1a08..975caa53b812 100644
--- a/ppc64.c
+++ b/ppc64.c
@@ -3027,6 +3027,8 @@ ppc64_display_machine_stats(void)
else
fprintf(fp, "(unknown)\n");
fprintf(fp, " HZ: %d\n", machdep->hz);
+ fprintf(fp, " MMU: %s\n", machdep->flags & RADIX_MMU
+ ? "RADIX" : "HASH");
fprintf(fp, " PAGE SIZE: %d\n", PAGESIZE());
// fprintf(fp, " L1 CACHE SIZE: %d\n", l1_cache_size());
fprintf(fp, "KERNEL VIRTUAL BASE: %lx\n", machdep->kvbase);
--
2.30.2

View File

@ -0,0 +1,48 @@
From cf0c8d10e1870d89b39f40382634db51aa8fcf2c Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Fri, 3 Sep 2021 17:33:42 +0530
Subject: [PATCH 10/27] mod: fix module object file lookup
On systems where vmlinux file is not under /usr/lib/debug/lib/modules
directory, 'mod -s|-S' command may fail to find the module's object
file with the below error:
mod: cannot find or load object file for sd_mod module
Fix it by trying all possible module object file extentions while
searching for the object file under /usr/lib/debug/lib/modules
directory.
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
---
kernel.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/kernel.c b/kernel.c
index 36fdea29b1cb..b2c8a0ccb7ab 100644
--- a/kernel.c
+++ b/kernel.c
@@ -4796,7 +4796,18 @@ module_objfile_search(char *modref, char *filename, char *tree)
sprintf(dir, "%s/%s", DEFAULT_REDHAT_DEBUG_LOCATION,
kt->utsname.release);
- retbuf = search_directory_tree(dir, file, 0);
+ if (!(retbuf = search_directory_tree(dir, file, 0))) {
+ switch (kt->flags & (KMOD_V1|KMOD_V2))
+ {
+ case KMOD_V2:
+ sprintf(file, "%s.ko", modref);
+ retbuf = search_directory_tree(dir, file, 0);
+ if (!retbuf) {
+ sprintf(file, "%s.ko.debug", modref);
+ retbuf = search_directory_tree(dir, file, 0);
+ }
+ }
+ }
if (!retbuf && (env = getenv("CRASH_MODULE_PATH"))) {
sprintf(dir, "%s", env);
--
2.30.2

View File

@ -0,0 +1,265 @@
From 7f38d1baf794823355ee100b3a1914155d4190f2 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Mon, 27 Sep 2021 09:45:42 +0900
Subject: [PATCH 11/27] diskdump: Add support for reading dumpfiles compressed
by Zstandard
Add support for reading dumpfiles compressed by Zstandard (zstd)
using makedumpfile.
To build crash with zstd support, type "make zstd".
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
Makefile | 4 ++++
README | 4 ++--
configure.c | 24 +++++++++++++++++++++---
defs.h | 4 ++++
diskdump.c | 37 +++++++++++++++++++++++++++++++++++++
diskdump.h | 1 +
help.c | 4 ++--
7 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index ece13069a029..eae023c54bdd 100644
--- a/Makefile
+++ b/Makefile
@@ -333,6 +333,10 @@ snappy: make_configure
@./configure -x snappy ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
+zstd: make_configure
+ @./configure -x zstd ${CONF_TARGET_FLAG} -w -b
+ @make --no-print-directory gdb_merge
+
valgrind: make_configure
@./configure -x valgrind ${CONF_TARGET_FLAG} -w -b
@make --no-print-directory gdb_merge
diff --git a/README b/README
index 50179742e620..4962f272074b 100644
--- a/README
+++ b/README
@@ -102,8 +102,8 @@
Traditionally when vmcores are compressed via the makedumpfile(8) facility
the libz compression library is used, and by default the crash utility
only supports libz. Recently makedumpfile has been enhanced to optionally
- use either the LZO or snappy compression libraries. To build crash with
- either or both of those libraries, type "make lzo" or "make snappy".
+ use the LZO, snappy or zstd compression libraries. To build crash with any
+ or all of those libraries, type "make lzo", "make snappy" or "make zstd".
crash supports valgrind Memcheck tool on the crash's custom memory allocator.
To build crash with this feature enabled, type "make valgrind" and then run
diff --git a/configure.c b/configure.c
index e8f619a3c061..b691a139b960 100644
--- a/configure.c
+++ b/configure.c
@@ -1738,6 +1738,10 @@ get_extra_flags(char *filename, char *initial)
* - enter -DSNAPPY in the CFLAGS.extra file
* - enter -lsnappy in the LDFLAGS.extra file
*
+ * For zstd:
+ * - enter -DZSTD in the CFLAGS.extra file
+ * - enter -lzstd in the LDFLAGS.extra file
+ *
* For valgrind:
* - enter -DVALGRIND in the CFLAGS.extra file
*/
@@ -1746,6 +1750,7 @@ add_extra_lib(char *option)
{
int lzo, add_DLZO, add_llzo2;
int snappy, add_DSNAPPY, add_lsnappy;
+ int zstd, add_DZSTD, add_lzstd;
int valgrind, add_DVALGRIND;
char *cflags, *ldflags;
FILE *fp_cflags, *fp_ldflags;
@@ -1754,6 +1759,7 @@ add_extra_lib(char *option)
lzo = add_DLZO = add_llzo2 = 0;
snappy = add_DSNAPPY = add_lsnappy = 0;
+ zstd = add_DZSTD = add_lzstd = 0;
valgrind = add_DVALGRIND = 0;
ldflags = get_extra_flags("LDFLAGS.extra", NULL);
@@ -1775,13 +1781,21 @@ add_extra_lib(char *option)
add_lsnappy++;
}
+ if (strcmp(option, "zstd") == 0) {
+ zstd++;
+ if (!cflags || !strstr(cflags, "-DZSTD"))
+ add_DZSTD++;
+ if (!ldflags || !strstr(ldflags, "-lzstd"))
+ add_lzstd++;
+ }
+
if (strcmp(option, "valgrind") == 0) {
valgrind++;
if (!cflags || !strstr(cflags, "-DVALGRIND"))
add_DVALGRIND++;
}
- if ((lzo || snappy) &&
+ if ((lzo || snappy || zstd) &&
file_exists("diskdump.o") && (unlink("diskdump.o") < 0)) {
perror("diskdump.o");
return;
@@ -1806,24 +1820,28 @@ add_extra_lib(char *option)
return;
}
- if (add_DLZO || add_DSNAPPY || add_DVALGRIND) {
+ if (add_DLZO || add_DSNAPPY || add_DZSTD || add_DVALGRIND) {
while (fgets(inbuf, 512, fp_cflags))
;
if (add_DLZO)
fputs("-DLZO\n", fp_cflags);
if (add_DSNAPPY)
fputs("-DSNAPPY\n", fp_cflags);
+ if (add_DZSTD)
+ fputs("-DZSTD\n", fp_cflags);
if (add_DVALGRIND)
fputs("-DVALGRIND\n", fp_cflags);
}
- if (add_llzo2 || add_lsnappy) {
+ if (add_llzo2 || add_lsnappy || add_lzstd) {
while (fgets(inbuf, 512, fp_ldflags))
;
if (add_llzo2)
fputs("-llzo2\n", fp_ldflags);
if (add_lsnappy)
fputs("-lsnappy\n", fp_ldflags);
+ if (add_lzstd)
+ fputs("-lzstd\n", fp_ldflags);
}
fclose(fp_cflags);
diff --git a/defs.h b/defs.h
index eb1c71b5333a..b2e94722c92b 100644
--- a/defs.h
+++ b/defs.h
@@ -54,6 +54,9 @@
#ifdef SNAPPY
#include <snappy-c.h>
#endif
+#ifdef ZSTD
+#include <zstd.h>
+#endif
#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
@@ -327,6 +330,7 @@ struct number_option {
#define NO_ELF_NOTES (0x20)
#define LZO_SUPPORTED (0x40)
#define SNAPPY_SUPPORTED (0x80)
+#define ZSTD_SUPPORTED (0x100)
#define DISKDUMP_VALID() (dd->flags & DISKDUMP_LOCAL)
#define KDUMP_CMPRS_VALID() (dd->flags & KDUMP_CMPRS_LOCAL)
#define KDUMP_SPLIT() (dd->flags & DUMPFILE_SPLIT)
diff --git a/diskdump.c b/diskdump.c
index de3eeb2c720c..112f769f8949 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -1001,6 +1001,9 @@ is_diskdump(char *file)
#ifdef SNAPPY
dd->flags |= SNAPPY_SUPPORTED;
#endif
+#ifdef ZSTD
+ dd->flags |= ZSTD_SUPPORTED;
+#endif
pc->read_vmcoreinfo = vmcoreinfo_read_string;
@@ -1124,6 +1127,9 @@ cache_page(physaddr_t paddr)
const int block_size = dd->block_size;
const off_t failed = (off_t)-1;
ulong retlen;
+#ifdef ZSTD
+ static ZSTD_DCtx *dctx = NULL;
+#endif
for (i = found = 0; i < DISKDUMP_CACHED_PAGES; i++) {
if (DISKDUMP_VALID_PAGE(dd->page_cache_hdr[i].pg_flags))
@@ -1251,6 +1257,33 @@ cache_page(physaddr_t paddr)
ret);
return READ_ERROR;
}
+#endif
+ } else if (pd.flags & DUMP_DH_COMPRESSED_ZSTD) {
+
+ if (!(dd->flags & ZSTD_SUPPORTED)) {
+ error(INFO, "%s: uncompess failed: no zstd compression support\n",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump");
+ return READ_ERROR;
+ }
+#ifdef ZSTD
+ if (!dctx) {
+ dctx = ZSTD_createDCtx();
+ if (!dctx) {
+ error(INFO, "%s: uncompess failed: cannot create ZSTD_DCtx\n",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump");
+ return READ_ERROR;
+ }
+ }
+
+ retlen = ZSTD_decompressDCtx(dctx,
+ dd->page_cache_hdr[i].pg_bufptr, block_size,
+ dd->compressed_page, pd.size);
+ if (ZSTD_isError(retlen) || (retlen != block_size)) {
+ error(INFO, "%s: uncompress failed: %d (%s)\n",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump",
+ retlen, ZSTD_getErrorName(retlen));
+ return READ_ERROR;
+ }
#endif
} else
memcpy(dd->page_cache_hdr[i].pg_bufptr,
@@ -1806,6 +1839,8 @@ __diskdump_memory_dump(FILE *fp)
fprintf(fp, "%sLZO_SUPPORTED", others++ ? "|" : "");
if (dd->flags & SNAPPY_SUPPORTED)
fprintf(fp, "%sSNAPPY_SUPPORTED", others++ ? "|" : "");
+ if (dd->flags & ZSTD_SUPPORTED)
+ fprintf(fp, "%sZSTD_SUPPORTED", others++ ? "|" : "");
fprintf(fp, ") %s\n", FLAT_FORMAT() ? "[FLAT]" : "");
fprintf(fp, " dfd: %d\n", dd->dfd);
fprintf(fp, " ofp: %lx\n", (ulong)dd->ofp);
@@ -1872,6 +1907,8 @@ __diskdump_memory_dump(FILE *fp)
fprintf(fp, "DUMP_DH_COMPRESSED_LZO");
if (dh->status & DUMP_DH_COMPRESSED_SNAPPY)
fprintf(fp, "DUMP_DH_COMPRESSED_SNAPPY");
+ if (dh->status & DUMP_DH_COMPRESSED_ZSTD)
+ fprintf(fp, "DUMP_DH_COMPRESSED_ZSTD");
if (dh->status & DUMP_DH_COMPRESSED_INCOMPLETE)
fprintf(fp, "DUMP_DH_COMPRESSED_INCOMPLETE");
if (dh->status & DUMP_DH_EXCLUDED_VMEMMAP)
diff --git a/diskdump.h b/diskdump.h
index 28713407b841..c152c7b86616 100644
--- a/diskdump.h
+++ b/diskdump.h
@@ -86,6 +86,7 @@ struct kdump_sub_header {
#define DUMP_DH_COMPRESSED_SNAPPY 0x4 /* page is compressed with snappy */
#define DUMP_DH_COMPRESSED_INCOMPLETE 0x8 /* dumpfile is incomplete */
#define DUMP_DH_EXCLUDED_VMEMMAP 0x10 /* unused vmemmap pages are excluded */
+#define DUMP_DH_COMPRESSED_ZSTD 0x20 /* page is compressed with zstd */
/* descriptor of each page for vmcore */
typedef struct page_desc {
diff --git a/help.c b/help.c
index 6c262a3ffcbb..f34838d59908 100644
--- a/help.c
+++ b/help.c
@@ -9420,8 +9420,8 @@ README_ENTER_DIRECTORY,
" Traditionally when vmcores are compressed via the makedumpfile(8) facility",
" the libz compression library is used, and by default the crash utility",
" only supports libz. Recently makedumpfile has been enhanced to optionally",
-" use either the LZO or snappy compression libraries. To build crash with",
-" either or both of those libraries, type \"make lzo\" or \"make snappy\".",
+" use the LZO, snappy or zstd compression libraries. To build crash with any",
+" or all of those libraries, type \"make lzo\", \"make snappy\" or \"make zstd\".",
"",
" crash supports valgrind Memcheck tool on the crash's custom memory allocator.",
" To build crash with this feature enabled, type \"make valgrind\" and then run",
--
2.30.2

10136
0012-Update-to-gdb-10.2.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,120 @@
From 163abcbbabdf8207c11ee93b1c909d85ecbcbf1f Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:26 -0700
Subject: [PATCH 13/27] crash_get_nr_cpus: get nr_cpus from the dumps
Most of the dumps have information about real number of CPUS.
Use that to instantiate GDB's target inferior threads.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
---
diskdump.c | 13 +++++++++++--
gdb_interface.c | 9 +++++++++
netdump.c | 11 ++++++++---
sadump.c | 2 +-
4 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/diskdump.c b/diskdump.c
index 112f769f8949..3e1cfd548c96 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2593,13 +2593,22 @@ diskdump_kaslr_check()
return FALSE;
}
-#ifdef X86_64
int
diskdump_get_nr_cpus(void)
{
- return dd->num_qemu_notes;
+ if (dd->num_prstatus_notes)
+ return dd->num_prstatus_notes;
+ else if (dd->num_qemu_notes)
+ return dd->num_qemu_notes;
+ else if (dd->num_vmcoredd_notes)
+ return dd->num_vmcoredd_notes;
+ else if (dd->header->nr_cpus)
+ return dd->header->nr_cpus;
+
+ return 1;
}
+#ifdef X86_64
QEMUCPUState *
diskdump_get_qemucpustate(int cpu)
{
diff --git a/gdb_interface.c b/gdb_interface.c
index 93fc8baef2c6..bcca080eb8b4 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -1070,6 +1070,15 @@ int crash_get_nr_cpus(void);
int crash_get_nr_cpus(void)
{
+ if (SADUMP_DUMPFILE())
+ return sadump_get_nr_cpus();
+ else if (DISKDUMP_DUMPFILE())
+ return diskdump_get_nr_cpus();
+ else if (KDUMP_DUMPFILE())
+ return kdump_get_nr_cpus();
+ else if (VMSS_DUMPFILE())
+ return vmware_vmss_get_nr_cpus();
+
/* Just CPU #0 */
return 1;
}
diff --git a/netdump.c b/netdump.c
index e8721d89f1a3..ff273b4fdfab 100644
--- a/netdump.c
+++ b/netdump.c
@@ -5206,11 +5206,17 @@ kdump_kaslr_check(void)
return FALSE;
}
-#ifdef X86_64
int
kdump_get_nr_cpus(void)
{
- return nd->num_qemu_notes;
+ if (nd->num_prstatus_notes)
+ return nd->num_prstatus_notes;
+ else if (nd->num_qemu_notes)
+ return nd->num_qemu_notes;
+ else if (nd->num_vmcoredd_notes)
+ return nd->num_vmcoredd_notes;
+
+ return 1;
}
QEMUCPUState *
@@ -5232,7 +5238,6 @@ kdump_get_qemucpustate(int cpu)
return (QEMUCPUState *)nd->nt_qemu_percpu[cpu];
}
-#endif
static void *
get_kdump_device_dump_offset(void)
diff --git a/sadump.c b/sadump.c
index d75c66b74be9..cb43fdb8ecab 100644
--- a/sadump.c
+++ b/sadump.c
@@ -1670,7 +1670,6 @@ get_sadump_data(void)
return sd;
}
-#ifdef X86_64
int
sadump_get_nr_cpus(void)
{
@@ -1678,6 +1677,7 @@ sadump_get_nr_cpus(void)
return sd->dump_header->nr_cpus;
}
+#ifdef X86_64
int
sadump_get_cr3_cr4_idtr(int cpu, ulong *cr3, ulong *cr4, ulong *idtr)
{
--
2.30.2

View File

@ -0,0 +1,45 @@
From 36e9d8673e9205f4ea4daad61c199597920c93df Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:27 -0700
Subject: [PATCH 14/27] "whatis -m": fix duplications in the output
"whatis -m" output started to generate duplicated results after GDB update:
crash> whatis -m mm_struct
SIZE TYPE
16 tlb_state
...
256 linux_binprm
2752 rq
2752 rq <<-- duplicated
2752 rq
2752 rq
2752 rq
4048 task_struct
It was caused by incorrect string comparisons.
Use strcmp for full string comparison instead of just string pointers
comparison.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Reported-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
symbols.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/symbols.c b/symbols.c
index 7ffac2ee8b49..338af2ce5038 100644
--- a/symbols.c
+++ b/symbols.c
@@ -7000,7 +7000,7 @@ append_struct_symbol (struct gnu_request *req, void *data)
struct type_request *treq = (struct type_request *)data;
for (i = 0; i < treq->idx; i++)
- if (treq->types[i].name == req->name)
+ if (!strcmp(treq->types[i].name, req->name))
break;
if (i < treq->idx) // We've already collected this type
--
2.30.2

View File

@ -0,0 +1,80 @@
From 0b85218983ffcf939a638f1133871079c5615a46 Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:30 -0700
Subject: [PATCH 15/27] Fix reduced output of `bt` command
gdb-10 produces reduced output of `bt` command.
Changed disassembler output is the reason of missing frames
in backtrace. Call instruction mnemonic for x86_64 was changed
from "callq" to "call" in gdb-10.
Fixing the issue by adding a search for "call" word in disassembler
parser.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Reported-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
x86_64.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/x86_64.c b/x86_64.c
index 21756f6cf7ab..4f34afac06f9 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -4415,7 +4415,7 @@ x86_64_function_called_by(ulong rip)
if (gdb_pass_through(buf, pc->tmpfile2, GNU_RETURN_ON_ERROR)) {
rewind(pc->tmpfile2);
while (fgets(buf, BUFSIZE, pc->tmpfile2)) {
- if ((p1 = strstr(buf, "callq")) &&
+ if ((p1 = strstr(buf, "call")) &&
whitespace(*(p1-1))) {
if (extract_hex(p1, &value, NULLCHAR, TRUE))
break;
@@ -6381,11 +6381,13 @@ search_for_switch_to(ulong start, ulong end)
char search_string1[BUFSIZE];
char search_string2[BUFSIZE];
char search_string3[BUFSIZE];
+ char search_string4[BUFSIZE];
int found;
max_instructions = end - start;
found = FALSE;
- search_string1[0] = search_string2[0] = search_string3[0] = NULLCHAR;
+ search_string1[0] = search_string2[0] = NULLCHAR;
+ search_string3[0] = search_string4[0] = NULLCHAR;
sprintf(buf1, "x/%ldi 0x%lx", max_instructions, start);
if (symbol_exists("__switch_to")) {
@@ -6396,7 +6398,9 @@ search_for_switch_to(ulong start, ulong end)
}
if (symbol_exists("__switch_to_asm")) {
sprintf(search_string3,
- "callq 0x%lx", symbol_value("__switch_to_asm"));
+ "callq 0x%lx", symbol_value("__switch_to_asm"));
+ sprintf(search_string4,
+ "call 0x%lx", symbol_value("__switch_to_asm"));
}
open_tmpfile();
@@ -6416,6 +6420,8 @@ search_for_switch_to(ulong start, ulong end)
found = TRUE;
if (strlen(search_string3) && strstr(buf1, search_string3))
found = TRUE;
+ if (strlen(search_string4) && strstr(buf1, search_string4))
+ found = TRUE;
}
close_tmpfile();
@@ -8230,7 +8236,7 @@ x86_64_do_not_cache_framesize(struct syment *sp, ulong textaddr)
return TRUE;
}
- if (STREQ(arglist[instr], "callq"))
+ if (STREQ(arglist[instr], "callq") || STREQ(arglist[instr], "call"))
break;
}
close_tmpfile2();
--
2.30.2

View File

@ -0,0 +1,335 @@
From 2f967fb5ebd737ce5eadba462df35935122e8865 Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:33 -0700
Subject: [PATCH 16/27] crash_taget: fetch_registers support
Provides API for crash_target to fetch registers of given
CPU. It will allow gdb to perform such commands as "bt",
"frame", "info locals".
Highlevel API is crash_get_cpu_reg (). It calls machine
(architecture) specific function: machdep->get_cpu_reg().
Input arguments such as register number and register size
come from gdb arch information. So, get_cpu_regs()
implementations in crash must understand it.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
---
crash_target.c | 33 +++++++++++++++++++++++++++++++-
defs.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
gdb_interface.c | 19 +++++++++++++-----
vmware_vmss.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++-
x86_64.c | 16 ++++++++++++++++
5 files changed, 163 insertions(+), 7 deletions(-)
diff --git a/crash_target.c b/crash_target.c
index a123329019f5..455480679741 100644
--- a/crash_target.c
+++ b/crash_target.c
@@ -27,6 +27,8 @@ void crash_target_init (void);
extern "C" int gdb_readmem_callback(unsigned long, void *, int, int);
extern "C" int crash_get_nr_cpus(void);
+extern "C" int crash_get_cpu_reg (int cpu, int regno, const char *regname,
+ int regsize, void *val);
/* The crash target. */
@@ -44,6 +46,7 @@ public:
const target_info &info () const override
{ return crash_target_info; }
+ void fetch_registers (struct regcache *, int) override;
enum target_xfer_status xfer_partial (enum target_object object,
const char *annex,
gdb_byte *readbuf,
@@ -54,13 +57,35 @@ public:
bool has_all_memory () override { return true; }
bool has_memory () override { return true; }
bool has_stack () override { return true; }
- bool has_registers () override { return false; }
+ bool has_registers () override { return true; }
bool thread_alive (ptid_t ptid) override { return true; }
std::string pid_to_str (ptid_t ptid) override
{ return string_printf ("CPU %ld", ptid.tid ()); }
};
+/* We just get all the registers, so we don't use regno. */
+void
+crash_target::fetch_registers (struct regcache *regcache, int regno)
+{
+ gdb_byte regval[16];
+ int cpu = inferior_ptid.tid();
+ struct gdbarch *arch = regcache->arch ();
+
+ for (int r = 0; r < gdbarch_num_regs (arch); r++)
+ {
+ const char *regname = gdbarch_register_name(arch, r);
+ int regsize = register_size (arch, r);
+ if (regsize > sizeof (regval))
+ error (_("fatal error: buffer size is not enough to fit register value"));
+
+ if (crash_get_cpu_reg (cpu, r, regname, regsize, (void *)&regval))
+ regcache->raw_supply (r, regval);
+ else
+ regcache->raw_supply (r, NULL);
+ }
+}
+
enum target_xfer_status
crash_target::xfer_partial (enum target_object object, const char *annex,
@@ -101,4 +126,10 @@ crash_target_init (void)
if (!i)
switch_to_thread (thread);
}
+
+ /* Fetch all registers from core file. */
+ target_fetch_registers (get_current_regcache (), -1);
+
+ /* Now, set up the frame cache. */
+ reinit_frame_cache ();
}
diff --git a/defs.h b/defs.h
index db0bd9ca9fe8..b34c60e9a795 100644
--- a/defs.h
+++ b/defs.h
@@ -1013,6 +1013,7 @@ struct machdep_table {
ulong (*processor_speed)(void);
int (*uvtop)(struct task_context *, ulong, physaddr_t *, int);
int (*kvtop)(struct task_context *, ulong, physaddr_t *, int);
+ int (*get_cpu_reg)(int, int, const char *, int, void *);
ulong (*get_task_pgd)(ulong);
void (*dump_irq)(int);
void (*get_stack_frame)(struct bt_info *, ulong *, ulong *);
@@ -6858,6 +6859,7 @@ int vmware_vmss_get_nr_cpus(void);
int vmware_vmss_get_cr3_cr4_idtr(int, ulong *, ulong *, ulong *);
int vmware_vmss_phys_base(ulong *phys_base);
int vmware_vmss_set_phys_base(ulong);
+int vmware_vmss_get_cpu_reg(int, int, const char *, int, void *);
/*
* vmware_guestdump.c
@@ -7282,4 +7284,53 @@ extern int have_full_symbols(void);
#define XEN_HYPERVISOR_ARCH
#endif
+/*
+ * Register numbers must be in sync with gdb/features/i386/64bit-core.c
+ * to make crash_target->fetch_registers() ---> machdep->get_cpu_reg()
+ * working properly.
+ */
+enum x86_64_regnum {
+ RAX_REGNUM,
+ RBX_REGNUM,
+ RCX_REGNUM,
+ RDX_REGNUM,
+ RSI_REGNUM,
+ RDI_REGNUM,
+ RBP_REGNUM,
+ RSP_REGNUM,
+ R8_REGNUM,
+ R9_REGNUM,
+ R10_REGNUM,
+ R11_REGNUM,
+ R12_REGNUM,
+ R13_REGNUM,
+ R14_REGNUM,
+ R15_REGNUM,
+ RIP_REGNUM,
+ EFLAGS_REGNUM,
+ CS_REGNUM,
+ SS_REGNUM,
+ DS_REGNUM,
+ ES_REGNUM,
+ FS_REGNUM,
+ GS_REGNUM,
+ ST0_REGNUM,
+ ST1_REGNUM,
+ ST2_REGNUM,
+ ST3_REGNUM,
+ ST4_REGNUM,
+ ST5_REGNUM,
+ ST6_REGNUM,
+ ST7_REGNUM,
+ FCTRL_REGNUM,
+ FSTAT_REGNUM,
+ FTAG_REGNUM,
+ FISEG_REGNUM,
+ FIOFF_REGNUM,
+ FOSEG_REGNUM,
+ FOOFF_REGNUM,
+ FOP_REGNUM,
+ LAST_REGNUM
+};
+
#endif /* !GDB_COMMON */
diff --git a/gdb_interface.c b/gdb_interface.c
index bcca080eb8b4..ce88d5a7c338 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -698,11 +698,10 @@ static char *prohibited_list[] = {
"run", "r", "break", "b", "tbreak", "hbreak", "thbreak", "rbreak",
"watch", "rwatch", "awatch", "attach", "continue", "c", "fg", "detach",
"finish", "handle", "interrupt", "jump", "kill", "next", "nexti",
- "signal", "step", "s", "stepi", "target", "thread", "until", "delete",
- "clear", "disable", "enable", "condition", "ignore", "frame",
- "select-frame", "f", "up", "down", "catch", "tcatch", "return",
- "file", "exec-file", "core-file", "symbol-file", "load", "si", "ni",
- "shell", "sy",
+ "signal", "step", "s", "stepi", "target", "until", "delete",
+ "clear", "disable", "enable", "condition", "ignore", "frame", "catch",
+ "tcatch", "return", "file", "exec-file", "core-file", "symbol-file",
+ "load", "si", "ni", "shell", "sy",
NULL /* must be last */
};
@@ -1067,6 +1066,8 @@ unsigned long crash_get_kaslr_offset(void)
/* Callbacks for crash_target */
int crash_get_nr_cpus(void);
+int crash_get_cpu_reg (int cpu, int regno, const char *regname,
+ int regsize, void *val);
int crash_get_nr_cpus(void)
{
@@ -1083,3 +1084,11 @@ int crash_get_nr_cpus(void)
return 1;
}
+int crash_get_cpu_reg (int cpu, int regno, const char *regname,
+ int regsize, void *value)
+{
+ if (!machdep->get_cpu_reg)
+ return FALSE;
+ return machdep->get_cpu_reg(cpu, regno, regname, regsize, value);
+}
+
diff --git a/vmware_vmss.c b/vmware_vmss.c
index 52d58e87d1c5..948a83817847 100644
--- a/vmware_vmss.c
+++ b/vmware_vmss.c
@@ -1,7 +1,7 @@
/*
* vmware_vmss.c
*
- * Copyright (c) 2015 VMware, Inc.
+ * Copyright (c) 2015, 2020 VMware, Inc.
* Copyright (c) 2018 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
@@ -16,6 +16,7 @@
*
* Authors: Dyno Hongjun Fu <hfu@vmware.com>
* Sergio Lopez <slp@redhat.com>
+ * Alexey Makhalov <amakhalov@vmware.com>
*/
#include "defs.h"
@@ -891,6 +892,54 @@ vmware_vmss_get_cr3_cr4_idtr(int cpu, ulong *cr3, ulong *cr4, ulong *idtr)
return TRUE;
}
+int
+vmware_vmss_get_cpu_reg(int cpu, int regno, const char *name, int size,
+ void *value)
+{
+ if (cpu >= vmss.num_vcpus)
+ return FALSE;
+
+ /* All supported registers are 8 bytes long. */
+ if (size != 8)
+ return FALSE;
+
+#define CASE(R,r) \
+ case R##_REGNUM: \
+ if (!(vmss.vcpu_regs[cpu] & REGS_PRESENT_##R)) \
+ return FALSE; \
+ memcpy(value, &vmss.regs64[cpu]->r, size); \
+ break
+
+
+ switch (regno) {
+ CASE (RAX, rax);
+ CASE (RBX, rbx);
+ CASE (RCX, rcx);
+ CASE (RDX, rdx);
+ CASE (RSI, rsi);
+ CASE (RDI, rdi);
+ CASE (RBP, rbp);
+ CASE (RSP, rsp);
+ CASE (R8, r8);
+ CASE (R9, r9);
+ CASE (R10, r10);
+ CASE (R11, r11);
+ CASE (R12, r12);
+ CASE (R13, r13);
+ CASE (R14, r14);
+ CASE (R15, r15);
+ CASE (RIP, rip);
+ case EFLAGS_REGNUM:
+ if (!(vmss.vcpu_regs[cpu] & REGS_PRESENT_RFLAGS))
+ return FALSE;
+ memcpy(value, &vmss.regs64[cpu]->rflags, size);
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
int
vmware_vmss_phys_base(ulong *phys_base)
{
diff --git a/x86_64.c b/x86_64.c
index 4f34afac06f9..d0565ba26a0c 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -126,6 +126,7 @@ static int x86_64_get_framesize(struct bt_info *, ulong, ulong);
static void x86_64_framesize_debug(struct bt_info *);
static void x86_64_get_active_set(void);
static int x86_64_get_kvaddr_ranges(struct vaddr_range *);
+static int x86_64_get_cpu_reg(int, int, const char *, int, void *);
static int x86_64_verify_paddr(uint64_t);
static void GART_init(void);
static void x86_64_exception_stacks_init(void);
@@ -194,6 +195,7 @@ x86_64_init(int when)
machdep->machspec->irq_eframe_link = UNINITIALIZED;
machdep->machspec->irq_stack_gap = UNINITIALIZED;
machdep->get_kvaddr_ranges = x86_64_get_kvaddr_ranges;
+ machdep->get_cpu_reg = x86_64_get_cpu_reg;
if (machdep->cmdline_args[0])
parse_cmdline_args();
if ((string = pc->read_vmcoreinfo("relocate"))) {
@@ -884,6 +886,7 @@ x86_64_dump_machdep_table(ulong arg)
fprintf(fp, " is_page_ptr: x86_64_is_page_ptr()\n");
fprintf(fp, " verify_paddr: x86_64_verify_paddr()\n");
fprintf(fp, " get_kvaddr_ranges: x86_64_get_kvaddr_ranges()\n");
+ fprintf(fp, " get_cpu_reg: x86_64_get_cpu_reg()\n");
fprintf(fp, " init_kernel_pgd: x86_64_init_kernel_pgd()\n");
fprintf(fp, "clear_machdep_cache: x86_64_clear_machdep_cache()\n");
fprintf(fp, " xendump_p2m_create: %s\n", PVOPS_XEN() ?
@@ -8934,6 +8937,19 @@ x86_64_get_kvaddr_ranges(struct vaddr_range *vrp)
return cnt;
}
+static int
+x86_64_get_cpu_reg(int cpu, int regno, const char *name,
+ int size, void *value)
+{
+ if (regno >= LAST_REGNUM)
+ return FALSE;
+
+ if (VMSS_DUMPFILE())
+ return vmware_vmss_get_cpu_reg(cpu, regno, name, size, value);
+
+ return FALSE;
+}
+
/*
* Determine the physical memory range reserved for GART.
*/
--
2.30.2

View File

@ -0,0 +1,33 @@
From e832e0eb5bd8d97dfa9f4bd0e22fbfad849c11df Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:34 -0700
Subject: [PATCH 17/27] Allow 'gdb disassemble' command for relocated kernel
As new gdb is able to handle it properly.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
---
gdb_interface.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/gdb_interface.c b/gdb_interface.c
index ce88d5a7c338..d3e1484f8dd9 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -741,13 +741,6 @@ is_restricted_command(char *cmd, ulong flags)
}
}
- if (kt->relocate &&
- STRNEQ("disassemble", cmd) && STRNEQ(cmd, "disas"))
- error(FATAL,
- "the gdb \"disassemble\" command is prohibited because the kernel text\n"
- "%swas relocated%s; use the crash \"dis\" command instead.\n",
- space(strlen(pc->curcmd)+2), kt->flags2 & KASLR ? " by KASLR" : "");
-
return FALSE;
}
--
2.30.2

View File

@ -0,0 +1,45 @@
From 96716862765f73676bfdb2d19fc5872364d21b73 Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:35 -0700
Subject: [PATCH 18/27] vmware backend: honor silence flag
Do not print any boot messages in silence (-s) mode.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
---
vmware_vmss.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/vmware_vmss.c b/vmware_vmss.c
index 948a83817847..f6c5f32ea4c0 100644
--- a/vmware_vmss.c
+++ b/vmware_vmss.c
@@ -444,11 +444,13 @@ vmware_vmss_init(char *filename, FILE *ofp)
if (vmss.memsize == 0) {
char *vmem_filename, *p;
- fprintf(ofp, LOGPRX"Memory dump is not part of this vmss file.\n");
+ if (!(pc->flags & SILENT))
+ fprintf(ofp, LOGPRX"Memory dump is not part of this vmss file.\n");
fclose(fp);
fp = NULL;
- fprintf(ofp, LOGPRX"Try to locate the companion vmem file ...\n");
+ if (!(pc->flags & SILENT))
+ fprintf(ofp, LOGPRX"Try to locate the companion vmem file ...\n");
/* check the companion vmem file */
vmem_filename = strdup(filename);
p = vmem_filename + strlen(vmem_filename) - 4;
@@ -471,7 +473,8 @@ vmware_vmss_init(char *filename, FILE *ofp)
vmss.separate_vmem = TRUE;
vmss.filename = filename;
- fprintf(ofp, LOGPRX"vmem file: %s\n\n", vmem_filename);
+ if (!(pc->flags & SILENT))
+ fprintf(ofp, LOGPRX"vmem file: %s\n\n", vmem_filename);
free(vmem_filename);
}
--
2.30.2

View File

@ -0,0 +1,31 @@
From 6c5f0c6ff5d158f2ef4fa997a052b0643d0c25ee Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Fri, 19 Mar 2021 21:07:36 -0700
Subject: [PATCH 19/27] vmware_guestdump: add debugging of the init function
Dump memory and registers state after parsing.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
---
vmware_guestdump.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/vmware_guestdump.c b/vmware_guestdump.c
index 62da0a77a227..cf818e588a60 100644
--- a/vmware_guestdump.c
+++ b/vmware_guestdump.c
@@ -267,6 +267,11 @@ vmware_guestdump_init(char *filename, FILE *ofp)
fseek(vmss.dfp, 0L, SEEK_SET);
fprintf(ofp, LOGPRX"vmem file: %s\n\n", vmem_filename);
+ if (CRASHDEBUG(1)) {
+ vmware_guestdump_memory_dump(ofp);
+ dump_registers_for_vmss_dump();
+ }
+
exit:
if (fp)
fclose(fp);
--
2.30.2

View File

@ -0,0 +1,65 @@
From 8d6f677e54a2474b3da19402e29278b62603d71d Mon Sep 17 00:00:00 2001
From: Alexey Makhalov <amakhalov@vmware.com>
Date: Thu, 8 Jul 2021 16:14:02 -0700
Subject: [PATCH 20/27] Do not adjust addr by relocate offset(KASLR)
GBD symbol resolution already considers relocation (KASLR) offset.
So, there is no needs to adjust the function address before calling
GDB.
It fixes file name and line number output for 'dis -l' and 'sys -c'
commands.
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Signed-off-by: Tao Liu <ltao@redhat.com>
---
gdb_interface.c | 3 +--
kernel.c | 3 +--
symbols.c | 3 +--
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/gdb_interface.c b/gdb_interface.c
index d3e1484f8dd9..b098ed823d55 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -1013,8 +1013,7 @@ gdb_set_crash_scope(ulong vaddr, char *arg)
return FALSE;
}
}
- } else if (kt->flags2 & KASLR)
- vaddr -= (kt->relocate * -1);
+ }
}
req->command = GNU_SET_CRASH_BLOCK;
diff --git a/kernel.c b/kernel.c
index 6b586dbb05c1..6a812ac7b1bc 100644
--- a/kernel.c
+++ b/kernel.c
@@ -1484,8 +1484,7 @@ list_source_code(struct gnu_request *req, int count_entered)
if (!(lm->mod_flags & MOD_LOAD_SYMS))
error(FATAL, "%s: module source code is not available\n", lm->mod_name);
get_line_number(req->addr, buf1, FALSE);
- } else if (kt->flags2 & KASLR)
- req->addr -= (kt->relocate * -1);
+ }
sprintf(buf1, "list *0x%lx", req->addr);
open_tmpfile();
diff --git a/symbols.c b/symbols.c
index 338af2ce5038..5d3c53a30abc 100644
--- a/symbols.c
+++ b/symbols.c
@@ -4296,8 +4296,7 @@ get_line_number(ulong addr, char *buf, int reserved)
if (module_symbol(addr, NULL, &lm, NULL, 0)) {
if (!(lm->mod_flags & MOD_LOAD_SYMS))
return(buf);
- } else if (kt->flags2 & KASLR)
- addr -= (kt->relocate * -1);
+ }
if ((lnh = machdep->line_number_hooks)) {
name = closest_symbol(addr);
--
2.30.2

View File

@ -0,0 +1,44 @@
From fce91bec5bef534e52f3261cc289a21a2cdb5fe3 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Sun, 11 Jul 2021 22:30:22 +0800
Subject: [PATCH 21/27] Fix the failure of reporting vmcore and vmlinux do not
match for kernels(<2.6.11)
There is a regression issue for kernels(<2.6.11) as below:
$ crash 2.6.9-68.9/vmcore 2.6.9-68.9/vmlinux.gz
...
GNU gdb (GDB) 10.2
...
crash: /var/tmp/vmlinux.gz_GLsAvX and 2.6.9-68.9/vmcore do not match!
The reason is that it needs to read out the address of linux banner with
readmem() first, and then the read_string() will be able to read the data
from linux banner. So, for the kernels(<2.6.11) case, lets still invoke
get_symbol_data() to accomplish this. See the changes:
[1] https://elixir.bootlin.com/linux/v2.6.10/source/init/version.c#L38
[2] https://elixir.bootlin.com/linux/v2.6.11/source/init/version.c#L38
Signed-off-by: Tao Liu <ltao@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
kernel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel.c b/kernel.c
index 6a812ac7b1bc..a559f937980e 100644
--- a/kernel.c
+++ b/kernel.c
@@ -1052,7 +1052,8 @@ verify_version(void)
if (!(sp = symbol_search("linux_banner")))
error(FATAL, "linux_banner symbol does not exist?\n");
- else if ((sp->type == 'R') || (sp->type == 'r') || (sp->type == 'D') ||
+ else if ((sp->type == 'R') || (sp->type == 'r') ||
+ (THIS_KERNEL_VERSION >= LINUX(2,6,11) && sp->type == 'D') ||
(machine_type("ARM") && sp->type == 'T') ||
(machine_type("ARM64")))
linux_banner = symbol_value("linux_banner");
--
2.30.2

View File

@ -0,0 +1,90 @@
From 51f21b0d1c91a4ae02ebf0d8c81460ec8b6c1283 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Thu, 15 Jul 2021 17:34:29 +0800
Subject: [PATCH 22/27] x86_64_irq_eframe_link_init: Fix wrong instruction
searching range calculation
In function x86_64_irq_eframe_link_init, instruction "push xxx" is searched in
addresses range from "common_interrupt" to the next nearby symbol, in order to
calculate the value of irq_eframe_link. The searching distance is given by
max_instructions, which is calculated by end ranging address minus start ranging
address. Then crash asks gdb to disassemble max_instructions quantity of instructions.
Taking max_instructions as the quantity of disassemble instructions is inappropriate,
because most x86_64 instructions have a length longer than 1, as a consequence, much
more than the actual needed instructions get disassembled.
In gdb-7.6 crash, the extra instructions are skipped by "if (!strstr(buf, sp->name))",
which breaks if one instruction doesn't belongs to a symbol:
0xffffffff8005d5b4 <common_interrupt+0>: cld
0xffffffff8005d5b5 <common_interrupt+1>: sub $0x48,%rsp
...
0xffffffff8005d61e <common_interrupt+106>: leaveq
0xffffffff8005d61f <exit_intr>: mov %gs:0x10,%rcx <--- searching stops here
...
In gdb-10.2 crash, "exit_intr" doesn't show, however it really exist. As a result,
searching for "push xxx" will go to a wrong place.
0xffffffff8005d5b4 <common_interrupt+0>: cld
0xffffffff8005d5b5 <common_interrupt+1>: sub $0x48,%rsp
...
0xffffffff8005d61e <common_interrupt+106>: leave
0xffffffff8005d61f <common_interrupt+107>: mov %gs:0x10,%rcx <--- searching continues
...
(gdb) p exit_intr
$1 = {<text variable, no debug info>} 0xffffffff8005d61f <common_interrupt+107>
(gdb) info symbol exit_intr
common_interrupt + 107 in section .text
The previous way to determine start and end searching range is not stable, otherwise we may
encounter regression that cmd "bt" prints wrong IRQ stack. This patch fix the bug by removing
max_instructions calculation, and directly ask gdb to disassemble addresses range from
"common_interrupt" to the next nearby symbol.
Signed-off-by: Tao Liu <ltao@redhat.com>
---
x86_64.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/x86_64.c b/x86_64.c
index d0565ba26a0c..552d6194930b 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -6472,7 +6472,6 @@ x86_64_irq_eframe_link_init(void)
char buf[BUFSIZE];
char link_register[BUFSIZE];
char *arglist[MAXARGS];
- ulong max_instructions;
if (machdep->machspec->irq_eframe_link == UNINITIALIZED)
machdep->machspec->irq_eframe_link = 0;
@@ -6487,12 +6486,10 @@ x86_64_irq_eframe_link_init(void)
return;
}
- max_instructions = spn->value - sp->value;
-
open_tmpfile();
- sprintf(buf, "x/%ldi 0x%lx",
- max_instructions, sp->value);
+ sprintf(buf, "disassemble 0x%lx, 0x%lx",
+ sp->value, spn->value);
if (!gdb_pass_through(buf, pc->tmpfile, GNU_RETURN_ON_ERROR))
return;
@@ -6501,6 +6498,8 @@ x86_64_irq_eframe_link_init(void)
rewind(pc->tmpfile);
while (fgets(buf, BUFSIZE, pc->tmpfile)) {
+ if (STRNEQ(buf, "Dump of assembler code"))
+ continue;
if (!strstr(buf, sp->name))
break;
if ((c = parse_line(buf, arglist)) < 4)
--
2.30.2

View File

@ -0,0 +1,49 @@
From b8e1f2735b8dd1303aeb2affa309a2a409a82d38 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Mon, 26 Jul 2021 09:58:54 +0800
Subject: [PATCH 23/27] Add kernel version dependent check for getting length
of log_end
For kernels(>=2.4.9.11 [1] && <3.5 [2]), log_end was involved in the kernel sources.
For kernels(>=2.6.25 [3]), log_end was defined as:
static unsigned log_end;
For kernels(<2.6.25), log_end was defined as:
static unsigned long log_end;
Previously, the length of log_end is determined by get_symbol_length, but it can
be a regression when the returned length is 0 for some cases and value unchecked:
crash> help -t
...
help: invalid size request: 0 type: "log_end"
To solve the above issue, let's add a kernel version dependent check to get its
value appropriately when the length of the 'log_end' returns a value of zero.
[1]: https://elixir.bootlin.com/linux/2.4.9.11/source/kernel/printk.c#L74
[2]: https://elixir.bootlin.com/linux/v3.5/source/kernel/printk.c
[3]: https://elixir.bootlin.com/linux/v2.6.25/source/kernel/printk.c#L104
Signed-off-by: Tao Liu <ltao@redhat.com>
---
kernel.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel.c b/kernel.c
index a559f937980e..a8be7bb1947f 100644
--- a/kernel.c
+++ b/kernel.c
@@ -5106,6 +5106,10 @@ dump_log(int msg_flags)
if ((len = get_symbol_length("log_end")) == sizeof(int)) {
get_symbol_data("log_end", len, &tmp);
log_end = (ulong)tmp;
+ } else if (len == 0) {
+ THIS_KERNEL_VERSION >= LINUX(2,6,25) ?
+ get_symbol_data("log_end", sizeof(unsigned), &log_end) :
+ get_symbol_data("log_end", sizeof(unsigned long), &log_end);
} else
get_symbol_data("log_end", len, &log_end);
--
2.30.2

View File

@ -0,0 +1,39 @@
From 5c2d8d2d9da6423eec076fd51049d7b4677b61c6 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
Date: Tue, 17 Aug 2021 16:21:43 +0800
Subject: [PATCH 24/27] Set gdb max-value-size to be unlimited
gdb-10.2 uses max-value-size as the maximum size in bytes that the contents
of a object may allocate. The default value of max-value-size is 64K. However,
it could be not enough for allocating an object which requires larger space, and
failed at the startup of crash.
In gdb-7.6, there is no max-value-size check and works fine. So in this patch,
let's just set max-value-size to be unlimited.
Signed-off-by: Tao Liu <ltao@redhat.com>
---
gdb_interface.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/gdb_interface.c b/gdb_interface.c
index b098ed823d55..2fe9ccde83a1 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -300,6 +300,13 @@ retry:
sprintf(req->buf, "set width 0");
gdb_interface(req);
+#ifdef GDB_10_2
+ req->command = GNU_PASS_THROUGH;
+ req->name = NULL, req->flags = 0;
+ sprintf(req->buf, "set max-value-size unlimited");
+ gdb_interface(req);
+#endif
+
#if 0
/*
* Patch gdb's symbol values with the correct values from either
--
2.30.2

View File

@ -0,0 +1,55 @@
From c1e256249426dd59ceea99038451a39e98a26790 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Thu, 19 Aug 2021 10:52:58 +0900
Subject: [PATCH 25/27] Fix tab completion issues
1. The maximum number of tab completion candidates is limited to 200
by default. Set it unlimited.
2. The output of tab completion is not wrapped with the screen width.
Get and use it when tab completion is invoked.
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
gdb-10.2.patch | 11 +++++++++++
gdb_interface.c | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/gdb-10.2.patch b/gdb-10.2.patch
index 4f8d418b17ed..1332b6638028 100644
--- a/gdb-10.2.patch
+++ b/gdb-10.2.patch
@@ -1580,3 +1580,14 @@
_rl_tracefp = 0;
return r;
}
+--- gdb-10.2/gdb/completer.c.orig
++++ gdb-10.2/gdb/completer.c
+@@ -2949,6 +2949,8 @@
+
+ /* How many items of MAX length can we fit in the screen window? */
+ cols = gdb_complete_get_screenwidth (displayer);
++ rl_reset_screen_size();
++ rl_get_screen_size(NULL, &cols);
+ max += 2;
+ limit = cols / max;
+ if (limit != 1 && (limit * max == cols))
diff --git a/gdb_interface.c b/gdb_interface.c
index 2fe9ccde83a1..ff45cdcd39ae 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -305,6 +305,11 @@ retry:
req->name = NULL, req->flags = 0;
sprintf(req->buf, "set max-value-size unlimited");
gdb_interface(req);
+
+ req->command = GNU_PASS_THROUGH;
+ req->name = NULL, req->flags = 0;
+ sprintf(req->buf, "set max-completions unlimited");
+ gdb_interface(req);
#endif
#if 0
--
2.30.2

View File

@ -0,0 +1,402 @@
From 05a3a328fcd8920e49926b6d1c9c81ce0b6acbca Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Thu, 9 Sep 2021 15:23:27 +0900
Subject: [PATCH 26/27] Remove text value cache code
The text value cache was implemented for analysis of remote dumpfiles
using the deprecated "crash daemon" running on the remote host. On
updating GDB to 10.2, a regression occurred when we tried to fix a
"help -x" command problem, and there was no performance degradation
even without the text cache, so let's drop this functionality.
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
alpha.c | 8 +-
cmdline.c | 1 -
defs.h | 4 -
gdb_interface.c | 14 ----
help.c | 8 +-
kernel.c | 1 -
symbols.c | 196 ------------------------------------------------
x86.c | 7 --
8 files changed, 3 insertions(+), 236 deletions(-)
diff --git a/alpha.c b/alpha.c
index fa2d5f5935c9..73497120b4bf 100644
--- a/alpha.c
+++ b/alpha.c
@@ -776,12 +776,8 @@ alpha_frame_offset(struct gnu_request *req, ulong alt_pc)
* Don't go any farther than "stq ra,0(sp)" (0xb75e0000)
*/
while (ival != 0xb75e0000) {
- if (!text_value_cache((ulong)ip, 0, &ival)) {
- readmem((ulong)ip, KVADDR, &ival,
- sizeof(uint), "uncached text value",
- FAULT_ON_ERROR);
- text_value_cache((ulong)ip, ival, NULL);
- }
+ readmem((ulong)ip, KVADDR, &ival, sizeof(uint),
+ "text value", FAULT_ON_ERROR);
if ((ival & 0xffe01fff) == 0x43c0153e) {
value = (ival & 0x1fe000) >> 13;
diff --git a/cmdline.c b/cmdline.c
index 796f7c58f243..ded6551c2597 100644
--- a/cmdline.c
+++ b/cmdline.c
@@ -1235,7 +1235,6 @@ restore_sanity(void)
if (CRASHDEBUG(5)) {
dump_filesys_table(0);
dump_vma_cache(0);
- dump_text_value_cache(0);
}
if (REMOTE())
diff --git a/defs.h b/defs.h
index b34c60e9a795..cbd45e52f9da 100644
--- a/defs.h
+++ b/defs.h
@@ -5327,10 +5327,6 @@ char *load_module_filter(char *, int);
long datatype_info(char *, char *, struct datatype_member *);
int get_symbol_type(char *, char *, struct gnu_request *);
int get_symbol_length(char *);
-int text_value_cache(ulong, uint32_t, uint32_t *);
-int text_value_cache_byte(ulong, unsigned char *);
-void dump_text_value_cache(int);
-void clear_text_value_cache(void);
void dump_numargs_cache(void);
int patch_kernel_symbol(struct gnu_request *);
struct syment *generic_machdep_value_to_symbol(ulong, ulong *);
diff --git a/gdb_interface.c b/gdb_interface.c
index ff45cdcd39ae..3a7fcc9e3ade 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -828,7 +828,6 @@ int
gdb_readmem_callback(ulong addr, void *buf, int len, int write)
{
char locbuf[SIZEOF_32BIT], *p1;
- uint32_t *p2;
int memtype;
ulong readflags;
@@ -885,19 +884,12 @@ gdb_readmem_callback(ulong addr, void *buf, int len, int write)
}
p1 = (char *)buf;
- if ((memtype == KVADDR) &&
- text_value_cache_byte(addr, (unsigned char *)p1))
- return TRUE;
if (!readmem(addr, memtype, locbuf, SIZEOF_32BIT,
"gdb_readmem_callback", readflags))
return FALSE;
*p1 = locbuf[0];
- if (memtype == KVADDR) {
- p2 = (uint32_t *)locbuf;
- text_value_cache(addr, *p2, 0);
- }
return TRUE;
case SIZEOF_32BIT:
@@ -907,16 +899,10 @@ gdb_readmem_callback(ulong addr, void *buf, int len, int write)
return TRUE;
}
- if ((memtype == KVADDR) && text_value_cache(addr, 0, buf))
- return TRUE;
-
if (!readmem(addr, memtype, buf, SIZEOF_32BIT,
"gdb_readmem callback", readflags))
return FALSE;
- if (memtype == KVADDR)
- text_value_cache(addr,
- (uint32_t)*((uint32_t *)buf), NULL);
return TRUE;
}
diff --git a/help.c b/help.c
index e67fde0018ab..c19b69b8b20c 100644
--- a/help.c
+++ b/help.c
@@ -535,7 +535,7 @@ cmd_help(void)
oflag = 0;
while ((c = getopt(argcnt, args,
- "efNDdmM:ngcaBbHhkKsvVoptTzLxOr")) != EOF) {
+ "efNDdmM:ngcaBbHhkKsvVoptTzLOr")) != EOF) {
switch(c)
{
case 'e':
@@ -551,10 +551,6 @@ cmd_help(void)
dumpfile_memory(DUMPFILE_MEM_DUMP);
return;
- case 'x':
- dump_text_value_cache(VERBOSE);
- return;
-
case 'd':
dump_dev_table();
return;
@@ -666,7 +662,6 @@ cmd_help(void)
fprintf(fp, " -T - task_table plus context_array\n");
fprintf(fp, " -v - vm_table\n");
fprintf(fp, " -V - vm_table (verbose)\n");
- fprintf(fp, " -x - text cache\n");
fprintf(fp, " -z - help options\n");
return;
@@ -1026,7 +1021,6 @@ char *help_help[] = {
" -T - task_table plus context_array",
" -v - vm_table",
" -V - vm_table (verbose)",
-" -x - text cache",
" -z - help options",
NULL
};
diff --git a/kernel.c b/kernel.c
index a8be7bb1947f..3ead4bbb172e 100644
--- a/kernel.c
+++ b/kernel.c
@@ -4661,7 +4661,6 @@ reinit_modules(void)
st->ext_module_symtable = NULL;
st->load_modules = NULL;
kt->mods_installed = 0;
- clear_text_value_cache();
module_init();
}
diff --git a/symbols.c b/symbols.c
index 5d3c53a30abc..69dccdb09d5f 100644
--- a/symbols.c
+++ b/symbols.c
@@ -12824,202 +12824,6 @@ gnu_qsort(bfd *bfd,
qsort(minisyms, symcount, size, numeric_forward);
}
-/*
- * Keep a stash of commonly-accessed text locations checked by the
- * back_trace code. The saved values unsigned 32-bit values.
- * The same routine is used to store and query, based upon whether
- * the passed-in value and valptr args are non-zero.
- */
-#define TEXT_CACHE (50)
-#define MAX_TEXT_CACHE (TEXT_CACHE*4)
-
-struct text_cache_entry {
- ulong vaddr;
- uint32_t value;
-};
-
-static struct text_cache {
- int index;
- int entries;
- ulong hits;
- ulong refs;
- struct text_cache_entry *cache;
-} text_cache = { 0 };
-
-/*
- * Cache the contents of 32-bit text addresses. If "value" is set, the purpose
- * is to cache it. If "valptr" is set, a query is being made for the text
- * address.
- */
-int
-text_value_cache(ulong vaddr, uint32_t value, uint32_t *valptr)
-{
- int i;
- struct text_cache *tc;
-
- if (!is_kernel_text(vaddr))
- return FALSE;
-
- tc = &text_cache;
-
- if (!tc->cache) {
- if (!(tc->cache = (struct text_cache_entry *)
- malloc(sizeof(struct text_cache_entry) * TEXT_CACHE)))
- return FALSE;
- BZERO(tc->cache, sizeof(struct text_cache_entry) * TEXT_CACHE);
- tc->index = 0;
- tc->entries = TEXT_CACHE;
- }
-
- if (value) {
- for (i = 0; i < tc->entries; i++) {
- if (tc->cache[i].vaddr == vaddr)
- return TRUE;
- }
-
- i = tc->index;
- tc->cache[i].vaddr = vaddr;
- tc->cache[i].value = value;
- tc->index++;
- if (tc->index == MAX_TEXT_CACHE) {
- tc->index = 0;
- } else if (tc->index == tc->entries) {
- struct text_cache_entry *old_cache;
-
- old_cache = tc->cache;
- if ((tc->cache = (struct text_cache_entry *)
- realloc(old_cache, sizeof(struct text_cache_entry) *
- (TEXT_CACHE+tc->entries)))) {
- BZERO(&tc->cache[tc->index],
- sizeof(struct text_cache_entry) *
- TEXT_CACHE);
- tc->entries += TEXT_CACHE;
- } else {
- tc->cache = old_cache;
- tc->index = 0;
- }
- }
- return TRUE;
- }
-
- if (valptr) {
- tc->refs++;
-
- for (i = 0; i < tc->entries; i++) {
- if (!tc->cache[i].vaddr)
- return FALSE;
-
- if (tc->cache[i].vaddr == vaddr) {
- *valptr = tc->cache[i].value;
- tc->hits++;
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-/*
- * The gdb disassembler reads text memory byte-by-byte, so this routine
- * acts as a front-end to the 32-bit (4-byte) text storage.
- */
-
-int
-text_value_cache_byte(ulong vaddr, unsigned char *valptr)
-{
- int i;
- int shift;
- struct text_cache *tc;
- ulong valtmp;
-
- if (!is_kernel_text(vaddr))
- return FALSE;
-
- tc = &text_cache;
-
- tc->refs++;
-
- for (i = 0; i < tc->entries; i++) {
- if (!tc->cache[i].vaddr)
- return FALSE;
-
- if ((vaddr >= tc->cache[i].vaddr) &&
- (vaddr < (tc->cache[i].vaddr+SIZEOF_32BIT))) {
- valtmp = tc->cache[i].value;
- shift = (vaddr - tc->cache[i].vaddr) * 8;
- valtmp >>= shift;
- *valptr = valtmp & 0xff;
- tc->hits++;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void
-dump_text_value_cache(int verbose)
-{
- int i;
- struct syment *sp;
- ulong offset;
- struct text_cache *tc;
-
- tc = &text_cache;
-
- if (!verbose) {
- if (!tc->refs || !tc->cache)
- return;
-
- fprintf(stderr, " text hit rate: %2ld%% (%ld of %ld)\n",
- (tc->hits * 100)/tc->refs,
- (ulong)tc->hits, (ulong)tc->refs);
- return;
- }
-
- for (i = 0; tc->cache && (i < tc->entries); i++) {
- if (!tc->cache[i].vaddr)
- break;
- fprintf(fp, "[%2d]: %lx %08x ", i, tc->cache[i].vaddr,
- tc->cache[i].value);
- if ((sp = value_search(tc->cache[i].vaddr, &offset))) {
- fprintf(fp, "(%s+", sp->name);
- switch (pc->output_radix)
- {
- case 10:
- fprintf(fp, "%ld)", offset);
- break;
- case 16:
- fprintf(fp, "%lx)", offset);
- break;
- }
- }
- fprintf(fp, "\n");
- }
-
- fprintf(fp,
- "text_cache entries: %d index: %d hit rate: %ld%% (%ld of %ld)\n",
- tc->entries, tc->index,
- (tc->hits * 100)/(tc->refs ? tc->refs : 1),
- tc->hits, tc->refs);
-
-}
-
-void
-clear_text_value_cache(void)
-{
- int i;
- struct text_cache *tc;
-
- tc = &text_cache;
- tc->index = 0;
-
- for (i = 0; tc->cache && (i < tc->entries); i++) {
- tc->cache[i].vaddr = 0;
- tc->cache[i].value = 0;
- }
-}
-
/*
* If a System.map file or a debug kernel was specified, the name hash
* has been filled -- so sync up gdb's notion of symbol values with
diff --git a/x86.c b/x86.c
index a174bbc7737c..b36f44c54819 100644
--- a/x86.c
+++ b/x86.c
@@ -474,17 +474,10 @@ db_get_value(addr, size, is_signed, bt)
else
GET_STACK_DATA(addr, data, size);
} else {
- if ((size == sizeof(int)) &&
- text_value_cache(addr, 0, (uint32_t *)&value))
- return value;
-
if (!readmem(addr, KVADDR, &value, size, "db_get_value",
RETURN_ON_ERROR))
error(FATAL, "db_get_value: read error: address: %lx\n",
addr);
-
- if (size == sizeof(int))
- text_value_cache(addr, value, NULL);
}
#endif
--
2.30.2

View File

@ -0,0 +1,25 @@
From f7e3b2d9b753793e230a5242974a111cdf139e49 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Thu, 30 Sep 2021 11:04:31 +0900
Subject: [PATCH 27/27] .gitignore: add gdb-10.2 directory
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index b39832fa71df..f391c5d340f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ crash.spec
*.rpm
gdb.files
gdb-7.6/
+gdb-10.2/
extensions/defs.h
extensions/*.so
extensions/eppic
--
2.30.2

View File

@ -4,19 +4,19 @@
Summary: Kernel analysis utility for live systems, netdump, diskdump, kdump, LKCD or mcore dumpfiles
Name: crash
Version: 7.3.0
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv3
Source0: https://github.com/crash-utility/crash/archive/crash-%{version}.tar.gz
Source1: http://ftp.gnu.org/gnu/gdb/gdb-7.6.tar.gz
Source1: http://ftp.gnu.org/gnu/gdb/gdb-10.2.tar.gz
URL: https://crash-utility.github.io
ExclusiveOS: Linux
ExclusiveArch: %{ix86} ia64 x86_64 ppc ppc64 s390 s390x %{arm} aarch64 ppc64le
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel bison wget patch
BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel bison wget patch texinfo libzstd-devel
BuildRequires: gcc gcc-c++
BuildRequires: make
Requires: binutils
Provides: bundled(libiberty)
Provides: bundled(gdb) = 7.6
Provides: bundled(gdb) = 10.2
Patch0: lzo_snappy.patch
Patch1: 0001-arm64-Add-lowercase-tcr_el1_t1sz.patch
Patch2: 0002-Fix-for-kmem-s-S-option-on-Linux-5.7-and-later-kerne.patch
@ -34,6 +34,33 @@ Patch13: 0013-arm64-rename-ARM64_PAGE_OFFSET_ACTUAL-to-ARM64_FLIP_.patch
Patch14: 0014-arm64-assign-page_offset-with-VA_BITS-kernel-configu.patch
Patch15: 0015-arm64-use-dedicated-bits-to-record-the-VA-space-layo.patch
Patch16: 0016-arm64-implement-switchable-PTOV-VTOP-for-kernels-5.1.patch
Patch17: 0001-kmem-Add-support-to-S-option-to-specify-a-range-of-C.patch
Patch18: 0002-diskdump-Fail-readmem-early-if-dump-is-incomplete.patch
Patch19: 0003-netdump-Permit-zero_excluded-for-incomplete-ELF-dump.patch
Patch20: 0004-diskdump-Print-total-number-of-dumpable-pages.patch
Patch21: 0005-diskdump-Introduce-read_pd.patch
Patch22: 0006-x86_64-Fix-check-for-__per_cpu_offset-initialization.patch
Patch23: 0007-arm64-Get-CPU-registers-from-ELF-notes-even-without-.patch
Patch24: 0008-.gitignore-Add-cscope-ctags-compile_commands.json.patch
Patch25: 0009-ppc64-Add-MMU-type-info-in-machdep-command.patch
Patch26: 0010-mod-fix-module-object-file-lookup.patch
Patch27: 0011-diskdump-Add-support-for-reading-dumpfiles-compresse.patch
Patch28: 0012-Update-to-gdb-10.2.patch
Patch29: 0013-crash_get_nr_cpus-get-nr_cpus-from-the-dumps.patch
Patch30: 0014-whatis-m-fix-duplications-in-the-output.patch
Patch31: 0015-Fix-reduced-output-of-bt-command.patch
Patch32: 0016-crash_taget-fetch_registers-support.patch
Patch33: 0017-Allow-gdb-disassemble-command-for-relocated-kernel.patch
Patch34: 0018-vmware-backend-honor-silence-flag.patch
Patch35: 0019-vmware_guestdump-add-debugging-of-the-init-function.patch
Patch36: 0020-Do-not-adjust-addr-by-relocate-offset-KASLR.patch
Patch37: 0021-Fix-the-failure-of-reporting-vmcore-and-vmlinux-do-n.patch
Patch38: 0022-x86_64_irq_eframe_link_init-Fix-wrong-instruction-se.patch
Patch39: 0023-Add-kernel-version-dependent-check-for-getting-lengt.patch
Patch40: 0024-Set-gdb-max-value-size-to-be-unlimited.patch
Patch41: 0025-Fix-tab-completion-issues.patch
Patch42: 0026-Remove-text-value-cache-code.patch
Patch43: 0027-.gitignore-add-gdb-10.2-directory.patch
%description
The core analysis suite is a self-contained tool that can be used to
@ -70,6 +97,33 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%build
# This package has an internal copy of GDB which has broken configure code for
@ -78,6 +132,8 @@ offered by Mission Critical Linux, or the LKCD kernel patch.
# maintainer.
# Disable LTO
%define _lto_cflags %{nil}
# Disable hardened package
%undefine _hardened_build
cp %{SOURCE1} .
make RPMPKG="%{version}-%{release}" CFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}"
@ -101,6 +157,9 @@ cp -p defs.h %{buildroot}%{_includedir}/crash
%{_includedir}/*
%changelog
* Tue Oct 12 2021 Lianbo Jiang <lijiang@redhat.com> - 7.3.0-4
- Update to gdb-10.2
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 7.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

View File

@ -1,2 +1,2 @@
SHA512 (crash-7.3.0.tar.gz) = bc288821892c3d7ecbf192d9fe6ea9e73216f8074a24d12a00fbcaf967a1faa38ee69c4a5a97aa93bf75426293f5b275f5ab496c154b4e7be265ba0e263b2bc8
SHA512 (gdb-7.6.tar.gz) = 02d9c62fa73bcb79138d14c7fc182443f0ca82d4545b4d260b67d3f0074ed75f899a657814a56727e601032a668b0ddd7b48aabd49215fc012eeea6077bca368
SHA512 (gdb-10.2.tar.gz) = aa89caf47c1c84366020377d47e7c51ddbc48e5b7686f244e38797c8eb88411cf57fcdc37eb669961efb41ceeac4181747f429625fd1acce7712cb9a1fea9c41