[PATCH] CONFIG_SPARSEMEM for s390(x)
by Michael Holzheu
Hi Dave,
When starting crash on s390(x) with CONFIG_SPARSEMEM enabled we get the
following error message:
crash: CONFIG_SPARSEMEM kernels not supported for this architecture
The following patch fixes this problem, but I am not sure, if I set
_MAX_PHYSMEM_BITS to the correct value (I used 31 for s390 and 64 for
s390x). Could you please explain the meaning of _MAX_PHSYSMEM_BITS?
---
diff -Naurp crash-4.0-6.3/defs.h crash-4.0-6.3-config-sparse/defs.h
--- crash-4.0-6.3/defs.h 2008-04-29 19:39:17.000000000 +0200
+++ crash-4.0-6.3-config-sparse/defs.h 2008-08-12 17:03:54.000000000 +0200
@@ -2634,6 +2634,8 @@ struct efi_memory_desc_t {
#define TIF_SIGPENDING (2)
+#define _MAX_PHYSMEM_BITS 31
+
#endif /* S390 */
#ifdef S390X
@@ -2656,6 +2658,8 @@ struct efi_memory_desc_t {
#define TIF_SIGPENDING (2)
+#define _MAX_PHYSMEM_BITS 64
+
#endif /* S390X */
#ifdef PLATFORM
diff -Naurp crash-4.0-6.3/s390.c crash-4.0-6.3-config-sparse/s390.c
--- crash-4.0-6.3/s390.c 2008-04-29 19:39:17.000000000 +0200
+++ crash-4.0-6.3-config-sparse/s390.c 2008-08-12 17:04:03.000000000 +0200
@@ -130,6 +130,7 @@ s390_init(int when)
machdep->dump_irq = s390_dump_irq;
if (!machdep->hz)
machdep->hz = HZ;
+ machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
break;
case POST_INIT:
diff -Naurp crash-4.0-6.3/s390x.c crash-4.0-6.3-config-sparse/s390x.c
--- crash-4.0-6.3/s390x.c 2008-04-29 19:39:16.000000000 +0200
+++ crash-4.0-6.3-config-sparse/s390x.c 2008-08-12 17:04:01.000000000 +0200
@@ -128,6 +128,7 @@ s390x_init(int when)
machdep->dump_irq = s390x_dump_irq;
if (!machdep->hz)
machdep->hz = HZ;
+ machdep->max_physmem_bits = _MAX_PHYSMEM_BITS;
break;
case POST_INIT:
16 years, 2 months
[PATCH] crash: memory.c handling of node_online_map
by Cliff Wickman
This patch enables finding of node_states (instead of node_online_map)
when using a kerntypes file for a namelist.
I tested this against the dump of a 2.6.26 kernel.
Diffed against crash-4.0-7.1
Signed-off-by: Cliff Wickman <cpw(a)sgi.com>
---
memory.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
Index: crash-4.0-7.1/memory.c
===================================================================
--- crash-4.0-7.1.orig/memory.c
+++ crash-4.0-7.1/memory.c
@@ -12850,14 +12850,17 @@ get_nodes_online(void)
!symbol_exists("node_states"))
return 0;
- if (LKCD_KERNTYPES()) {
- if ((len = STRUCT_SIZE("nodemask_t")) < 0)
- error(FATAL, "cannot determine type nodemask_t\n");
- mapaddr = symbol_value("node_online_map");
- } else if (symbol_exists("node_online_map")) {
- len = get_symbol_type("node_online_map", NULL, &req)
- == TYPE_CODE_UNDEF ? sizeof(ulong) : req.length;
- mapaddr = symbol_value("node_online_map");
+ if (symbol_exists("node_online_map")) {
+ if (LKCD_KERNTYPES()) {
+ if ((len = STRUCT_SIZE("nodemask_t")) < 0)
+ error(FATAL,
+ "cannot determine type nodemask_t\n");
+ mapaddr = symbol_value("node_online_map");
+ } else {
+ len = get_symbol_type("node_online_map", NULL, &req)
+ == TYPE_CODE_UNDEF ? sizeof(ulong) : req.length;
+ mapaddr = symbol_value("node_online_map");
+ }
} else if (symbol_exists("node_states")) {
if ((get_symbol_type("node_states", NULL, &req) != TYPE_CODE_ARRAY) ||
!(len = get_array_length("node_states", NULL, 0)) ||
16 years, 2 months
Re: [Crash-utility] [PATCH] Use /usr/bin/nm -D
by Dave Anderson
----- "Dave Anderson" <anderson(a)redhat.com> wrote:
> ----- "Bernhard Walle" <bwalle(a)suse.de> wrote:
>
> > * Dave Anderson [2008-08-25 16:07]:
> > >
> > > I'm not sure what's worse -- not doing the translation at all
> > > or showing potentially bogus entries.
> >
> > *arg*, yes, I didn't check for such static functions. The functions
> > in
> > my test were only global, so everything worked.
> >
> > However, I now modified the patch to check the size (with nm -S),
> and
> > report "unknown" in such cases. So we still have the global symbols
> > right, but no "false positives".
> >
> > Is that okay?
>
> Looks OK -- I'll give it run today, and if no problems arise,
> I'll queue it as is.
>
> Thanks,
> Dave
Tests fine, although the "unknown+offset" output is a bit confusing:
crash> test
test: invalid structure member offset: task_struct_next_run
FILE: test.c LINE: 23 FUNCTION: test_global()
[/tmp/crash] error trace: 80fd683 => 80fd71b => 80fd5d7 => 813e6ec
813e6ec: OFFSET_verify+126
80fd5d7: test_global+51
80fd71b: unknown+145
80fd683: cmd_test+137
test: invalid structure member offset: task_struct_next_run
FILE: test.c LINE: 23 FUNCTION: test_global()
crash>
I'm thinking maybe an "(undetermined)" string would be clearer.
Dave
16 years, 3 months
Re: [Crash-utility] [PATCH] Use /usr/bin/nm -D
by Dave Anderson
----- "Bernhard Walle" <bwalle(a)suse.de> wrote:
> * Dave Anderson [2008-08-25 11:25]:
> >
> > It probably could be made even simpler than that if a
> quick-and-dirty
> > pre-examination of thisfile could be done to determine whether it's
> > stripped or not?
>
> Well, not quick and dirty but with bfd (which we already have in
> place). What do you think about that one?
>
Yeah, I was looking at the bfd->flags, but they are the same, so
if using bfd_canonicalize_symtab() works, that seems OK.
But I think I'll make it quicker and dirtier by changing the
is_bfd_format(filename) function to take a second "stripped"
argument, and overload the function to return the right
thing depending upon whether it's set or not. And I'll
probably forego the use of the nm_call and stripped_binary
variables, and just make the creation of the command string
a simple if-else statement... ;-)
Thanks for finding and testing this. I never noticed this
issue since I only use the debugful version.
Dave
16 years, 3 months
[PATCH] Use /usr/bin/nm -D on stripped binaries
by Bernhard Walle
Use "nm -D" to retrieve also the symbols of crash when having stripped binaries.
Use the presence of the symbol table to determine if the binary has been
stripped or not.
Because we don't have static symbols in stripped binaries, we check the size
of the function (the "nm -S" output) and report "unknown" if the looked address
is outside of the function.
Signed-off-by: Bernhard Walle <bwalle(a)suse.de>
2 files changed, 55 insertions(+), 12 deletions(-)
defs.h | 1
symbols.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++------------
16 years, 3 months
Re: [Crash-utility] [PATCH] Use /usr/bin/nm -D
by Dave Anderson
----- "Bernhard Walle" <bwalle(a)suse.de> wrote:
> * Dave Anderson [2008-08-25 09:27]:
> >
> >
> > Unfortunately on an unstripped version, it drops all ~3000 ' t '
> symbols and
> > only dumps type 'T' symbols. Probably it should run -Bn first, or
> recognize
> > otherwise that it's been stripped, and if it dumps no symbols,
> [re]try it
> > with -DBn?
>
> Ah, ok, I just checked with running crash that the output still
> works,
> but did not compare nm and nm -D.
>
> What about the new patch?
>
Hmmm, seems to be a of a lot of work for something that could be
done in just a few lines? Since the first -Bn attempt with fd 2
redirected to /dev/null returns nothing to fgets(), how about just
recognizing that, rewriting the command string, and continue?
Something like:
- sprintf(buf, "/usr/bin/nm -Bn %s, thisfile);
+ sprintf(buf, "/usr/bin/nm -Bn %s 2> /dev/null", thisfile);
if (!(pipe = popen(buf, "r"))) {
perror("pipe");
break;
}
+ if (!(fgets(buf, 80, pipe)))
+ pclose(pipe);
+ sprintf(buf, "/usr/bin/nm -DBn %s", thisfile);
+ if (!(pipe = popen(buf, "r"))) {
+ perror("pipe");
+ break;
+ }
+ }
last_vaddr = 0;
BZERO(symbol, BUFSIZE);
It probably could be made even simpler than that if a quick-and-dirty
pre-examination of thisfile could be done to determine whether it's
stripped or not?
Dave
16 years, 3 months
[PATCH] Use /usr/bin/nm -D on stripped binaries
by Bernhard Walle
Use "nm -D" to retrieve also the symbols of crash when having stripped binaries.
Use the presence of the symbol table to determine if the binary has been
stripped or not.
Signed-off-by: Bernhard Walle <bwalle(a)suse.de>
2 files changed, 35 insertions(+), 1 deletion(-)
defs.h | 1 +
symbols.c | 35 ++++++++++++++++++++++++++++++++++-
16 years, 3 months
Re: [Crash-utility] [PATCH] Use /usr/bin/nm -D
by Dave Anderson
Unfortunately on an unstripped version, it drops all ~3000 ' t ' symbols and
only dumps type 'T' symbols. Probably it should run -Bn first, or recognize
otherwise that it's been stripped, and if it dumps no symbols, [re]try it
with -DBn?
Dave
----- Original Message -----
From: "Bernhard Walle" <bwalle(a)suse.de>
To: crash-utility(a)redhat.com
Sent: Monday, August 25, 2008 7:56:37 AM GMT -05:00 US/Canada Eastern
Subject: [Crash-utility] [PATCH] Use /usr/bin/nm -D
Use "nm -D" to retrieve also the symbols of crash when compiled without -g
(or stripped after compilation and debuginfo extraction).
Signed-off-by: Bernhard Walle <bwalle(a)suse.de>
diff --git a/symbols.c b/symbols.c
--- a/symbols.c
+++ b/symbols.c
@@ -9077,7 +9077,7 @@
if (!(lookfor = retaddr[i]))
continue;
- sprintf(buf, "/usr/bin/nm -Bn %s", thisfile);
+ sprintf(buf, "/usr/bin/nm -DBn %s", thisfile);
if (!(pipe = popen(buf, "r"))) {
perror("pipe");
break;
16 years, 3 months
[PATCH] Use /usr/bin/nm -D
by Bernhard Walle
Use "nm -D" to retrieve also the symbols of crash when compiled without -g
(or stripped after compilation and debuginfo extraction).
Signed-off-by: Bernhard Walle <bwalle(a)suse.de>
1 file changed, 60 insertions(+), 38 deletions(-)
symbols.c | 98 +++++++++++++++++++++++++++++++++++++------------------------
16 years, 3 months
[PATCH] Use /usr/bin/nm -D
by Bernhard Walle
Use "nm -D" to retrieve also the symbols of crash when compiled without -g
(or stripped after compilation and debuginfo extraction).
Signed-off-by: Bernhard Walle <bwalle(a)suse.de>
1 file changed, 1 insertion(+), 1 deletion(-)
symbols.c | 2 +-
16 years, 3 months