diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:15 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:15 -0400 |
| commit | 253e67c8b3a72b3a4757fdbc5845297628db0a4a (patch) | |
| tree | adf53b66087aa30dfbf8bf391a1dadb044c3bf4d /static/netbsd/man3/dwarf_init.3 | |
| parent | a9157ce950dfe2fc30795d43b9d79b9d1bffc48b (diff) | |
docs: Added All NetBSD Manuals
Diffstat (limited to 'static/netbsd/man3/dwarf_init.3')
| -rw-r--r-- | static/netbsd/man3/dwarf_init.3 | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/static/netbsd/man3/dwarf_init.3 b/static/netbsd/man3/dwarf_init.3 new file mode 100644 index 00000000..04b39595 --- /dev/null +++ b/static/netbsd/man3/dwarf_init.3 @@ -0,0 +1,180 @@ +.\" $NetBSD: dwarf_init.3,v 1.6 2024/03/03 17:37:31 christos Exp $ +.\" +.\" Copyright (c) 2009 Joseph Koshy. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by Joseph Koshy ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. in no event shall Joseph Koshy be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" Id: dwarf_init.3 3964 2022-03-13 21:41:26Z jkoshy +.\" +.Dd March 13, 2022 +.Dt DWARF_INIT 3 +.Os +.Sh NAME +.Nm dwarf_init , +.Nm dwarf_elf_init +.Nd allocate a DWARF debug descriptor +.Sh LIBRARY +.Lb libdwarf +.Sh SYNOPSIS +.In libdwarf.h +.Ft int +.Fo dwarf_init +.Fa "int fd" +.Fa "int mode" +.Fa "Dwarf_Handler errhand" +.Fa "Dwarf_Ptr errarg" +.Fa "Dwarf_Debug *ret" +.Fa "Dwarf_Error *err" +.Fc +.Ft int +.Fo dwarf_elf_init +.Fa "Elf *elf" +.Fa "int mode" +.Fa "Dwarf_Handler errhand" +.Fa "Dwarf_Ptr errarg" +.Fa "Dwarf_Debug *ret" +.Fa "Dwarf_Error *err" +.Fc +.Sh DESCRIPTION +These functions allocate and return a +.Vt Dwarf_Debug +instance for the object denoted by argument +.Fa fd +or +.Fa elf . +This instance would be used for subsequent access to debugging information in the object by other functions in the DWARF(3) library. +.Pp +For function +.Fn dwarf_init , +argument +.Fa fd +denotes an open file descriptor referencing a compilation object. +Function +.Fn dwarf_init +implicitly allocates an +.Vt Elf +descriptor for argument +.Fa fd . +.Pp +For function +.Fn dwarf_elf_init , +argument +.Fa elf +denotes a descriptor returned by +.Xr elf_begin 3 +or +.Xr elf_memory 3 . +.Pp +Argument +.Fa mode +specifies the access mode desired. +It should be at least as permissive as the mode with which +the file descriptor +.Fa fd +or the ELF descriptor +.Fa elf +was created with. +Legal values for argument +.Fa mode +are: +.Pp +.Bl -tag -width "DW_DLC_WRITE" -compact +.It DW_DLC_RDWR +Permit reading and writing of DWARF information. +.It DW_DLC_READ +Operate in read-only mode. +.It DW_DLC_WRITE +Permit writing of DWARF information. +.El +.Pp +Argument +.Fa errhand +denotes a function to be called in case of an error. +If this argument is +.Dv NULL +then a default error handling scheme is used. +See +.Xr dwarf 3 +for a description of the error handling scheme used by the +DWARF(3) library. +.Pp +Argument +.Fa errarg +is passed to the error handler function denoted by argument +.Fa errhand +when it is invoked. +.Pp +Argument +.Fa ret +points to the memory location that will hold a +.Vt Dwarf_Debug +reference on a successful call these functions. +.Pp +Argument +.Fa err +references a memory location that would hold a +.Vt Dwarf_Error +descriptor in case of an error. +.Ss Memory Management +The +.Vt Dwarf_Debug +instance returned by these functions should be freed using +.Fn dwarf_finish . +.Sh IMPLEMENTATION NOTES +The current implementation does not support access modes +.Dv DW_DLC_RDWR +and +.Dv DW_DLC_WRITE . +.Sh RETURN VALUES +These functions return the following values: +.Bl -tag -width ".Bq Er DW_DLV_NO_ENTRY" +.It Bq Er DW_DLV_OK +This return value indicates a successful return. +.It Bq Er DW_DLV_ERROR +The operation failed. +.It Bq Er DW_DLV_NO_ENTRY +The object specified by arguments +.Fa "fd" +or +.Fa "elf" +did not contain debug information. +.El +.Sh EXAMPLES +To initialize a +.Vt Dwarf_Debug +instance from a open file descriptor referencing an ELF object, and +with the default error handler, use: +.Bd -literal -offset indent +Dwarf_Error err; +Dwarf_Debug dbg; + +if (dwarf_init(fd, DW_DLC_READ, NULL, NULL, &dbg, &err) != + DW_DLV_OK) + errx(EXIT_FAILURE, "dwarf_init: %s", dwarf_errmsg(err)); +.Ed +.Sh SEE ALSO +.Xr dwarf 3 , +.Xr dwarf_errmsg 3 , +.Xr dwarf_finish 3 , +.Xr dwarf_get_elf 3 , +.Xr elf_begin 3 , +.Xr elf_memory 3 |
