本文整理汇总了C++中debug_dump函数的典型用法代码示例。如果您正苦于以下问题:C++ debug_dump函数的具体用法?C++ debug_dump怎么用?C++ debug_dump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_dump函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: curl_cb_debug
static int curl_cb_debug(CURL *curl, curl_infotype info, char *buf, size_t len,
void *userdata)
{
struct http_ctx *ctx = userdata;
switch (info) {
case CURLINFO_TEXT:
debug_dump(ctx, "CURLINFO_TEXT", buf, len);
break;
case CURLINFO_HEADER_IN:
debug_dump(ctx, "CURLINFO_HEADER_IN", buf, len);
break;
case CURLINFO_HEADER_OUT:
debug_dump(ctx, "CURLINFO_HEADER_OUT", buf, len);
break;
case CURLINFO_DATA_IN:
debug_dump(ctx, "CURLINFO_DATA_IN", buf, len);
break;
case CURLINFO_DATA_OUT:
debug_dump(ctx, "CURLINFO_DATA_OUT", buf, len);
break;
case CURLINFO_SSL_DATA_IN:
wpa_printf(MSG_DEBUG, "debug - CURLINFO_SSL_DATA_IN - %d",
(int) len);
break;
case CURLINFO_SSL_DATA_OUT:
wpa_printf(MSG_DEBUG, "debug - CURLINFO_SSL_DATA_OUT - %d",
(int) len);
break;
case CURLINFO_END:
wpa_printf(MSG_DEBUG, "debug - CURLINFO_END - %d",
(int) len);
break;
}
return 0;
}
示例2: analyze_object
/*
* analyze_object
* Look at a library loaded into the current process, and determine as much as
* possible about it. The disassembling, allocations are initiated here.
*
* This is a callback function, passed to dl_iterate_phdr(3).
* data and size are just unused callback arguments.
*
*
* From dl_iterate_phdr(3) man page:
*
* struct dl_phdr_info
* {
* ElfW(Addr) dlpi_addr; Base address of object
* const char *dlpi_name; (Null-terminated) name of object
* const ElfW(Phdr) *dlpi_phdr; Pointer to array of ELF program headers
* ElfW(Half) dlpi_phnum; # of items in dlpi_phdr
* ...
* }
*
*/
static int
analyze_object(struct dl_phdr_info *info, size_t size, void *data)
{
(void) data;
(void) size;
const char *path;
debug_dump("analyze_object called on \"%s\" at 0x%016" PRIxPTR "\n",
info->dlpi_name, info->dlpi_addr);
if ((path = get_object_path(info)) == NULL)
return 0;
debug_dump("analyze %s\n", path);
if (!should_patch_object(info->dlpi_addr, path))
return 0;
struct intercept_desc *patches = allocate_next_obj_desc();
patches->base_addr = (unsigned char *)info->dlpi_addr;
patches->path = path;
find_syscalls(patches);
allocate_trampoline_table(patches);
create_patch_wrappers(patches);
return 0;
}
示例3: vp7045_usb_op
int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec)
{
int ret = 0;
#else
#define deb_info(args...) d;
#endif
u8 *buf = d->priv;
buf[0] = cmd;
if (outlen > 19)
outlen = 19;
if (inlen > 11)
inlen = 11;
ret = mutex_lock_interruptible(&d->usb_mutex);
if (ret)
return ret;
if (out != NULL && outlen > 0)
memcpy(&buf[1], out, outlen);
deb_xfer("out buffer: ");
debug_dump(buf, outlen+1, deb_xfer);
if (usb_control_msg(d->udev,
usb_sndctrlpipe(d->udev,0),
TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0,
buf, 20, 2000) != 20) {
err("USB control message 'out' went wrong.");
ret = -EIO;
goto unlock;
}
msleep(msec);
if (usb_control_msg(d->udev,
usb_rcvctrlpipe(d->udev,0),
TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
buf, 12, 2000) != 12) {
err("USB control message 'in' went wrong.");
ret = -EIO;
goto unlock;
}
deb_xfer("in buffer: ");
debug_dump(buf, 12, deb_xfer);
if (in != NULL && inlen > 0)
memcpy(in, &buf[1], inlen);
unlock:
mutex_unlock(&d->usb_mutex);
return ret;
}
示例4: vp7045_usb_op
int vp7045_usb_op(struct dvb_usb_device *d, u8 cmd, u8 *out, int outlen, u8 *in, int inlen, int msec)
{
int ret = 0;
u8 inbuf[12] = { 0 }, outbuf[20] = { 0 };
outbuf[0] = cmd;
if (outlen > 19)
outlen = 19;
if (inlen > 11)
inlen = 11;
if (out != NULL && outlen > 0)
memcpy(&outbuf[1], out, outlen);
deb_xfer("out buffer: ");
debug_dump(outbuf,outlen+1,deb_xfer);
if ((ret = down_interruptible(&d->usb_sem)))
return ret;
if (usb_control_msg(d->udev,
usb_sndctrlpipe(d->udev,0),
TH_COMMAND_OUT, USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0,
outbuf, 20, 2000) != 20) {
err("USB control message 'out' went wrong.");
ret = -EIO;
goto unlock;
}
msleep(msec);
if (usb_control_msg(d->udev,
usb_rcvctrlpipe(d->udev,0),
TH_COMMAND_IN, USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
inbuf, 12, 2000) != 12) {
err("USB control message 'in' went wrong.");
ret = -EIO;
goto unlock;
}
deb_xfer("in buffer: ");
debug_dump(inbuf,12,deb_xfer);
if (in != NULL && inlen > 0)
memcpy(in,&inbuf[1],inlen);
unlock:
up(&d->usb_sem);
return ret;
}
示例5: check_timeouts
dbuf_t *dtry_reasm_timed(void *pile, uint32_t xid, char *data, uint16_t len, uint16_t offs, int more, time_t now) {
reasm_pile_struct_t *rp = (void *)(((dbuf_t *)pile)->buf);
reasm_chunk_t *chk;
if (now > 0) {
check_timeouts(rp, now);
}
if(offs + len > rp->mtu) {
debug(DBG_REASM, 10, "Offset + length (%d + %d) of fragment > MTU (%d), discard", offs, len, rp->mtu);
return NULL;
}
if ((offs > 0) && (offs < HOLE_MIN_LENGTH)) {
debug(DBG_REASM, 10, "Offset %d less than min hole length %d\n", offs, HOLE_MIN_LENGTH);
return NULL;
}
chk = hfind(rp->chs, &xid, sizeof(xid));
if (!chk) {
debug(DBG_REASM, 10, "Reasm chunk %lu not found, creating", xid);
chk = malloc(sizeof(reasm_chunk_t));
chk->xid = xid;
chk->maxfrags = rp->maxfrags;
chk->hole = 0;
chk->esize = rp->ftu;
chk->d = dalloc(chk->esize);
chk->deadline = now + rp->reasm_timeout;
memset(chk->d->buf, 0xaa, chk->d->size);
hole_set(chk, 0, chk->esize, 0);
hinsert(rp->chs, &xid, sizeof(xid), chk, chk_destructor, NULL, NULL, NULL);
TAILQ_INSERT_TAIL(&rp->lru, chk, entries);
} else {
debug(DBG_REASM, 10, "Reasm chunk %lu found", xid);
}
debug(DBG_REASM, 100, "Chunk data (hole: %d, esize: %d):", chk->hole, chk->esize);
debug_dump(DBG_REASM, 100, chk->d->buf, chk->d->size);
if(offs + len > chk->d->size) {
debug(DBG_REASM, 10, "Reasm chunk %lu overflow - %d + %d > %d", xid, offs, len, chk->d->size);
/* We already checked the MTU overflow above, so we can safely reallocate here */
int oldsize = chk->d->size;
dgrow(chk->d, rp->mtu - chk->d->size);
hole_grow(chk, oldsize-1, chk->d->size);
chk->esize = chk->d->size;
debug(DBG_REASM, 100, "Fresh chunk data after growth to MTU:");
debug_dump(DBG_REASM, 100, chk->d->buf, chk->d->size);
}
chk->atime = now;
return dperform_reasm(rp, chk, xid, data, len, offs, more);
}
示例6: dvb_usb_generic_rw
int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
u16 rlen, int delay_ms)
{
int actlen,ret = -ENOMEM;
if (!d || wbuf == NULL || wlen == 0)
return -EINVAL;
if (d->props.generic_bulk_ctrl_endpoint == 0) {
err("endpoint for generic control not specified.");
return -EINVAL;
}
if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
return ret;
deb_xfer(">>> ");
debug_dump(wbuf,wlen,deb_xfer);
ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev,
d->props.generic_bulk_ctrl_endpoint), wbuf,wlen,&actlen,
2000);
if (ret)
err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
else
ret = actlen != wlen ? -1 : 0;
if (!ret && rbuf && rlen) {
if (delay_ms)
msleep(delay_ms);
ret = usb_bulk_msg(d->udev,usb_rcvbulkpipe(d->udev,
d->props.generic_bulk_ctrl_endpoint_response ?
d->props.generic_bulk_ctrl_endpoint_response :
d->props.generic_bulk_ctrl_endpoint),rbuf,rlen,&actlen,
2000);
if (ret)
err("recv bulk message failed: %d",ret);
else {
deb_xfer("<<< ");
debug_dump(rbuf,actlen,deb_xfer);
}
}
mutex_unlock(&d->usb_mutex);
return ret;
}
示例7: sys_debug
/*
* Kernel debug service.
*/
int
sys_debug(int cmd, u_long arg)
{
#ifdef DEBUG
int rc;
switch (cmd) {
case DCMD_DUMP:
rc = debug_dump(arg);
break;
case DCMD_LOGSIZE:
rc = LOGBUF_SIZE;
break;
case DCMD_GETLOG:
rc = debug_getlog((void *)arg);
break;
default:
rc = DERR(-EINVAL);
break;
}
return rc;
#else
return -ENOSYS;
#endif
}
示例8: debug_sigsegv
void
debug_sigsegv ()
{
debug_dump (1);
unhook_all ();
gui_main_end (0);
string_iconv_fprintf (
stderr,
"\n"
"*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
if (!log_crash_rename ())
{
string_iconv_fprintf (
stderr,
"*** Full crash dump was saved to %s/weechat.log file.\n",
weechat_home);
}
string_iconv_fprintf (
stderr,
"***\n"
"*** Please help WeeChat developers to fix this bug:\n"
"*** 1. If you have a core file, please run: gdb /path/to/weechat core\n"
"*** then issue command: \"bt full\" and send result to developers\n"
"*** (see user's guide for more info about report of crashes).\n"
"*** 2. Otherwise send backtrace (below), only if it is a complete trace.\n"
"*** Keep the crash log file, just in case developers ask you some info\n"
"*** (be careful, private info like passwords may be in this file).\n\n");
weechat_backtrace ();
/* shutdown with error code */
weechat_shutdown (EXIT_FAILURE, 1);
}
示例9: debug
dbuf_t *check_reasm_done(reasm_pile_struct_t *rp, reasm_chunk_t *chk, uint16_t hoffs1, uint16_t hoffs0,
char *data, uint16_t len, uint16_t offs, int more) {
dbuf_t *d = chk->d;
if (!more) {
debug(DBG_REASM, 20, "Set desired length %d <= %d + %d\n", chk->esize, offs, len);
chk->esize = offs+len;
}
memcpy(&chk->d->buf[offs], data, len);
reset_timeout(rp, chk);
if (d->dsize < offs+len) {
d->dsize = offs+len;
}
debug(DBG_REASM, 20, "Offs: %d, len: %d, chk->esize: %d, chk->hole: %d, d->dsize: %d",
offs, len, chk->esize, chk->hole, d->dsize);
debug_dump(DBG_REASM, 100, d->buf, d->size);
if (chk->esize == chk->hole) {
/*
* reassembly complete. Delete chunk, and return the dbuf.
* do not unlock since we should have locked it anyway
*/
d->dsize = chk->esize;
dispose_chk(rp, chk);
return d;
}
return NULL;
}
示例10: debug_sigsegv
void
debug_sigsegv ()
{
debug_dump (1);
unhook_all ();
gui_main_end (0);
string_iconv_fprintf (stderr, "\n");
string_iconv_fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
if (!log_crash_rename ())
string_iconv_fprintf (stderr,
"*** Full crash dump was saved to %s/weechat.log file.\n",
weechat_home);
string_iconv_fprintf (stderr, "***\n");
string_iconv_fprintf (stderr, "*** Please help WeeChat developers to fix this bug:\n");
string_iconv_fprintf (stderr, "*** 1. If you have a core file, please run: gdb weechat-curses core\n");
string_iconv_fprintf (stderr, "*** then issue \"bt\" command and send result to developers\n");
string_iconv_fprintf (stderr, "*** To enable core files with bash shell: ulimit -c 10000\n");
string_iconv_fprintf (stderr, "*** 2. Otherwise send backtrace (below) and weechat.log\n");
string_iconv_fprintf (stderr, "*** (be careful, private info may be in this file since\n");
string_iconv_fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n");
weechat_backtrace ();
/* shutdown with error code */
weechat_shutdown (EXIT_FAILURE, 1);
}
示例11: debug_input
void debug_input(void)
{
// screenshot always works
if (input_action_get_state_single(nc_debug_screenshot)) {
debug_screenshot();
return;
}
// others require debug mode to be on
if (!hud.debug) return;
if (input_action_get_state_single(nc_debug_status)) {
debug_dump();
return;
}
if (input_action_get_state_single(nc_debug_game)) {
debug_game();
return;
}
if (input_action_get_state_single(nc_debug_map)) {
map_pick_trigger_set();
return;
}
}
示例12: dibusb_readwrite_usb
int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf,
u16 rlen)
{
int actlen,ret = -ENOMEM;
if (wbuf == NULL || wlen == 0)
return -EINVAL;
if ((ret = down_interruptible(&dib->usb_sem)))
return ret;
debug_dump(wbuf,wlen);
ret = usb_bulk_msg(
dib->udev,
usb_sndbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd),
wbuf,
wlen,
&actlen,
DIBUSB_I2C_TIMEOUT);
if (ret)
err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
else
ret = (actlen != wlen) ? -1 : 0;
/* an answer is expected, and no error before */
if (!ret && rbuf && rlen) {
ret = usb_bulk_msg(dib->udev,usb_rcvbulkpipe(dib->udev,
dib->dibdev->dev_cl->pipe_cmd),rbuf,rlen,&actlen,
DIBUSB_I2C_TIMEOUT);
if (ret)
err("recv bulk message failed: %d",ret);
else {
deb_alot("rlen: %d\n",rlen);
debug_dump(rbuf,actlen);
}
}
up(&dib->usb_sem);
return ret;
}
示例13: dvb_usb_urb_complete
/* URB stuff for streaming */
static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
{
struct dvb_usb_device *d = urb->context;
int ptype = usb_pipetype(urb->pipe);
int i;
u8 *b;
deb_ts("'%s' urb completed. feedcount: %d, status: %d, length: %d/%d, pack_num: %d, errors: %d\n",
ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", d->feedcount,
urb->status,urb->actual_length,urb->transfer_buffer_length,
urb->number_of_packets,urb->error_count);
switch (urb->status) {
case 0: /* success */
case -ETIMEDOUT: /* NAK */
break;
case -ECONNRESET: /* kill */
case -ENOENT:
case -ESHUTDOWN:
return;
default: /* error */
deb_ts("urb completition error %d.", urb->status);
break;
}
if (d->feedcount > 0) {
if (d->state & DVB_USB_STATE_DVB) {
switch (ptype) {
case PIPE_ISOCHRONOUS:
b = (u8 *) urb->transfer_buffer;
for (i = 0; i < urb->number_of_packets; i++) {
if (urb->iso_frame_desc[i].status != 0)
deb_ts("iso frame descriptor has an error: %d\n",urb->iso_frame_desc[i].status);
else if (urb->iso_frame_desc[i].actual_length > 0) {
dvb_dmx_swfilter(&d->demux,b + urb->iso_frame_desc[i].offset,
urb->iso_frame_desc[i].actual_length);
}
urb->iso_frame_desc[i].status = 0;
urb->iso_frame_desc[i].actual_length = 0;
}
debug_dump(b,20,deb_ts);
break;
case PIPE_BULK:
if (urb->actual_length > 0)
dvb_dmx_swfilter(&d->demux, (u8 *) urb->transfer_buffer,urb->actual_length);
break;
default:
err("unkown endpoint type in completition handler.");
return;
}
}
}
usb_submit_urb(urb,GFP_ATOMIC);
}
示例14: acpi_init_global
static void
acpi_init_global (void)
{
u64 rsdp;
struct rsdp *p;
struct facp *q;
struct acpi_ent_dmar *r;
struct domain *create_dom() ;
rsdp_found = false;
pm1a_cnt_found = false;
rsdp = find_rsdp ();
if (rsdp == FIND_RSDP_NOT_FOUND) {
printf ("ACPI RSDP not found.\n");
return;
}
p = acpi_mapmem (rsdp, sizeof *p);
memcpy (&rsdp_copy, p, sizeof *p);
rsdp_found = true;
r=find_entry(DMAR_SIGNATURE);
if (!r) {
printf ("ACPI DMAR not found.\n");
iommu_detected=0;
} else {
int i ;
printf ("ACPI DMAR found.\n");
iommu_detected=1;
parse_dmar_bios_report(r) ;
num_dom=0 ;
for (i=0 ; i<MAX_IO_DOM ; i++)
dom_io[i]=create_dom(i) ;
}
q = find_facp ();
if (!q) {
printf ("ACPI FACP not found.\n");
return;
}
#ifdef ACPI_DSDT
acpi_dsdt_parse (q->dsdt);
#endif
get_pm1a_cnt_ioaddr (q);
get_facs_addr (q);
if (0)
debug_dump (q, q->header.length);
if (0)
printf ("PM1a control port is 0x%X\n", pm1a_cnt_ioaddr);
pm1a_cnt_found = true;
clear_mcfg ();
}
示例15: vp7045_read_eeprom
static int vp7045_read_eeprom(struct dvb_usb_device *d,u8 *buf, int len, int offset)
{
int i = 0;
u8 v,br[2];
for (i=0; i < len; i++) {
v = offset + i;
vp7045_usb_op(d,GET_EE_VALUE,&v,1,br,2,5);
buf[i] = br[1];
}
deb_info("VP7045 EEPROM read (offs: %d, len: %d) : ",offset, i);
debug_dump(buf,i,deb_info);
return 0;
}