Commit Graph

140 Commits

Author SHA1 Message Date
maxv 6fa9cf7eed Avoid overflows when reading strings. 2020-04-03 19:09:43 +00:00
mrg 91cecf62cf elide recently introduced warnings that trigger in normal cases, eg:
savecore: dump_exists:471: kvm_read newdumpmag: _kvm_kvatop(ffffffff8180030c)
2019-11-06 07:29:08 +00:00
mrg 926d7d66f0 avoid infinite loop in kmem_check(). fixes bug introduced in previous. 2018-12-27 21:25:46 +00:00
mrg d482d53137 put a bunch of the kvm_read + warn on failure code into a macro that
describes more about what failed.  now errors tell you which actual
variable was being requested instead of simply saying "not yours".

tested on amd64 as working.  written for arm64 testing.
2018-11-06 04:07:22 +00:00
kamil 52678ac6a4 Adapt funopen(3) call after switch to new zlib(3)
In the prototype of the gzclose() function of changed from:

  typedef struct gzFile_s *gzFile;    /* semi-opaque gzip file descriptor */

to:

  typedef voidp gzFile;

This caused type mismatch when calling funopen(3) as:
   'int (*)(void *)' != 'int (*)(struct gzFile_s *)'

Cast gzclose to (int (*)(void *)) when used in funopen(3).
2017-01-10 04:42:20 +00:00
mrg 0537635d0c for 64 bit mips platforms where we built userland largely as n32 by
default, build a handful of tools as n64 so they work properly.

unfortunately, they're also static as dynamic n64 has a problem.

of these tools pstat is probably the lowest hanging fruit to convert
to sysctl.  systat would be close were it not for the netstat screen,
which includes netstat itself.

the rest are difficult to perhaps foolish.


the upside is that netstat, pmap and fstat all work properly now.
2016-12-23 10:19:57 +00:00
christos c3e11c3703 - avoid using globals where it is simple.
- simplify: only use stdio for output.
2013-05-13 18:44:11 +00:00
mbalmer 49e3ec350a Consistent use of return. 2012-12-25 09:24:45 +00:00
christos ca11e1e667 factor out rawname() from dump, fsck, savecore. 2012-04-07 16:44:10 +00:00
njoly d0e00679ff Use Lk macro when dealing with URLs. While here update or remove some
dead URL links. Another part of PR/29238.
2012-03-15 22:35:02 +00:00
christos 42d1e41665 print the missing flag if missing argument... 2011-09-13 19:55:28 +00:00
wiz c94449f6a8 Fix typo. 2011-09-13 08:54:11 +00:00
christos 8b1d441333 document that dumpdir is now optional 2011-09-12 21:22:27 +00:00
christos 7249eb3f75 - always print corrupted dump messages instead of silently failing
- don't require /var/crash to be specified, default to it
- determine and print the kernel name
- print all messages to syslog
2011-09-12 21:22:07 +00:00
joerg 693655118a static + __dead 2011-08-29 14:29:21 +00:00
dogcow 9098338f79 Instead of exiting with an obscure error message if -N /kernelname isn't
specified, blithely assume the kernel will consume around 20 megs.
2009-08-18 04:02:39 +00:00
lukem fb63fbd0cc fix sign-compare issues 2009-04-06 12:32:30 +00:00
tls ede5dc65a8 Fix savecore so it uses /dev/ksyms when it can (doesn't override libkvm
default).  Fixes misc/38425.
2009-03-21 19:32:44 +00:00
ad 101a9782a2 Add crash(8), a utility to diagnose kernel crashes. This is basically
ddb running on crash dumps, but with two notable changes:

- Breakpoints, watches, etc are obviously never going to work so they
  are not handled.

- You can pipe output to the shell, e.g. ps | grep foo

Items remaining to be done:

- Port it to architectures other than i386. This isn't difficult, just
  a case of making db_disasm.c/db_trace.c or their equivalent compile
  and work.

- Make more of the "show" commands work, e.g "show uvmexp".
2009-03-07 22:08:07 +00:00
christos 118c87a6fe fix dev_t format. 2008-12-28 20:17:11 +00:00
ad 2df6131a64 Enable the faked ELF kernel by default, now that ksyms output works with
gdb. Makes it possible to do post-mortem debugging on a modular kernel.
2008-12-05 21:41:10 +00:00
ad dc7ae0762f - Add code to produce a fake ELF kernel containing only symbol info. Done
by extracting ksyms state from the dump, so we have symbols for modules
  loaded at the time of the crash. If ksyms extraction fails, this falls
  back to the current behaviour of copying /netbsd.

