示例#1
0
  /* Function print_all() uses the address of func. print_info_node() as a callback for the
   * func. print_info_list(), which traverses the list recursively. */
void print_all(FILE *f, info_list *IL, int current_cycle)
{
    //assert(current_cycle <= MAX_PRINTABLE_CYCLES); // else our layout breaks!

    /* print header */
    fprintf(f, " Cmd  |"); //print 5 spaces
    for(int i = 1; i < current_cycle; ++i)
        fprintf(f, "%4d|", i);
    fprintf(f, "\n");

    /* print all info foreach instruction before a breakpoint or a terminated execution */
    print_info_list(f, IL, print_info_node);
}
void pfs_print_list_for_each(struct list_head *hl_head)
{
    proto_head_list_t *head_list;
    proto_info_list_t *info_list;
    struct list_head *pos,*n;

    head_list = container_of(hl_head,proto_head_list_t,list_head);
    /*
     *pthread_rwlock_rdlock(&head_list->head_lock);
     */
    list_for_each_safe(pos, n, hl_head) {
        info_list = container_of(pos,proto_info_list_t,list_head);
        print_info_list(info_list);
    }