Skip to content
Snippets Groups Projects
annotate.c 25.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • 		switch (disasm_line__print(pos, sym, start, evidx, len,
    
    			if (context) {
    				printed += queue_len;
    				queue = NULL;
    				queue_len = 0;
    			}
    
    			/*
    			 * Filtered by min_pcnt or non IP lines when
    			 * context != 0
    			 */
    			if (!context)
    				break;
    			if (queue_len == context)
    				queue = list_entry(queue->node.next, typeof(*queue), node);
    			else
    				++queue_len;
    
    void symbol__annotate_zero_histogram(struct symbol *sym, int evidx)
    {
    	struct annotation *notes = symbol__annotation(sym);
    	struct sym_hist *h = annotation__histogram(notes, evidx);
    
    
    	memset(h, 0, notes->src->sizeof_sym_hist);
    
    void symbol__annotate_decay_histogram(struct symbol *sym, int evidx)
    
    {
    	struct annotation *notes = symbol__annotation(sym);
    	struct sym_hist *h = annotation__histogram(notes, evidx);
    
    	int len = symbol__size(sym), offset;
    
    	for (offset = 0; offset < len; ++offset) {
    		h->addr[offset] = h->addr[offset] * 7 / 8;
    		h->sum += h->addr[offset];
    
    void disasm__purge(struct list_head *head)
    
    	struct disasm_line *pos, *n;
    
    
    	list_for_each_entry_safe(pos, n, head, node) {
    		list_del(&pos->node);
    
    static size_t disasm_line__fprintf(struct disasm_line *dl, FILE *fp)
    {
    	size_t printed;
    
    	if (dl->offset == -1)
    		return fprintf(fp, "%s\n", dl->line);
    
    	printed = fprintf(fp, "%#" PRIx64 " %s", dl->offset, dl->name);
    
    
    	if (dl->ops.raw[0] != '\0') {
    
    		printed += fprintf(fp, "%.*s %s\n", 6 - (int)printed, " ",
    
    	}
    
    	return printed + fprintf(fp, "\n");
    }
    
    size_t disasm__fprintf(struct list_head *head, FILE *fp)
    {
    	struct disasm_line *pos;
    	size_t printed = 0;
    
    	list_for_each_entry(pos, head, node)
    		printed += disasm_line__fprintf(pos, fp);
    
    	return printed;
    }
    
    
    int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
    			 bool print_lines, bool full_paths, int min_pcnt,
    			 int max_lines)
    {
    	struct dso *dso = map->dso;
    	const char *filename = dso->long_name;
    	struct rb_root source_line = RB_ROOT;
    	u64 len;
    
    
    	if (symbol__annotate(sym, map, 0) < 0)
    
    	len = symbol__size(sym);
    
    
    	if (print_lines) {
    		symbol__get_source_line(sym, map, evidx, &source_line,
    					len, filename);
    		print_summary(&source_line, filename);
    
    	symbol__annotate_printf(sym, map, evidx, full_paths,
    
    	if (print_lines)
    		symbol__free_source_line(sym, len);
    
    
    	disasm__purge(&symbol__annotation(sym)->src->source);