'\" te .\" Copyright (c) 1998 Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH ADBGEN 8 "Feb 17, 2023" .SH NAME adbgen \- generate adb script .SH SYNOPSIS .nf \fB/usr/lib/adb/adbgen\fR [\fB-m\fR \fImodel\fR] \fIfilename\fR.adb .\|.\|. .fi .SH DESCRIPTION \fBadbgen\fR makes it possible to write \fBadb\fR(1) scripts that do not contain hard-coded dependencies on structure member offsets. The input to \fBadbgen\fR is a file named \fIfilename\fR\fB\&.adb\fR that contains header information, then a null line, then the name of a structure, and finally an \fBadb\fR script. \fBadbgen\fR only deals with one structure per file; all member names are assumed to be in this structure. The output of \fBadbgen\fR is an \fBadb\fR script in \fIfilename\fR. \fBadbgen\fR operates by generating a C program which determines structure member offsets and sizes, which in turn generate the \fBadb\fR script. .sp .LP The header lines, up to the null line, are copied verbatim into the generated C program. Typically, these are \fB#include\fR statements, which include the headers containing the relevant structure declarations. .sp .LP The \fBadb\fR script part may contain any valid \fBadb\fR commands (see \fBadb\fR(1)), and may also contain \fBadbgen\fR requests, each enclosed in braces (\fB\|{\|}\fR\|). Request types are: .RS +4 .TP .ie t \(bu .el o Print a structure member. The request form is \fB{\fR\fImember\fR\fB,\fR\fI\|format\fR\fB}.\fR \fImember\fR is a member name of the \fIstructure\fR given earlier, and \fBformat\fR is any valid \fBadb\fR format request or any of the \fBadbgen\fR format specifiers (such as \fB{POINTER}\fR) listed below. For example, to print the \fBp_pid\fR field of the \fIproc\fR structure as a decimal number, you would write \fB{p_pid,d}\fR. .RE .RS +4 .TP .ie t \(bu .el o Print the appropriate \fBadb\fR format character for the given \fBadbgen\fR format specifier. This action takes the data model into consideration. The request form is \fB{\fR\fIformat specifier\fR\fB}.\fR The valid \fBadbgen\fR format specifiers are: .RS .sp .ne 2 .na \fB\fB{POINTER}\fR\fR .ad .RS 14n pointer value in hexadecimal .RE .sp .ne 2 .na \fB\fB{LONGDEC}\fR\fR .ad .RS 14n long value in decimal .RE .sp .ne 2 .na \fB\fB{ULONGDEC}\fR\fR .ad .RS 14n unsigned long value in decimal .RE .sp .ne 2 .na \fB\fB{ULONGHEX}\fR\fR .ad .RS 14n unsigned long value in hexadecimal .RE .sp .ne 2 .na \fB\fB{LONGOCT}\fR\fR .ad .RS 14n long value in octal .RE .sp .ne 2 .na \fB\fB{ULONGOCT}\fR\fR .ad .RS 14n unsigned long value in octal .RE .RE .RE .RS +4 .TP .ie t \(bu .el o Reference a structure member. The request form is \fB{*\fR\fImember\fR\fB,\fR\fI\|base\fR\fB}.\fR \fImember\fR is the member name whose value is desired, and \fIbase\fR is an \fBadb\fR register name which contains the base address of the structure. For example, to get the \fBp_pid\fR field of the \fIproc\fR structure, you would get the \fIproc\fR structure address in an \fBadb\fR register, for example \fB