2005-01-06 01:34:41 +00:00
|
|
|
/*-
|
1993-06-12 14:58:17 +00:00
|
|
|
* Mach Operating System
|
|
|
|
* Copyright (c) 1991,1990 Carnegie Mellon University
|
|
|
|
* All Rights Reserved.
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
|
|
* documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
|
1993-06-12 14:58:17 +00:00
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Carnegie Mellon requests users of this software to return to
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
1995-05-30 08:16:23 +00:00
|
|
|
*
|
1993-06-12 14:58:17 +00:00
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Author: David B. Golub, Carnegie Mellon University
|
|
|
|
* Date: 7/90
|
|
|
|
*/
|
2003-06-10 22:09:23 +00:00
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
2015-07-16 10:46:52 +00:00
|
|
|
#include "opt_kstack_pages.h"
|
|
|
|
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <sys/param.h>
|
2009-08-01 19:26:27 +00:00
|
|
|
#include <sys/pcpu.h>
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#include <sys/smp.h>
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <sys/systm.h>
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
|
|
|
|
#include <net/vnet.h>
|
1995-12-10 19:08:32 +00:00
|
|
|
|
1994-08-13 03:50:34 +00:00
|
|
|
#include <ddb/ddb.h>
|
1993-06-12 14:58:17 +00:00
|
|
|
#include <ddb/db_sym.h>
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#include <ddb/db_variables.h>
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2004-02-24 22:51:42 +00:00
|
|
|
#include <opt_ddb.h>
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Multiple symbol tables
|
|
|
|
*/
|
1994-01-03 07:54:10 +00:00
|
|
|
#ifndef MAXNOSYMTABS
|
1993-06-12 14:58:17 +00:00
|
|
|
#define MAXNOSYMTABS 3 /* mach, ux, emulator */
|
1994-01-03 07:54:10 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1995-11-29 10:25:50 +00:00
|
|
|
static db_symtab_t db_symtabs[MAXNOSYMTABS] = {{0,},};
|
|
|
|
static int db_nsymtab = 0;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
1997-06-30 23:54:50 +00:00
|
|
|
static db_symtab_t *db_last_symtab; /* where last symbol was found */
|
1993-06-12 14:58:17 +00:00
|
|
|
|
2002-03-20 05:14:42 +00:00
|
|
|
static c_db_sym_t db_lookup( const char *symstr);
|
|
|
|
static char *db_qualify(c_db_sym_t sym, char *symtabname);
|
2015-05-21 15:16:18 +00:00
|
|
|
static bool db_symbol_is_ambiguous(c_db_sym_t sym);
|
|
|
|
static bool db_line_at_pc(c_db_sym_t, char **, int *, db_expr_t);
|
1993-06-12 14:58:17 +00:00
|
|
|
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
static int db_cpu = -1;
|
|
|
|
|
|
|
|
#ifdef VIMAGE
|
|
|
|
static void *db_vnet = NULL;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Validate the CPU number used to interpret per-CPU variables so we can
|
|
|
|
* avoid later confusion if an invalid CPU is requested.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
db_var_db_cpu(struct db_variable *vp, db_expr_t *valuep, int op)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case DB_VAR_GET:
|
|
|
|
*valuep = db_cpu;
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
case DB_VAR_SET:
|
|
|
|
if (*(int *)valuep < -1 && *(int *)valuep > mp_maxid) {
|
|
|
|
db_printf("Invalid value: %d", *(int*)valuep);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
db_cpu = *(int *)valuep;
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
default:
|
|
|
|
db_printf("db_var_db_cpu: unknown operation\n");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read-only variable reporting the current CPU, which is what we use when
|
|
|
|
* db_cpu is set to -1.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
db_var_curcpu(struct db_variable *vp, db_expr_t *valuep, int op)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case DB_VAR_GET:
|
|
|
|
*valuep = curcpu;
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
case DB_VAR_SET:
|
|
|
|
db_printf("Read-only variable.\n");
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
default:
|
|
|
|
db_printf("db_var_curcpu: unknown operation\n");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef VIMAGE
|
|
|
|
/*
|
|
|
|
* Validate the virtual network pointer used to interpret per-vnet global
|
|
|
|
* variable expansion. Right now we don't do much here, really we should
|
|
|
|
* walk the global vnet list to check it's an OK pointer.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
db_var_db_vnet(struct db_variable *vp, db_expr_t *valuep, int op)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case DB_VAR_GET:
|
|
|
|
*valuep = (db_expr_t)db_vnet;
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
case DB_VAR_SET:
|
|
|
|
db_vnet = *(void **)valuep;
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
default:
|
|
|
|
db_printf("db_var_db_vnet: unknown operation\n");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read-only variable reporting the current vnet, which is what we use when
|
|
|
|
* db_vnet is set to NULL.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
db_var_curvnet(struct db_variable *vp, db_expr_t *valuep, int op)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (op) {
|
|
|
|
case DB_VAR_GET:
|
|
|
|
*valuep = (db_expr_t)curvnet;
|
|
|
|
return (1);
|
|
|
|
|
|
|
|
case DB_VAR_SET:
|
|
|
|
db_printf("Read-only variable.\n");
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
default:
|
2015-06-17 10:20:59 +00:00
|
|
|
db_printf("db_var_curvnet: unknown operation\n");
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Add symbol table, with given name, to list of symbol tables.
|
|
|
|
*/
|
|
|
|
void
|
2014-10-12 18:01:52 +00:00
|
|
|
db_add_symbol_table(char *start, char *end, char *name, char *ref)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
if (db_nsymtab >= MAXNOSYMTABS) {
|
|
|
|
printf ("No slots left for %s symbol table", name);
|
|
|
|
panic ("db_sym.c: db_add_symbol_table");
|
|
|
|
}
|
|
|
|
|
|
|
|
db_symtabs[db_nsymtab].start = start;
|
|
|
|
db_symtabs[db_nsymtab].end = end;
|
|
|
|
db_symtabs[db_nsymtab].name = name;
|
|
|
|
db_symtabs[db_nsymtab].private = ref;
|
|
|
|
db_nsymtab++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* db_qualify("vm_map", "ux") returns "unix:vm_map".
|
|
|
|
*
|
|
|
|
* Note: return value points to static data whose content is
|
|
|
|
* overwritten by each call... but in practice this seems okay.
|
|
|
|
*/
|
|
|
|
static char *
|
2014-10-12 18:01:52 +00:00
|
|
|
db_qualify(c_db_sym_t sym, char *symtabname)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1999-01-27 19:00:49 +00:00
|
|
|
const char *symname;
|
1993-06-12 14:58:17 +00:00
|
|
|
static char tmp[256];
|
|
|
|
|
|
|
|
db_symbol_values(sym, &symname, 0);
|
1998-12-04 22:54:57 +00:00
|
|
|
snprintf(tmp, sizeof(tmp), "%s:%s", symtabname, symname);
|
1993-06-12 14:58:17 +00:00
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-21 15:16:18 +00:00
|
|
|
bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_eqname(const char *src, const char *dst, int c)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
if (!strcmp(src, dst))
|
2015-05-18 22:27:46 +00:00
|
|
|
return (true);
|
1993-06-12 14:58:17 +00:00
|
|
|
if (src[0] == c)
|
|
|
|
return (!strcmp(src+1,dst));
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
2015-05-21 15:16:18 +00:00
|
|
|
bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_value_of_name(const char *name, db_expr_t *valuep)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1999-01-27 23:45:44 +00:00
|
|
|
c_db_sym_t sym;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
sym = db_lookup(name);
|
1999-01-27 23:45:44 +00:00
|
|
|
if (sym == C_DB_SYM_NULL)
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
1993-06-12 14:58:17 +00:00
|
|
|
db_symbol_values(sym, &name, valuep);
|
2015-05-18 22:27:46 +00:00
|
|
|
return (true);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
2015-05-21 15:16:18 +00:00
|
|
|
bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_value_of_name_pcpu(const char *name, db_expr_t *valuep)
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
{
|
|
|
|
static char tmp[256];
|
|
|
|
db_expr_t value;
|
|
|
|
c_db_sym_t sym;
|
|
|
|
int cpu;
|
|
|
|
|
|
|
|
if (db_cpu != -1)
|
|
|
|
cpu = db_cpu;
|
|
|
|
else
|
|
|
|
cpu = curcpu;
|
|
|
|
snprintf(tmp, sizeof(tmp), "pcpu_entry_%s", name);
|
|
|
|
sym = db_lookup(tmp);
|
|
|
|
if (sym == C_DB_SYM_NULL)
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
db_symbol_values(sym, &name, &value);
|
|
|
|
if (value < DPCPU_START || value >= DPCPU_STOP)
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
*valuep = (db_expr_t)((uintptr_t)value + dpcpu_off[cpu]);
|
2015-05-18 22:27:46 +00:00
|
|
|
return (true);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
}
|
|
|
|
|
2015-05-21 15:16:18 +00:00
|
|
|
bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_value_of_name_vnet(const char *name, db_expr_t *valuep)
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
{
|
|
|
|
#ifdef VIMAGE
|
|
|
|
static char tmp[256];
|
|
|
|
db_expr_t value;
|
|
|
|
c_db_sym_t sym;
|
|
|
|
struct vnet *vnet;
|
|
|
|
|
|
|
|
if (db_vnet != NULL)
|
|
|
|
vnet = db_vnet;
|
|
|
|
else
|
|
|
|
vnet = curvnet;
|
|
|
|
snprintf(tmp, sizeof(tmp), "vnet_entry_%s", name);
|
|
|
|
sym = db_lookup(tmp);
|
|
|
|
if (sym == C_DB_SYM_NULL)
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
db_symbol_values(sym, &name, &value);
|
|
|
|
if (value < VNET_START || value >= VNET_STOP)
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
*valuep = (db_expr_t)((uintptr_t)value + vnet->vnet_data_base);
|
2015-05-18 22:27:46 +00:00
|
|
|
return (true);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#else
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
Build on Jeff Roberson's linker-set based dynamic per-CPU allocator
(DPCPU), as suggested by Peter Wemm, and implement a new per-virtual
network stack memory allocator. Modify vnet to use the allocator
instead of monolithic global container structures (vinet, ...). This
change solves many binary compatibility problems associated with
VIMAGE, and restores ELF symbols for virtualized global variables.
Each virtualized global variable exists as a "reference copy", and also
once per virtual network stack. Virtualized global variables are
tagged at compile-time, placing the in a special linker set, which is
loaded into a contiguous region of kernel memory. Virtualized global
variables in the base kernel are linked as normal, but those in modules
are copied and relocated to a reserved portion of the kernel's vnet
region with the help of a the kernel linker.
Virtualized global variables exist in per-vnet memory set up when the
network stack instance is created, and are initialized statically from
the reference copy. Run-time access occurs via an accessor macro, which
converts from the current vnet and requested symbol to a per-vnet
address. When "options VIMAGE" is not compiled into the kernel, normal
global ELF symbols will be used instead and indirection is avoided.
This change restores static initialization for network stack global
variables, restores support for non-global symbols and types, eliminates
the need for many subsystem constructors, eliminates large per-subsystem
structures that caused many binary compatibility issues both for
monitoring applications (netstat) and kernel modules, removes the
per-function INIT_VNET_*() macros throughout the stack, eliminates the
need for vnet_symmap ksym(2) munging, and eliminates duplicate
definitions of virtualized globals under VIMAGE_GLOBALS.
Bump __FreeBSD_version and update UPDATING.
Portions submitted by: bz
Reviewed by: bz, zec
Discussed with: gnn, jamie, jeff, jhb, julian, sam
Suggested by: peter
Approved by: re (kensmith)
2009-07-14 22:48:30 +00:00
|
|
|
#endif
|
|
|
|
}
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Lookup a symbol.
|
|
|
|
* If the symbol has a qualifier (e.g., ux:vm_map),
|
|
|
|
* then only the specified symbol table will be searched;
|
|
|
|
* otherwise, all symbol tables will be searched.
|
|
|
|
*/
|
1999-01-27 23:45:44 +00:00
|
|
|
static c_db_sym_t
|
2014-10-12 18:01:52 +00:00
|
|
|
db_lookup(const char *symstr)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1999-01-27 23:45:44 +00:00
|
|
|
c_db_sym_t sp;
|
1993-06-12 14:58:17 +00:00
|
|
|
register int i;
|
|
|
|
int symtab_start = 0;
|
|
|
|
int symtab_end = db_nsymtab;
|
1999-01-27 19:00:49 +00:00
|
|
|
register const char *cp;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Look for, remove, and remember any symbol table specifier.
|
|
|
|
*/
|
|
|
|
for (cp = symstr; *cp; cp++) {
|
|
|
|
if (*cp == ':') {
|
|
|
|
for (i = 0; i < db_nsymtab; i++) {
|
1999-01-27 19:00:49 +00:00
|
|
|
int n = strlen(db_symtabs[i].name);
|
|
|
|
|
|
|
|
if (
|
|
|
|
n == (cp - symstr) &&
|
|
|
|
strncmp(symstr, db_symtabs[i].name, n) == 0
|
|
|
|
) {
|
1993-06-12 14:58:17 +00:00
|
|
|
symtab_start = i;
|
|
|
|
symtab_end = i + 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i == db_nsymtab) {
|
|
|
|
db_error("invalid symbol table name");
|
|
|
|
}
|
|
|
|
symstr = cp+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Look in the specified set of symbol tables.
|
|
|
|
* Return on first match.
|
|
|
|
*/
|
|
|
|
for (i = symtab_start; i < symtab_end; i++) {
|
1994-09-27 03:34:58 +00:00
|
|
|
sp = X_db_lookup(&db_symtabs[i], symstr);
|
|
|
|
if (sp) {
|
1993-06-12 14:58:17 +00:00
|
|
|
db_last_symtab = &db_symtabs[i];
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1997-06-30 23:54:50 +00:00
|
|
|
/*
|
2015-05-18 22:27:46 +00:00
|
|
|
* If true, check across symbol tables for multiple occurrences
|
1997-06-30 23:54:50 +00:00
|
|
|
* of a name. Might slow things down quite a bit.
|
|
|
|
*/
|
2015-05-21 15:16:18 +00:00
|
|
|
static volatile bool db_qualify_ambiguous_names = false;
|
1997-06-30 23:54:50 +00:00
|
|
|
|
1993-06-12 14:58:17 +00:00
|
|
|
/*
|
|
|
|
* Does this symbol name appear in more than one symbol table?
|
|
|
|
* Used by db_symbol_values to decide whether to qualify a symbol.
|
|
|
|
*/
|
2015-05-21 15:16:18 +00:00
|
|
|
static bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_symbol_is_ambiguous(c_db_sym_t sym)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
1999-01-27 19:00:49 +00:00
|
|
|
const char *sym_name;
|
1993-06-12 14:58:17 +00:00
|
|
|
register int i;
|
2015-05-21 15:16:18 +00:00
|
|
|
register bool found_once = false;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
if (!db_qualify_ambiguous_names)
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
db_symbol_values(sym, &sym_name, 0);
|
|
|
|
for (i = 0; i < db_nsymtab; i++) {
|
|
|
|
if (X_db_lookup(&db_symtabs[i], sym_name)) {
|
|
|
|
if (found_once)
|
2015-05-21 15:16:18 +00:00
|
|
|
return (true);
|
2015-05-18 22:27:46 +00:00
|
|
|
found_once = true;
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
}
|
2015-05-18 22:27:46 +00:00
|
|
|
return (false);
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find the closest symbol to val, and return its name
|
|
|
|
* and the difference between val and the symbol found.
|
|
|
|
*/
|
1999-01-27 23:45:44 +00:00
|
|
|
c_db_sym_t
|
2014-10-12 18:01:52 +00:00
|
|
|
db_search_symbol(db_addr_t val, db_strategy_t strategy, db_expr_t *offp)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
register
|
|
|
|
unsigned int diff;
|
1998-06-07 17:13:14 +00:00
|
|
|
size_t newdiff;
|
1993-06-12 14:58:17 +00:00
|
|
|
register int i;
|
1999-01-27 23:45:44 +00:00
|
|
|
c_db_sym_t ret = C_DB_SYM_NULL, sym;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
newdiff = diff = ~0;
|
|
|
|
for (i = 0; i < db_nsymtab; i++) {
|
|
|
|
sym = X_db_search_symbol(&db_symtabs[i], val, strategy, &newdiff);
|
|
|
|
if (newdiff < diff) {
|
|
|
|
db_last_symtab = &db_symtabs[i];
|
|
|
|
diff = newdiff;
|
|
|
|
ret = sym;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*offp = diff;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return name and value of a symbol
|
|
|
|
*/
|
|
|
|
void
|
2014-10-12 18:01:52 +00:00
|
|
|
db_symbol_values(c_db_sym_t sym, const char **namep, db_expr_t *valuep)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
db_expr_t value;
|
|
|
|
|
|
|
|
if (sym == DB_SYM_NULL) {
|
|
|
|
*namep = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-06-28 00:55:02 +00:00
|
|
|
X_db_symbol_values(db_last_symtab, sym, namep, &value);
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
if (db_symbol_is_ambiguous(sym))
|
|
|
|
*namep = db_qualify(sym, db_last_symtab->name);
|
|
|
|
if (valuep)
|
|
|
|
*valuep = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print a the closest symbol to value
|
|
|
|
*
|
|
|
|
* After matching the symbol according to the given strategy
|
|
|
|
* we print it in the name+offset format, provided the symbol's
|
|
|
|
* value is close enough (eg smaller than db_maxoff).
|
|
|
|
* We also attempt to print [filename:linenum] when applicable
|
|
|
|
* (eg for procedure names).
|
|
|
|
*
|
|
|
|
* If we could not find a reasonable name+offset representation,
|
|
|
|
* then we just print the value in hex. Small values might get
|
|
|
|
* bogus symbol associations, e.g. 3 might get some absolute
|
|
|
|
* value like _INCLUDE_VERSION or something, therefore we do
|
1997-01-16 11:27:11 +00:00
|
|
|
* not accept symbols whose value is "small" (and use plain hex).
|
1993-06-12 14:58:17 +00:00
|
|
|
*/
|
|
|
|
|
1998-07-08 09:11:43 +00:00
|
|
|
db_expr_t db_maxoff = 0x10000;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
void
|
2014-10-12 18:01:52 +00:00
|
|
|
db_printsym(db_expr_t off, db_strategy_t strategy)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
|
|
|
db_expr_t d;
|
|
|
|
char *filename;
|
1999-01-27 19:00:49 +00:00
|
|
|
const char *name;
|
1993-06-12 14:58:17 +00:00
|
|
|
db_expr_t value;
|
|
|
|
int linenum;
|
1999-01-27 23:45:44 +00:00
|
|
|
c_db_sym_t cursym;
|
1993-06-12 14:58:17 +00:00
|
|
|
|
|
|
|
cursym = db_search_symbol(off, strategy, &d);
|
|
|
|
db_symbol_values(cursym, &name, &value);
|
1997-01-16 11:27:11 +00:00
|
|
|
if (name == 0)
|
|
|
|
value = off;
|
|
|
|
if (value >= DB_SMALL_VALUE_MIN && value <= DB_SMALL_VALUE_MAX) {
|
1998-07-08 10:53:58 +00:00
|
|
|
db_printf("%+#lr", (long)off);
|
1997-01-16 11:27:11 +00:00
|
|
|
return;
|
|
|
|
}
|
1998-07-08 09:11:43 +00:00
|
|
|
if (name == 0 || d >= (unsigned long)db_maxoff) {
|
1998-07-08 10:53:58 +00:00
|
|
|
db_printf("%#lr", (unsigned long)off);
|
1993-06-12 14:58:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2004-02-24 22:51:42 +00:00
|
|
|
#ifdef DDB_NUMSYM
|
|
|
|
db_printf("%#lr = %s", (unsigned long)off, name);
|
|
|
|
#else
|
1993-06-12 14:58:17 +00:00
|
|
|
db_printf("%s", name);
|
2004-02-24 22:51:42 +00:00
|
|
|
#endif
|
1993-06-12 14:58:17 +00:00
|
|
|
if (d)
|
1999-07-01 19:42:56 +00:00
|
|
|
db_printf("+%+#lr", (long)d);
|
1993-06-12 14:58:17 +00:00
|
|
|
if (strategy == DB_STGY_PROC) {
|
|
|
|
if (db_line_at_pc(cursym, &filename, &linenum, off))
|
|
|
|
db_printf(" [%s:%d]", filename, linenum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-21 15:16:18 +00:00
|
|
|
static bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_line_at_pc(c_db_sym_t sym, char **filename, int *linenum, db_expr_t pc)
|
1993-06-12 14:58:17 +00:00
|
|
|
{
|
2015-05-21 15:16:18 +00:00
|
|
|
return (X_db_line_at_pc(db_last_symtab, sym, filename, linenum, pc));
|
1993-06-12 14:58:17 +00:00
|
|
|
}
|
1994-01-03 07:54:10 +00:00
|
|
|
|
2015-05-21 15:16:18 +00:00
|
|
|
bool
|
2014-10-12 18:01:52 +00:00
|
|
|
db_sym_numargs(c_db_sym_t sym, int *nargp, char **argnames)
|
1994-01-03 07:54:10 +00:00
|
|
|
{
|
2015-05-21 15:16:18 +00:00
|
|
|
return (X_db_sym_numargs(db_last_symtab, sym, nargp, argnames));
|
1994-01-03 07:54:10 +00:00
|
|
|
}
|