---
name: "dwarf_seterrarg"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/dwarf_seterrarg"
---

# dwarf\_seterrarg(3)

configure error handling

## NAME

**dwarf\_seterrarg**, **dwarf\_seterrhand** – configure error handling

## LIBRARY

library “libdwarf”

## SYNOPSIS

**#include \<libdwarf.h\>**

*Dwarf\_Ptr*\

**dwarf\_seterrarg**(*Dwarf\_Debug dbg*, *Dwarf\_Ptr arg*);

*Dwarf\_Handler*\

**dwarf\_seterrhand**(*Dwarf\_Debug dbg*, *Dwarf\_Handler handler*);

## DESCRIPTION

These functions may be used by applications to configure error handling callbacks. The error handling scheme used by the library is described in [dwarf(3)](/dwarf/3.md).

Function **dwarf\_seterrarg**() may be used to set the callback argument passed to a configured error handler at the time it is invoked. Argument *arg* is the callback argument being set. Argument *dbg* can be a debug context allocated by a prior call to [dwarf\_init(3)](/dwarf_init/3.md), or can be NULL to indicate that the library-wide callback argument is to be set.

Function **dwarf\_seterrhand**() may be used to associate an error handler denoted by argument *handler* with the DWARF debug context descriptor denoted by argument *dbg*. Argument *dbg* should be a debug context allocated by a prior call to [dwarf\_init(3)](/dwarf_init/3.md), or may be NULL to indicate that the library-wide error handler is to be set.

## RETURN VALUES

Function **dwarf\_seterrhand**() returns the previous error handler associated with argument *dbg*. If argument *dbg* is NULL, function **dwarf\_seterrhand**() returns the previous library-wide error handler.

Function **dwarf\_seterrarg**() returns the previous callback argument associated with argument *dbg*. If argument *dbg* is NULL, function **dwarf\_seterrarg**() returns the previous library-wide callback argument.

## COMPATIBILITY

The behavior of these functions when argument *dbg* is NULL is a local extension.

## ERRORS

These functions do not set an error code.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_init(3)](/dwarf_init/3.md)
