debug_entry_t* debug_sprintf_event(debug_info_t* id, int level,char *string,...) { va_list ap; int numargs,idx; unsigned long flags; debug_sprintf_entry_t *curr_event; debug_entry_t *active; if((!id) || (level > id->level)) return NULL; if (!debug_active || !id->areas) return NULL; numargs=debug_count_numargs(string); spin_lock_irqsave(&id->lock, flags); active = get_active_entry(id); curr_event=(debug_sprintf_entry_t *) DEBUG_DATA(active); va_start(ap,string); curr_event->string=string; for(idx=0;idx<min(numargs,(int)(id->buf_size / sizeof(long))-1);idx++) curr_event->args[idx]=va_arg(ap,long); va_end(ap); debug_finish_entry(id, active, level, 0); spin_unlock_irqrestore(&id->lock, flags); return active; }
static int debug_format_entry(file_private_info_t *p_info) { debug_info_t *id_snap = p_info->debug_info_snap; struct debug_view *view = p_info->view; debug_entry_t *act_entry; size_t len = 0; if(p_info->act_entry == DEBUG_PROLOG_ENTRY){ /* print prolog */ if (view->prolog_proc) len += view->prolog_proc(id_snap,view,p_info->temp_buf); goto out; } if (!id_snap->areas) /* this is true, if we have a prolog only view */ goto out; /* or if 'pages_per_area' is 0 */ act_entry = (debug_entry_t *) ((char*)id_snap->areas[p_info->act_area] [p_info->act_page] + p_info->act_entry); if (act_entry->id.stck == 0LL) goto out; /* empty entry */ if (view->header_proc) len += view->header_proc(id_snap, view, p_info->act_area, act_entry, p_info->temp_buf + len); if (view->format_proc) len += view->format_proc(id_snap, view, p_info->temp_buf + len, DEBUG_DATA(act_entry)); out: return len; }
/** * Called from the bitbuffer module. * It reads bits from the current packet. An internal check is performed * to check whether we have read valid data or a marker. */ int read_from_file(unsigned short* out) { // If we saved data to read if(last_size != 0) { int tmp = last_size; (*out) = last_data; last_data = 0; last_size = 0; return tmp; } int x = 0, length = 0; length = pkg_reader_get(&x); DEBUG_DATA(length, x); // If there is the chance this is marker if(x == 255 && length == 8) { int next_data; length = pkg_reader_get(&next_data); // If we find an escape sequence, do nothing; otherwise // this is, in fact, a marker and we have to handle it. if(next_data != 0 || length != 8) { last_data = next_data; last_size = length; return ERR_MARKER; } } (*out) = x; return length; }
debug_entry_t *debug_exception_common(debug_info_t * id, int level, const void *buf, int len) { unsigned long flags; debug_entry_t *active; if (!debug_active || !id->areas) return NULL; spin_lock_irqsave(&id->lock, flags); active = get_active_entry(id); memset(DEBUG_DATA(active), 0, id->buf_size); memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); debug_finish_entry(id, active, level, 1); spin_unlock_irqrestore(&id->lock, flags); return active; }
static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view, int area, debug_entry_t *entry, char *out_buf) { struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); struct timespec t; char *p = out_buf; if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { zfcp_dbf_timestamp(entry->id.stck, &t); zfcp_dbf_out(&p, "timestamp", "%011lu:%06lu", t.tv_sec, t.tv_nsec); zfcp_dbf_out(&p, "cpu", "%02i", entry->id.fields.cpuid); } else { zfcp_dbf_outd(&p, "", dump->data, dump->size, dump->offset, dump->total_size); if ((dump->offset + dump->size) == dump->total_size) p += sprintf(p, "\n"); } return p - out_buf; }
static int zfcp_dbf_view_header(debug_info_t * id, struct debug_view *view, int area, debug_entry_t * entry, char *out_buf) { struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)DEBUG_DATA(entry); int len = 0; if (strncmp(dump->tag, "dump", ZFCP_DBF_TAG_SIZE) != 0) { len += zfcp_dbf_stck(out_buf + len, "timestamp", entry->id.stck); len += zfcp_dbf_view(out_buf + len, "cpu", "%02i", entry->id.fields.cpuid); } else { len += zfcp_dbf_view_dump(out_buf + len, NULL, dump->data, dump->size, dump->offset, dump->total_size); if ((dump->offset + dump->size) == dump->total_size) len += sprintf(out_buf + len, "\n"); } return len; }