Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys make ksyms structures not depend on KDTRACE_HOOKS.
details: https://anonhg.NetBSD.org/src/rev/1035f19f14a5
branches: trunk
changeset: 782735:1035f19f14a5
user: chs <chs%NetBSD.org@localhost>
date: Sun Nov 18 00:06:56 2012 +0000
description:
make ksyms structures not depend on KDTRACE_HOOKS.
always include a CTF section, even though it might be empty.
this fixes savecore's generated kernel symbol table files.
diffstat:
sys/kern/kern_ksyms.c | 29 ++++++++---------------------
sys/sys/ksyms.h | 12 +-----------
2 files changed, 9 insertions(+), 32 deletions(-)
diffs (157 lines):
diff -r 3f61fe396dbb -r 1035f19f14a5 sys/kern/kern_ksyms.c
--- a/sys/kern/kern_ksyms.c Sat Nov 17 23:08:38 2012 +0000
+++ b/sys/kern/kern_ksyms.c Sun Nov 18 00:06:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_ksyms.c,v 1.67 2011/12/05 21:30:48 christos Exp $ */
+/* $NetBSD: kern_ksyms.c,v 1.68 2012/11/18 00:06:57 chs Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.67 2011/12/05 21:30:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.68 2012/11/18 00:06:57 chs Exp $");
#if defined(_KERNEL) && defined(_KERNEL_OPT)
#include "opt_ddb.h"
@@ -299,12 +299,10 @@
tab->sd_maxsym = 0;
tab->sd_usroffset = 0;
tab->sd_gone = false;
-#ifdef KDTRACE_HOOKS
tab->sd_ctfstart = ctfstart;
tab->sd_ctfsize = ctfsize;
tab->sd_nmap = nmap;
tab->sd_nmapsize = nsyms;
-#endif
#ifdef KSYMS_DEBUG
printf("newstart %p sym %p ksyms_symsz %zu str %p strsz %zu send %p\n",
newstart, symstart, symsize, strstart, strsize,
@@ -896,7 +894,6 @@
ksyms_hdr.kh_shdr[SHBSS].sh_addralign = PAGE_SIZE;
ksyms_hdr.kh_shdr[SHBSS].sh_flags = SHF_ALLOC | SHF_EXECINSTR;
-#ifdef KDTRACE_HOOKS
/* Sixth section header; ".SUNW_ctf" */
ksyms_hdr.kh_shdr[SHCTF].sh_name = 32; /* Section 6 offset */
ksyms_hdr.kh_shdr[SHCTF].sh_type = SHT_PROGBITS;
@@ -904,7 +901,6 @@
/* ksyms_hdr.kh_shdr[SHCTF].sh_size = filled in at open */
ksyms_hdr.kh_shdr[SHCTF].sh_link = SYMTAB; /* Corresponding symtab */
ksyms_hdr.kh_shdr[SHCTF].sh_addralign = sizeof(char);
-#endif
/* Set section names */
strlcpy(&ksyms_hdr.kh_strtab[1], ".symtab",
@@ -915,10 +911,8 @@
sizeof(ksyms_hdr.kh_strtab) - 17);
strlcpy(&ksyms_hdr.kh_strtab[27], ".bss",
sizeof(ksyms_hdr.kh_strtab) - 27);
-#ifdef KDTRACE_HOOKS
strlcpy(&ksyms_hdr.kh_strtab[32], ".SUNW_ctf",
sizeof(ksyms_hdr.kh_strtab) - 32);
-#endif
}
static int
@@ -938,11 +932,9 @@
ksyms_hdr.kh_shdr[STRTAB].sh_offset = ksyms_symsz +
ksyms_hdr.kh_shdr[SYMTAB].sh_offset;
ksyms_hdr.kh_shdr[STRTAB].sh_size = ksyms_strsz;
-#ifdef KDTRACE_HOOKS
ksyms_hdr.kh_shdr[SHCTF].sh_offset = ksyms_strsz +
ksyms_hdr.kh_shdr[STRTAB].sh_offset;
ksyms_hdr.kh_shdr[SHCTF].sh_size = ksyms_ctfsz;
-#endif
ksyms_isopen = true;
mutex_exit(&ksyms_lock);
@@ -980,9 +972,6 @@
struct ksyms_symtab *st;
size_t filepos, inpos, off;
int error;
-#ifdef KDTRACE_HOOKS
- struct ksyms_symtab *cst;
-#endif
/*
* First: Copy out the ELF header. XXX Lose if ksymsopen()
@@ -1031,24 +1020,22 @@
filepos += st->sd_strsize;
}
-#ifdef KDTRACE_HOOKS
/*
* Copy out the CTF table.
*/
- cst = TAILQ_FIRST(&ksyms_symtabs);
- if (cst->sd_ctfstart != NULL) {
+ st = TAILQ_FIRST(&ksyms_symtabs);
+ if (st->sd_ctfstart != NULL) {
if (uio->uio_resid == 0)
return 0;
- if (uio->uio_offset <= cst->sd_ctfsize + filepos) {
+ if (uio->uio_offset <= st->sd_ctfsize + filepos) {
inpos = uio->uio_offset - filepos;
- error = uiomove((char *)cst->sd_ctfstart + inpos,
- cst->sd_ctfsize - inpos, uio);
+ error = uiomove((char *)st->sd_ctfstart + inpos,
+ st->sd_ctfsize - inpos, uio);
if (error != 0)
return error;
}
- filepos += cst->sd_ctfsize;
+ filepos += st->sd_ctfsize;
}
-#endif
return 0;
}
diff -r 3f61fe396dbb -r 1035f19f14a5 sys/sys/ksyms.h
--- a/sys/sys/ksyms.h Sat Nov 17 23:08:38 2012 +0000
+++ b/sys/sys/ksyms.h Sun Nov 18 00:06:56 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ksyms.h,v 1.27 2010/03/15 02:28:59 darran Exp $ */
+/* $NetBSD: ksyms.h,v 1.28 2012/11/18 00:06:56 chs Exp $ */
/*
* Copyright (c) 2001, 2003 Anders Magnusson (ragge%ludd.luth.se@localhost).
@@ -32,10 +32,6 @@
#ifdef _KSYMS_PRIVATE
-#if defined(_KERNEL_OPT)
-#include "opt_dtrace.h"
-#endif
-
#define ELFSIZE ARCH_ELFSIZE
#include <sys/exec_elf.h>
#include <sys/queue.h>
@@ -52,12 +48,10 @@
int sd_strsize; /* Size of string table */
int sd_nglob; /* Number of global symbols */
bool sd_gone; /* dead but around for open() */
-#ifdef KDTRACE_HOOKS
void *sd_ctfstart; /* Address of CTF contents */
int sd_ctfsize; /* Size in bytes of CTF contents */
uint32_t *sd_nmap; /* Name map for sorted symbols */
int sd_nmapsize; /* Total span of map */
-#endif
};
/*
@@ -68,12 +62,8 @@
#define STRTAB 2
#define SHSTRTAB 3
#define SHBSS 4
-#ifdef KDTRACE_HOOKS
#define SHCTF 5
#define NSECHDR 6
-#else
-#define NSECHDR 5
-#endif
#define NPRGHDR 1
#define SHSTRSIZ 42
Home |
Main Index |
Thread Index |
Old Index