| MCD_DUMP_DATA_REGISTER_BIN(3) | minicoredumper | MCD_DUMP_DATA_REGISTER_BIN(3) |
mcd_dump_data_register_bin - register binary data to be dumped
#include <minicoredumper.h>
int mcd_dump_data_register_bin(const char *ident,
unsigned long dump_scope,
mcd_dump_data_t *save_ptr,
void *data_ptr,
size_t data_size,
enum mcd_dump_data_flags flags);
Compile and link with -lminicoredumper.
The mcd_dump_data_register_bin() function registers binary data to be dumped. ident is a string to identify the binary dump later. If non-NULL, it must be unique! If ident is NULL, the data is only dumped if this is the crashing application, in which case the data will be explicitly stored in the core(5) file. The data will only be dumped if a scope value greater than or equal to dump_scope is requested by the minicoredumper(1). If save_ptr is non-NULL, a pointer to the registered dump will be stored there. This is needed if mcd_dump_data_unregister(3) will be used. data_ptr contains a pointer to the memory location of the data to dump (or a pointer to that pointer). flags specifies how data_ptr and data_size should be interpreted when dumping data. data_size specifies the number of bytes of data to dump (or a pointer to the number).
The flags option specifies how data_ptr and data_size should be interpreted when dumping data. It can also affect dump behavior. The flags are bitwise combined to describe the desired behavior. The flags available are:
mcd_dump_data_register_bin() returns 0 on success, otherwise an error value is returned.
Register a binary dump with direct data and direct size.
mcd_dump_data_t dd1;
unsigned long val1;
mcd_dump_data_register_bin("bdump1.bin", 6, &dd1, &val1, sizeof(val1),
MCD_DATA_PTR_DIRECT | MCD_LENGTH_DIRECT);
Register a binary dump with indirect data and direct size.
mcd_dump_data_t dd2;
unsigned long *val2;
val2 = malloc(sizeof(unsigned long));
mcd_dump_data_register_bin("bdump2.bin", 6, &dd2, &val2, sizeof(*val2),
MCD_DATA_PTR_INDIRECT | MCD_LENGTH_DIRECT);
Register a binary dump with indirect data and indirect size.
mcd_dump_data_t dd3;
unsigned long *val3;
size_t s3;
s3 = sizeof(unsigned long);
val3 = malloc(s3);
mcd_dump_data_register_bin("bdump3.bin", 6, &dd3, &val3, (size_t)&s3,
MCD_DATA_PTR_INDIRECT | MCD_LENGTH_INDIRECT);
MCD_DATA_PTR_INDIRECT and MCD_LENGTH_INDIRECT allow an application to change the size and location of data to dump during run-time. However, such changes should be performed carefully because an application can not know when a dump will occur.
The string specified in ident is also the file name of the dump file. For this reason characters such as '/' are not permitted.
libminicoredumper(7), mcd_dump_data_unregister(3), coreinject(1)
The DiaMon Workgroup: <http://www.diamon.org>
| 2016-09-12 | minicoredumper |