- Leave it disabled for the moment: (1) we are about to branch (2) most
  tools understand the artificial kernel but gdb has trouble with it for
  some reason.
2008-10-20 10:34:54 +00:00
joerg 281bbad379 Explicitly check that the dump device is not the console, a tty or pty.
While the list is adhoc, the problems reported are always with
/dev/console. Adresses PR 38425 and similiar issues with Xen.
2008-10-09 13:59:50 +00:00
lukem 6543a91fea Remove the \n and tabs from the __COPYRIGHT() strings.
(Tweak some to use a consistent format.)
2008-07-20 01:20:21 +00:00
ad 76f153e120 sync() a couple of times to benefit diagnosis of sloppy kernel code that
crashes during boot to multiuser.
2008-04-20 23:40:31 +00:00
ad 73e694f404 Don't use the block device to read crashdumps, if possible. 2008-01-15 14:26:41 +00:00
pooka 3384f1f26e tyop: _time_seconf -> _time_second 2007-11-12 16:04:55 +00:00
christos 8539ad5cf5 from Anon Ymous: remove (void)&var; 2006-12-18 20:08:48 +00:00
christos 50b568b12d c99 initializers 2006-10-16 02:56:56 +00:00
kardel e386d70092 accept either "time_second" or "time" as kernel timevariable in
order to support common userland in enviroments where
timecounter kernels and non timecounter kernel co-exist
(e.g. xen & i386)
2006-07-09 06:43:16 +00:00
kardel 75418af90c support timecounters (struct time gone, use time_second then) 2006-06-07 20:56:19 +00:00
hubertf f500b89c3d Free some allocated memory in the failure case when trying to
fetch the panic string.

Fixes Coverity CID 1856.
2006-03-17 01:45:51 +00:00
christos 2c6eadc9ce Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
programs that did not compile before.
2005-06-27 01:00:04 +00:00
dsainty 1dfaf4a3ca Rearrange the option formatting to be both prettier and more complete 2004-10-21 10:13:00 +00:00
snj 32eca9407f New sentence, new line; use .Dq instead of ``''. 2004-10-16 05:44:59 +00:00
dsainty 9a582784d5 Bump date for -n description 2004-10-16 04:38:53 +00:00
dsainty d01162a3bc Added -n option, which tests for a present core but doesn't write it
to disk or clear it (does 'nothing').

http://mail-index.netbsd.org/tech-userlevel/2004/10/09/0000.html
2004-10-16 04:29:27 +00:00
dsainty 4b46224291 Added -n option, which tests for a present core but doesn't write it
to disk or clear it (does 'nothing').

http://mail-index.netbsd.org/tech-userlevel/2004/10/09/0000.html
2004-10-16 03:48:15 +00:00
tls e8092c77bc Fix an integer overflow that prevented saving cores from machines with
more than 2GB of RAM.

"dumpsize" in the on-disk core header is in pages, but, unfortunately,
c.size in our kcore format is an unsigned 32-bit int, gross.

We sleaze it, using a 64-bit int internally here and handing it to
libkvm as a *signed* 32-bit int.  Won't always work, but shouldn't be
broken any worse than it is now, and sometimes work better.

We must fix the kcore format and libkvm.
2004-07-14 07:26:12 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
christos 99319b80db Give a 60 day leeway instead of a week when judging if the dumptime is valid.
7 days is too short when you are debugging time problems.
2004-03-30 19:52:02 +00:00
agc 276d62f603 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
2003-08-07 10:04:22 +00:00
itojun f5878476d9 simplify by strlcpy 2003-05-18 02:11:13 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
thorpej 764e56a614 Remove prototype for non-existent function log(). 2002-12-06 02:20:00 +00:00
wiz 09cbac4e7f New sentence, new line. From Robert Elz. 2002-10-03 15:41:44 +00:00
drochner 335fd2d7c2 use humanize_number(3) for progress printout 2002-09-27 18:38:53 +00:00
christos 94d01e0c5d PR/15502: Wolfgang Rupprecht: savecore fails for > 2GB files. 2002-03-19 18:55:03 +00:00
tsutsui 07b8153219 Change type of dumpmag and newdumpmag from int to u_int32_t
since they hold 32bit unsigned magic numbers. (sync with kernels)
2002-03-06 13:13:08 +00:00
wiz 80d1ff493a Sort sections. 2001-11-16 11:21:37 +00:00