Rizin
unix-like reverse engineering framework and cli tools
debug.c File Reference

Go to the source code of this file.

Functions

static char * binary (unsigned int val, unsigned int bits)
 
static void cabinfo (struct mscabd_cabinet_p *cab)
 

Function Documentation

◆ binary()

static char* binary ( unsigned int  val,
unsigned int  bits 
)
static

Definition at line 3 of file debug.c.

3  {
4  static char data[33] = "";
5  char *ptr = &data[bits];
6  if (bits > 32) return "bits>32";
7  *ptr-- = '\0';
8  while (bits--) { *ptr-- = (val & 1) ? '1' : '0'; val >>= 1; }
9  return &data[0];
10 }
ut16 val
Definition: armass64_const.h:6
int bits(struct state *s, int need)
Definition: blast.c:72

References bits(), and val.

Referenced by gzfilebuf::attach(), gzfilebuf::open(), and gzfilebuf::open_mode().

◆ cabinfo()

static void cabinfo ( struct mscabd_cabinet_p cab)
static

Definition at line 12 of file debug.c.

12  {
13  struct mscabd_folder_data *dat;
14  struct mscabd_folder_p *fol;
15  struct mscabd_file *fi;
16 
17  printf("cab@%p\n", cab);
18  if (!cab) return;
19  printf("- next=%p\n", cab->base.next);
20  printf("- filename=\"%s\"\n", cab->base.filename);
21  printf("- base_offset=%ld\n", cab->base.base_offset);
22  printf("- length=%ld\n", cab->base.length);
23  printf("- prevcab=%p\n", cab->base.prevcab);
24  printf("- nextcab=%p\n", cab->base.nextcab);
25  printf("- prevname=\"%s\"\n", cab->base.nextname);
26  printf("- previnfo=\"%s\"\n", cab->base.nextinfo);
27  printf("- nextname=\"%s\"\n", cab->base.nextname);
28  printf("- nextinfo=\"%s\"\n", cab->base.nextinfo);
29  printf("- flags=0x%x\n", cab->base.flags);
30  printf("- folders:\n");
31  for (fol = cab->folders; fol; fol = fol->next) {
32  printf(" folder@%p\n", fol);
33  printf(" - comp_type=0x%x\n", fol->comp_type);
34  printf(" - merge_prev=%p\n", fol->merge_prev);
35  printf(" - merge_next=%p\n", fol->merge_next);
36  for (dat = &fol->data; dat; dat=dat->next) {
37  printf(" - datasplit@%p = CAB(%p) OFFSET(%ld) BLOCKS(%d)\n",
38  dat, dat->cab, dat->offset, dat->num_blocks);
39  }
40  }
41  printf("- files:\n");
42  for (fi = cab->base.files; fi; fi = fi->next) {
43  printf(" @%p \"%s\" %d FOL(%p) OFFSET(%u)\n",
44  fi, fi->filename, fi->length,
45  ((struct mscabd_file_p *) fi)->folder,
46  ((struct mscabd_file_p *) fi)->offset);
47  }
48 }
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
struct mscabd_cabinet base
Definition: cab.h:121
const char * filename
Definition: mspack.h:712
struct mscabd_cabinet * next
Definition: mspack.h:705
struct mscabd_cabinet * prevcab
Definition: mspack.h:721
unsigned int length
Definition: mspack.h:718
off_t base_offset
Definition: mspack.h:715
char * nextinfo
Definition: mspack.h:740
char * nextname
Definition: mspack.h:730
struct mscabd_file * files
Definition: mspack.h:743
struct mscabd_cabinet * nextcab
Definition: mspack.h:724
unsigned int length
Definition: mspack.h:881
struct mscabd_file * next
Definition: mspack.h:868
char * filename
Definition: mspack.h:878
off_t offset
Definition: cab.h:130
struct mscabd_cabinet_p * cab
Definition: cab.h:129
struct mscabd_folder_data * next
Definition: cab.h:128
struct mscabd_folder_data data
Definition: cab.h:135
struct mscabd_file * merge_next
Definition: cab.h:137
struct mscabd_file * merge_prev
Definition: cab.h:136

References mscabd_cabinet_p::base, mscabd_cabinet::base_offset, mscabd_folder_data::cab, mscabd_folder_p::data, mscabd_cabinet::filename, mscabd_file::filename, mscabd_cabinet::files, mscabd_cabinet::flags, mscabd_cabinet::length, mscabd_file::length, mscabd_folder_p::merge_next, mscabd_folder_p::merge_prev, mscabd_folder_data::next, mscabd_cabinet::next, mscabd_file::next, mscabd_cabinet::nextcab, mscabd_cabinet::nextinfo, mscabd_cabinet::nextname, mscabd_folder_data::offset, mscabd_cabinet::prevcab, and printf().