1 /*--------------------------------------------------------------------*/
2 /*--- Callgrind data structures, functions. global.h ---*/
3 /*--------------------------------------------------------------------*/
6 This file is part of Valgrind, a dynamic binary instrumentation
9 Copyright (C) 2004-2017 Josef Weidendorfer
10 josef.weidendorfer@gmx.de
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, see <http://www.gnu.org/licenses/>.
25 The GNU General Public License is contained in the file COPYING.
31 #include "pub_tool_basics.h"
32 #include "pub_tool_vki.h"
33 #include "pub_tool_debuginfo.h"
34 #include "pub_tool_libcbase.h"
35 #include "pub_tool_libcassert.h"
36 #include "pub_tool_libcfile.h"
37 #include "pub_tool_libcprint.h"
38 #include "pub_tool_libcproc.h"
39 #include "pub_tool_machine.h"
40 #include "pub_tool_mallocfree.h"
41 #include "pub_tool_options.h"
42 #include "pub_tool_tooliface.h"
43 #include "pub_tool_xarray.h"
44 #include "pub_tool_clientstate.h"
45 #include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
47 #include "events.h" // defines CLG_ macro
51 /*------------------------------------------------------------*/
52 /*--- Callgrind compile options --- */
53 /*------------------------------------------------------------*/
55 /* Enable debug output */
56 #define CLG_ENABLE_DEBUG 1
58 /* Enable experimental features? */
59 #define CLG_EXPERIMENTAL 0
62 /*------------------------------------------------------------*/
63 /*--- Command line options ---*/
64 /*------------------------------------------------------------*/
66 #define DEFAULT_OUTFORMAT "callgrind.out.%p"
68 /* If and how to collect syscall time.
69 systime_no : do not collect systime
70 systime_msec : collect syscount, systime elapsed, milli second precision.
71 systime_usec : collect syscount, systime elapsed, micro second precision.
72 systime_nsec : collect syscount, systime elapsed, systime cpu, nano second
81 typedef struct _CommandLineOptions CommandLineOptions
;
82 struct _CommandLineOptions
{
84 /* Dump format options */
85 const HChar
* out_format
; /* Format string for callgrind output file name */
86 Bool combine_dumps
; /* Dump trace parts into same file? */
87 Bool compress_strings
;
91 Bool compress_mangled
;
95 Bool dump_bbs
; /* Dump basic block information? */
97 /* Dump generation options */
98 ULong dump_every_bb
; /* Dump every xxx BBs. */
100 /* Collection options */
101 Bool separate_threads
; /* Separate threads in dump? */
102 Int separate_callers
; /* Separate dependent on how many callers? */
103 Int separate_recursions
; /* Max level of recursions to separate */
104 Bool skip_plt
; /* Skip functions in PLT section? */
105 Bool skip_direct_recursion
; /* Increment direct recursions the level? */
107 Bool collect_atstart
; /* Start in collecting state ? */
108 Bool collect_jumps
; /* Collect (cond.) jumps in functions ? */
110 Bool collect_alloc
; /* Collect size of allocated memory */
111 Collect_Systime collect_systime
; /* Collect time for system calls */
113 Bool collect_bus
; /* Collect global bus events */
115 /* Instrument options */
116 Bool instrument_atstart
; /* Instrument at start? */
117 Bool simulate_cache
; /* Call into cache simulator ? */
118 Bool simulate_branch
; /* Call into branch prediction simulator ? */
120 /* Call graph generation */
121 Bool pop_on_jump
; /* Handle a jump between functions as ret+call */
129 /*------------------------------------------------------------*/
130 /*--- Constants ---*/
131 /*------------------------------------------------------------*/
133 /* Minimum cache line size allowed */
134 #define MIN_LINE_SIZE 16
137 /*------------------------------------------------------------*/
138 /*--- Statistics ---*/
139 /*------------------------------------------------------------*/
141 typedef struct _Statistics Statistics
;
146 ULong rec_call_counter
;
151 Int bb_retranslations
;
156 Int distinct_contexts
;
164 Int bbcc_hash_resizes
;
165 Int jcc_hash_resizes
;
166 Int cxt_hash_resizes
;
167 Int fn_array_resizes
;
168 Int call_stack_resizes
;
169 Int fn_stack_resizes
;
172 Int file_line_debug_BBs
;
173 Int fn_name_debug_BBs
;
182 /*------------------------------------------------------------*/
183 /*--- Structure declarations ---*/
184 /*------------------------------------------------------------*/
186 typedef struct _Context Context
;
187 typedef struct _CC CC
;
188 typedef struct _BB BB
;
189 typedef struct _BBCC BBCC
;
190 typedef struct _jCC jCC
;
191 typedef struct _fCC fCC
;
192 typedef struct _fn_node fn_node
;
193 typedef struct _file_node file_node
;
194 typedef struct _obj_node obj_node
;
195 typedef struct _fn_config fn_config
;
196 typedef struct _call_entry call_entry
;
197 typedef struct _thread_info thread_info
;
199 /* Costs of event sets. Aliases to arrays of 64-bit values */
200 typedef ULong
* SimCost
; /* All events the simulator can produce */
201 typedef ULong
* UserCost
;
202 typedef ULong
* FullCost
; /* Simulator + User */
205 /* The types of control flow changes that can happen between
206 * execution of two BBs in a thread.
209 jk_None
= 0, /* no explicit change by a guest instruction */
210 jk_Jump
, /* regular jump */
213 jk_CondJump
/* conditional jump taken (only used as jCC type) */
217 /* JmpCall cost center
218 * for subroutine call (from->bb->jmp_addr => to->bb->addr)
220 * Each BB has at most one CALL instruction. The list of JCC from
221 * this call is a pointer to the list head (stored in BBCC), and
222 * <next_from> in the JCC struct.
224 * For fast lookup, JCCs are reachable with a hash table, keyed by
225 * the (from_bbcc,to) pair. <next_hash> is used for the JCC chain
226 * of one hash table entry.
228 * Cost <sum> holds event counts for already returned executions.
229 * <last> are the event counters at last enter of the subroutine.
230 * <sum> is updated on returning from the subroutine by
231 * adding the diff of <last> and current event counters to <sum>.
233 * After updating, <last> is set to current event counters. Thus,
234 * events are not counted twice for recursive calls (TODO: True?)
238 ClgJumpKind jmpkind
; /* jk_Call, jk_Jump, jk_CondJump */
239 jCC
* next_hash
; /* for hash entry chain */
240 jCC
* next_from
; /* next JCC from a BBCC */
241 BBCC
*from
, *to
; /* call arc from/to this BBCC */
242 UInt jmp
; /* jump no. in source */
244 ULong call_counter
; /* no wraparound with 64 bit */
246 FullCost cost
; /* simulator + user counters */
251 * Info for one instruction of a basic block.
253 typedef struct _InstrInfo InstrInfo
;
264 * Info for a side exit in a BB
266 typedef struct _CJmpInfo CJmpInfo
;
268 UInt instr
; /* instruction index for BB.instr array */
269 ClgJumpKind jmpkind
; /* jump kind when leaving BB at this side exit */
274 * An instrumented basic block (BB).
276 * BBs are put into a resizable hash to allow for fast detection if a
277 * BB is to be retranslated but cost info is already available.
278 * The key for a BB is a (object, offset) tupel making it independent
279 * from possibly multiple mappings of the same ELF object.
281 * At the beginning of each instrumented BB,
282 * a call to setup_bbcc(), specifying a pointer to the
283 * according BB structure, is added.
285 * As cost of a BB has to be distinguished depending on the context,
286 * multiple cost centers for one BB (struct BBCC) exist and the according
287 * BBCC is set by setup_bbcc.
290 obj_node
* obj
; /* ELF object of BB */
291 PtrdiffT offset
; /* offset of BB in ELF object file */
292 BB
* next
; /* chaining for a hash entry */
294 VgSectKind sect_kind
; /* section of this BB, e.g. PLT */
297 /* filled by CLG_(get_fn_node) if debug info is available */
298 fn_node
* fn
; /* debug info for this BB */
300 Bool is_entry
; /* True if this BB is a function entry */
302 BBCC
* bbcc_list
; /* BBCCs for same BB (see next_bbcc in BBCC) */
303 BBCC
* last_bbcc
; /* Temporary: Cached for faster access (LRU) */
305 /* filled by CLG_(instrument) if not seen before */
306 UInt cjmp_count
; /* number of side exits */
307 CJmpInfo
* jmp
; /* array of info for condition jumps,
308 * allocated directly after this struct */
309 Bool cjmp_inverted
; /* is last side exit actually fall through? */
313 InstrInfo instr
[0]; /* info on instruction sizes and costs */
321 * Basic blocks are always executed in the scope of a context.
322 * A function context is a list of function nodes representing
323 * the call chain to the current context: I.e. fn[0] is the
324 * function we are currently in, fn[1] has called fn[0], and so on.
325 * Recursion levels are used for fn[0].
327 * To get a unique number for a full execution context, use
328 * rec_index = min(<fn->rec_separation>,<active>) - 1;
329 * unique_no = <number> + rec_index
331 * For each Context, recursion index and BB, there can be a BBCC.
334 UInt size
; // number of function dependencies
335 UInt base_number
; // for context compression & dump array
336 Context
* next
; // entry chaining for hash
337 UWord hash
; // for faster lookup...
343 * Cost info for a side exits from a BB
345 typedef struct _JmpData JmpData
;
347 ULong ecounter
; /* number of times the BB was left at this exit */
348 jCC
* jcc_list
; /* JCCs used for this exit */
353 * Basic Block Cost Center
355 * On demand, multiple BBCCs will be created for the same BB
356 * dependent on command line options and:
357 * - current function (it's possible that a BB is executed in the
358 * context of different functions, e.g. in manual assembler/PLT)
359 * - current thread ID
360 * - position where current function is called from
361 * - recursion level of current function
363 * The cost centres for the instructions of a basic block are
364 * stored in a contiguous array.
365 * They are distinguishable by their tag field.
368 BB
* bb
; /* BB for this cost center */
370 Context
* cxt
; /* execution context of this BBCC */
371 ThreadId tid
; /* only for assertion check purpose */
372 UInt rec_index
; /* Recursion index in rec->bbcc for this bbcc */
373 BBCC
** rec_array
; /* Variable sized array of pointers to
374 * recursion BBCCs. Shared. */
375 ULong ret_counter
; /* how often returned from jccs of this bbcc;
376 * used to check if a dump for this BBCC is needed */
378 BBCC
* next_bbcc
; /* Chain of BBCCs for same BB */
379 BBCC
* lru_next_bbcc
; /* BBCC executed next the last time */
381 jCC
* lru_from_jcc
; /* Temporary: Cached for faster access (LRU) */
382 jCC
* lru_to_jcc
; /* Temporary: Cached for faster access (LRU) */
383 FullCost skipped
; /* cost for skipped functions called from
384 * jmp_addr. Allocated lazy */
386 BBCC
* next
; /* entry chain in hash */
387 ULong
* cost
; /* start of 64bit costs for this BBCC */
388 ULong ecounter_sum
; /* execution counter for first instruction of BB */
393 /* the <number> of fn_node, file_node and obj_node are for compressed dumping
394 * and a index into the dump boolean table and fn_info_table
400 Context
* last_cxt
; /* LRU info */
401 Context
* pure_cxt
; /* the context with only the function itself */
402 file_node
* file
; /* reverse mapping for 2nd hash */
408 Bool toggle_collect
:1;
410 Bool pop_on_jump
: 1;
417 Int separate_callers
;
418 Int separate_recursions
;
420 Int verbosity
; /* Stores old verbosity level while in function */
424 /* Quite arbitrary fixed hash sizes */
426 #define N_OBJ_ENTRIES 47
427 #define N_FILE_ENTRIES 53
428 #define N_FN_ENTRIES 87
432 fn_node
* fns
[N_FN_ENTRIES
];
438 /* If an object is dlopened multiple times, we hope that <name> is unique;
439 * <start> and <offset> can change with each dlopen, and <start> is
440 * zero when object is unmapped (possible at dump time).
446 Addr start
; /* Start address of text segment mapping */
447 SizeT size
; /* Length of mapping */
448 PtrdiffT offset
; /* Offset between symbol address and file offset */
450 file_node
* files
[N_FILE_ENTRIES
];
455 /* an entry in the callstack
457 * <nonskipped> is 0 if the function called is not skipped (usual case).
458 * Otherwise, it is the last non-skipped BBCC. This one gets all
459 * the calls to non-skipped functions and all costs in skipped
463 jCC
* jcc
; /* jCC for this call */
464 FullCost enter_cost
; /* cost event counters at entering frame */
465 Addr sp
; /* stack pointer directly after call */
466 Addr ret_addr
; /* address to which to return to
467 * is 0 on a simulated call */
468 BBCC
* nonskipped
; /* see above */
469 Context
* cxt
; /* context before call */
470 Int fn_sp
; /* function stack index before call */
475 * Execution state of main thread or a running signal handler in
476 * a thread while interrupted by another signal handler.
477 * As there's no scheduling among running signal handlers of one thread,
478 * we only need a subset of a full thread state:
481 * - last BB, last jump kind, last nonskipped BB
482 * - callstack pointer for sanity checking and correct unwinding
485 typedef struct _exec_state exec_state
;
488 /* the signum of the handler, 0 for main thread context
492 /* the old call stack pointer at entering the signal handler */
499 /* number of conditional jumps passed in last BB */
501 BBCC
* bbcc
; /* last BB executed */
504 Int call_stack_bottom
; /* Index into fn_stack */
507 /* Global state structures */
508 typedef struct _bb_hash bb_hash
;
514 typedef struct _cxt_hash cxt_hash
;
520 /* Thread specific state structures, i.e. parts of a thread state.
521 * There are variables for the current state of each part,
522 * on which a thread state is copied at thread switch.
524 typedef struct _bbcc_hash bbcc_hash
;
530 typedef struct _jcc_hash jcc_hash
;
537 typedef struct _fn_array fn_array
;
543 typedef struct _call_stack call_stack
;
550 typedef struct _fn_stack fn_stack
;
553 fn_node
**bottom
, **top
;
556 /* The maximum number of simultaneous running signal handlers per thread.
557 * This is the number of execution states storable in a thread.
559 #define MAX_SIGHANDLERS 10
561 typedef struct _exec_stack exec_stack
;
563 Int sp
; /* > 0 if a handler is running */
564 exec_state
* entry
[MAX_SIGHANDLERS
];
569 * This structure stores thread specific info while a thread is *not*
570 * running. See function switch_thread() for save/restore on thread switch.
572 * If --separate-threads=no, BBCCs and JCCs can be shared by all threads, i.e.
573 * only structures of thread 1 are used.
574 * This involves variables fn_info_table, bbcc_table and jcc_table.
576 struct _thread_info
{
579 fn_stack fns
; /* function stack */
580 call_stack calls
; /* context call arc stack */
581 exec_stack states
; /* execution states interrupted by signals */
583 /* dump statistics */
584 FullCost lastdump_cost
; /* Cost at last dump */
585 FullCost sighandler_cost
;
587 /* thread specific data structure containers */
593 /* Structs used for dumping */
595 /* Address position inside of a BBCC:
597 * - the address offset from the BB start address
598 * - file/line from debug info for that address (can change inside a BB)
600 typedef struct _AddrPos AddrPos
;
608 /* a simulator cost entity that can be written out in one line */
609 typedef struct _AddrCost AddrCost
;
615 /* A function in an execution context */
616 typedef struct _FnPos FnPos
;
626 /*------------------------------------------------------------*/
627 /*--- Cache simulator interface ---*/
628 /*------------------------------------------------------------*/
632 void (*print_opts
)(void);
633 Bool (*parse_opt
)(const HChar
* arg
);
634 void (*post_clo_init
)(void);
636 void (*dump_desc
)(VgFile
*fp
);
637 void (*printstat
)(Int
,Int
,Int
);
638 void (*add_icost
)(SimCost
, BBCC
*, InstrInfo
*, ULong
);
639 void (*finish
)(void);
641 void (*log_1I0D
)(InstrInfo
*) VG_REGPARM(1);
642 void (*log_2I0D
)(InstrInfo
*, InstrInfo
*) VG_REGPARM(2);
643 void (*log_3I0D
)(InstrInfo
*, InstrInfo
*, InstrInfo
*) VG_REGPARM(3);
645 void (*log_1I1Dr
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
646 void (*log_1I1Dw
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
648 void (*log_0I1Dr
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
649 void (*log_0I1Dw
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
651 // function names of helpers (for debugging generated code)
652 const HChar
*log_1I0D_name
, *log_2I0D_name
, *log_3I0D_name
;
653 const HChar
*log_1I1Dr_name
, *log_1I1Dw_name
;
654 const HChar
*log_0I1Dr_name
, *log_0I1Dw_name
;
669 EventSet
*base
, *full
;
672 #define fullOffset(group) (CLG_(sets).full->offset[group])
675 /*------------------------------------------------------------*/
676 /*--- Functions ---*/
677 /*------------------------------------------------------------*/
681 void CLG_(set_clo_defaults
)(void);
682 void CLG_(update_fn_config
)(fn_node
*);
683 Bool
CLG_(process_cmd_line_option
)(const HChar
*);
684 void CLG_(print_usage
)(void);
685 void CLG_(print_debug_usage
)(void);
688 void CLG_(init_eventsets
)(void);
691 Bool
CLG_(get_debug_info
)(Addr
, const HChar
**dirname
,
692 const HChar
**filename
,
693 const HChar
**fn_name
, UInt
*, DebugInfo
**);
694 void CLG_(collectBlockInfo
)(IRSB
* bbIn
, UInt
*, UInt
*, Bool
*);
695 void CLG_(set_instrument_state
)(const HChar
*,Bool
);
696 void CLG_(dump_profile
)(const HChar
* trigger
,Bool only_current_thread
);
697 void CLG_(zero_all_cost
)(Bool only_current_thread
);
698 Int
CLG_(get_dump_counter
)(void);
699 void CLG_(fini
)(Int exitcode
);
702 void CLG_(init_bb_hash
)(void);
703 bb_hash
* CLG_(get_bb_hash
)(void);
704 BB
* CLG_(get_bb
)(Addr addr
, IRSB
* bb_in
, Bool
*seen_before
);
705 void CLG_(delete_bb
)(Addr addr
);
707 static __inline__ Addr
bb_addr(BB
* bb
)
708 { return bb
->offset
+ bb
->obj
->offset
; }
709 static __inline__ Addr
bb_jmpaddr(BB
* bb
)
710 { UInt off
= (bb
->instr_count
> 0) ? bb
->instr
[bb
->instr_count
-1].instr_offset
: 0;
711 return off
+ bb
->offset
+ bb
->obj
->offset
; }
714 void CLG_(init_fn_array
)(fn_array
*);
715 void CLG_(copy_current_fn_array
)(fn_array
* dst
);
716 fn_array
* CLG_(get_current_fn_array
)(void);
717 void CLG_(set_current_fn_array
)(fn_array
*);
718 UInt
* CLG_(get_fn_entry
)(Int n
);
720 void CLG_(init_obj_table
)(void);
721 obj_node
* CLG_(get_obj_node
)(DebugInfo
* si
);
722 file_node
* CLG_(get_file_node
)(obj_node
*, const HChar
*dirname
,
723 const HChar
* filename
);
724 fn_node
* CLG_(get_fn_node
)(BB
* bb
);
727 void CLG_(init_bbcc_hash
)(bbcc_hash
* bbccs
);
728 void CLG_(copy_current_bbcc_hash
)(bbcc_hash
* dst
);
729 bbcc_hash
* CLG_(get_current_bbcc_hash
)(void);
730 void CLG_(set_current_bbcc_hash
)(bbcc_hash
*);
731 void CLG_(forall_bbccs
)(void (*func
)(BBCC
*));
732 void CLG_(zero_bbcc
)(BBCC
* bbcc
);
733 BBCC
* CLG_(get_bbcc
)(BB
* bb
);
734 BBCC
* CLG_(clone_bbcc
)(BBCC
* orig
, Context
* cxt
, Int rec_index
);
735 void CLG_(setup_bbcc
)(BB
* bb
) VG_REGPARM(1);
739 void CLG_(init_jcc_hash
)(jcc_hash
*);
740 void CLG_(copy_current_jcc_hash
)(jcc_hash
* dst
);
741 void CLG_(set_current_jcc_hash
)(jcc_hash
*);
742 jCC
* CLG_(get_jcc
)(BBCC
* from
, UInt
, BBCC
* to
);
744 /* from callstack.c */
745 void CLG_(init_call_stack
)(call_stack
*);
746 void CLG_(copy_current_call_stack
)(call_stack
* dst
);
747 void CLG_(set_current_call_stack
)(call_stack
*);
748 call_entry
* CLG_(get_call_entry
)(Int n
);
750 void CLG_(push_call_stack
)(BBCC
* from
, UInt jmp
, BBCC
* to
, Addr sp
, Bool skip
);
751 void CLG_(pop_call_stack
)(void);
752 Int
CLG_(unwind_call_stack
)(Addr sp
, Int
);
755 void CLG_(init_fn_stack
)(fn_stack
*);
756 void CLG_(copy_current_fn_stack
)(fn_stack
*);
757 void CLG_(set_current_fn_stack
)(fn_stack
*);
759 void CLG_(init_cxt_table
)(void);
760 Context
* CLG_(get_cxt
)(fn_node
** fn
);
761 void CLG_(push_cxt
)(fn_node
* fn
);
764 void CLG_(init_threads
)(void);
765 thread_info
** CLG_(get_threads
)(void);
766 thread_info
* CLG_(get_current_thread
)(void);
767 void CLG_(switch_thread
)(ThreadId tid
);
768 void CLG_(forall_threads
)(void (*func
)(thread_info
*));
769 void CLG_(run_thread
)(ThreadId tid
);
771 void CLG_(init_exec_state
)(exec_state
* es
);
772 void CLG_(init_exec_stack
)(exec_stack
*);
773 void CLG_(copy_current_exec_stack
)(exec_stack
*);
774 void CLG_(set_current_exec_stack
)(exec_stack
*);
775 void CLG_(pre_signal
)(ThreadId tid
, Int sigNum
, Bool alt_stack
);
776 void CLG_(post_signal
)(ThreadId tid
, Int sigNum
);
777 void CLG_(run_post_signal_on_call_stack_bottom
)(void);
780 void CLG_(init_dumps
)(void);
782 /*------------------------------------------------------------*/
783 /*--- Exported global variables ---*/
784 /*------------------------------------------------------------*/
786 extern CommandLineOptions
CLG_(clo
);
787 extern Statistics
CLG_(stat
);
788 extern EventMapping
* CLG_(dumpmap
);
790 /* Function active counter array, indexed by function number */
791 extern UInt
* CLG_(fn_active_array
);
792 extern Bool
CLG_(instrument_state
);
793 /* min of L1 and LL cache line sizes */
794 extern Int
CLG_(min_line_size
);
795 extern call_stack
CLG_(current_call_stack
);
796 extern fn_stack
CLG_(current_fn_stack
);
797 extern exec_state
CLG_(current_state
);
798 extern ThreadId
CLG_(current_tid
);
799 extern FullCost
CLG_(total_cost
);
800 extern struct cachesim_if
CLG_(cachesim
);
801 extern struct event_sets
CLG_(sets
);
803 // set by setup_bbcc at start of every BB, and needed by log_* helpers
804 extern Addr
CLG_(bb_base
);
805 extern ULong
* CLG_(cost_base
);
808 /*------------------------------------------------------------*/
809 /*--- Debug output ---*/
810 /*------------------------------------------------------------*/
814 #define CLG_DEBUGIF(x) \
815 if (UNLIKELY( (CLG_(clo).verbose >x) && \
816 (CLG_(stat).bb_executions >= CLG_(clo).verbose_start)))
818 #define CLG_DEBUG(x,format,args...) \
820 CLG_(print_bbno)(); \
821 VG_(printf)(format,##args); \
824 #define CLG_ASSERT(cond) \
825 if (UNLIKELY(!(cond))) { \
826 CLG_(print_context)(); \
827 CLG_(print_bbno)(); \
832 #define CLG_DEBUGIF(x) if (0)
833 #define CLG_DEBUG(x...) {}
834 #define CLG_ASSERT(cond) tl_assert(cond);
838 void CLG_(print_bbno
)(void);
839 void CLG_(print_context
)(void);
840 void CLG_(print_jcc
)(int s
, jCC
* jcc
);
841 void CLG_(print_bbcc
)(int s
, BBCC
* bbcc
);
842 void CLG_(print_bbcc_fn
)(BBCC
* bbcc
);
843 void CLG_(print_execstate
)(int s
, exec_state
* es
);
844 void CLG_(print_eventset
)(int s
, EventSet
* es
);
845 void CLG_(print_cost
)(int s
, EventSet
*, ULong
* cost
);
846 void CLG_(print_bb
)(int s
, BB
* bb
);
847 void CLG_(print_bbcc_cost
)(int s
, BBCC
*);
848 void CLG_(print_cxt
)(int s
, Context
* cxt
, int rec_index
);
849 void CLG_(print_short_jcc
)(jCC
* jcc
);
850 void CLG_(print_stackentry
)(int s
, int sp
);
851 void CLG_(print_addr
)(Addr addr
);
852 void CLG_(print_addr_ln
)(Addr addr
);
854 void* CLG_(malloc
)(const HChar
* cc
, UWord s
, const HChar
* f
);
855 void* CLG_(free
)(void* p
, const HChar
* f
);
857 #define CLG_MALLOC(_cc,x) CLG_(malloc)((_cc),x,__FUNCTION__)
858 #define CLG_FREE(p) CLG_(free)(p,__FUNCTION__)
860 #define CLG_MALLOC(_cc,x) VG_(malloc)((_cc),x)
861 #define CLG_FREE(p) VG_(free)(p)
864 #endif /* CLG_GLOBAL */