1 /*--------------------------------------------------------------------*/
2 /*--- Callgrind data structures, functions. global.h ---*/
3 /*--------------------------------------------------------------------*/
6 This file is part of Valgrind, a dynamic binary instrumentation
9 Copyright (C) 2004-2014 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, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 The GNU General Public License is contained in the file COPYING.
33 #include "pub_tool_basics.h"
34 #include "pub_tool_vki.h"
35 #include "pub_tool_debuginfo.h"
36 #include "pub_tool_libcbase.h"
37 #include "pub_tool_libcassert.h"
38 #include "pub_tool_libcfile.h"
39 #include "pub_tool_libcprint.h"
40 #include "pub_tool_libcproc.h"
41 #include "pub_tool_machine.h"
42 #include "pub_tool_mallocfree.h"
43 #include "pub_tool_options.h"
44 #include "pub_tool_tooliface.h"
45 #include "pub_tool_xarray.h"
46 #include "pub_tool_clientstate.h"
47 #include "pub_tool_machine.h" // VG_(fnptr_to_fnentry)
49 #include "events.h" // defines CLG_ macro
53 /*------------------------------------------------------------*/
54 /*--- Callgrind compile options --- */
55 /*------------------------------------------------------------*/
57 /* Enable debug output */
58 #define CLG_ENABLE_DEBUG 1
60 /* Enable experimental features? */
61 #define CLG_EXPERIMENTAL 0
63 /* Syscall Timing in microseconds?
64 * (define to 0 if you get compile errors) */
65 #define CLG_MICROSYSTIME 0
69 /*------------------------------------------------------------*/
70 /*--- Command line options ---*/
71 /*------------------------------------------------------------*/
73 #define DEFAULT_OUTFORMAT "callgrind.out.%p"
75 typedef struct _CommandLineOptions CommandLineOptions
;
76 struct _CommandLineOptions
{
78 /* Dump format options */
79 const HChar
* out_format
; /* Format string for callgrind output file name */
80 Bool combine_dumps
; /* Dump trace parts into same file? */
81 Bool compress_strings
;
85 Bool compress_mangled
;
89 Bool dump_bbs
; /* Dump basic block information? */
91 /* Dump generation options */
92 ULong dump_every_bb
; /* Dump every xxx BBs. */
94 /* Collection options */
95 Bool separate_threads
; /* Separate threads in dump? */
96 Int separate_callers
; /* Separate dependent on how many callers? */
97 Int separate_recursions
; /* Max level of recursions to separate */
98 Bool skip_plt
; /* Skip functions in PLT section? */
99 Bool skip_direct_recursion
; /* Increment direct recursions the level? */
101 Bool collect_atstart
; /* Start in collecting state ? */
102 Bool collect_jumps
; /* Collect (cond.) jumps in functions ? */
104 Bool collect_alloc
; /* Collect size of allocated memory */
105 Bool collect_systime
; /* Collect time for system calls */
107 Bool collect_bus
; /* Collect global bus events */
109 /* Instrument options */
110 Bool instrument_atstart
; /* Instrument at start? */
111 Bool simulate_cache
; /* Call into cache simulator ? */
112 Bool simulate_branch
; /* Call into branch prediction simulator ? */
114 /* Call graph generation */
115 Bool pop_on_jump
; /* Handle a jump between functions as ret+call */
123 /*------------------------------------------------------------*/
124 /*--- Constants ---*/
125 /*------------------------------------------------------------*/
127 /* Minimum cache line size allowed */
128 #define MIN_LINE_SIZE 16
131 /*------------------------------------------------------------*/
132 /*--- Statistics ---*/
133 /*------------------------------------------------------------*/
135 typedef struct _Statistics Statistics
;
140 ULong rec_call_counter
;
145 Int bb_retranslations
;
150 Int distinct_contexts
;
158 Int bbcc_hash_resizes
;
159 Int jcc_hash_resizes
;
160 Int cxt_hash_resizes
;
161 Int fn_array_resizes
;
162 Int call_stack_resizes
;
163 Int fn_stack_resizes
;
166 Int file_line_debug_BBs
;
167 Int fn_name_debug_BBs
;
176 /*------------------------------------------------------------*/
177 /*--- Structure declarations ---*/
178 /*------------------------------------------------------------*/
180 typedef struct _Context Context
;
181 typedef struct _CC CC
;
182 typedef struct _BB BB
;
183 typedef struct _BBCC BBCC
;
184 typedef struct _jCC jCC
;
185 typedef struct _fCC fCC
;
186 typedef struct _fn_node fn_node
;
187 typedef struct _file_node file_node
;
188 typedef struct _obj_node obj_node
;
189 typedef struct _fn_config fn_config
;
190 typedef struct _call_entry call_entry
;
191 typedef struct _thread_info thread_info
;
193 /* Costs of event sets. Aliases to arrays of 64-bit values */
194 typedef ULong
* SimCost
; /* All events the simulator can produce */
195 typedef ULong
* UserCost
;
196 typedef ULong
* FullCost
; /* Simulator + User */
199 /* The types of control flow changes that can happen between
200 * execution of two BBs in a thread.
203 jk_None
= 0, /* no explicit change by a guest instruction */
204 jk_Jump
, /* regular jump */
207 jk_CondJump
/* conditional jump taken (only used as jCC type) */
211 /* JmpCall cost center
212 * for subroutine call (from->bb->jmp_addr => to->bb->addr)
214 * Each BB has at most one CALL instruction. The list of JCC from
215 * this call is a pointer to the list head (stored in BBCC), and
216 * <next_from> in the JCC struct.
218 * For fast lookup, JCCs are reachable with a hash table, keyed by
219 * the (from_bbcc,to) pair. <next_hash> is used for the JCC chain
220 * of one hash table entry.
222 * Cost <sum> holds event counts for already returned executions.
223 * <last> are the event counters at last enter of the subroutine.
224 * <sum> is updated on returning from the subroutine by
225 * adding the diff of <last> and current event counters to <sum>.
227 * After updating, <last> is set to current event counters. Thus,
228 * events are not counted twice for recursive calls (TODO: True?)
232 ClgJumpKind jmpkind
; /* jk_Call, jk_Jump, jk_CondJump */
233 jCC
* next_hash
; /* for hash entry chain */
234 jCC
* next_from
; /* next JCC from a BBCC */
235 BBCC
*from
, *to
; /* call arc from/to this BBCC */
236 UInt jmp
; /* jump no. in source */
238 ULong call_counter
; /* no wraparound with 64 bit */
240 FullCost cost
; /* simulator + user counters */
245 * Info for one instruction of a basic block.
247 typedef struct _InstrInfo InstrInfo
;
258 * Info for a side exit in a BB
260 typedef struct _CJmpInfo CJmpInfo
;
262 UInt instr
; /* instruction index for BB.instr array */
263 ClgJumpKind jmpkind
; /* jump kind when leaving BB at this side exit */
268 * An instrumented basic block (BB).
270 * BBs are put into a resizable hash to allow for fast detection if a
271 * BB is to be retranslated but cost info is already available.
272 * The key for a BB is a (object, offset) tupel making it independent
273 * from possibly multiple mappings of the same ELF object.
275 * At the beginning of each instrumented BB,
276 * a call to setup_bbcc(), specifying a pointer to the
277 * according BB structure, is added.
279 * As cost of a BB has to be distinguished depending on the context,
280 * multiple cost centers for one BB (struct BBCC) exist and the according
281 * BBCC is set by setup_bbcc.
284 obj_node
* obj
; /* ELF object of BB */
285 PtrdiffT offset
; /* offset of BB in ELF object file */
286 BB
* next
; /* chaining for a hash entry */
288 VgSectKind sect_kind
; /* section of this BB, e.g. PLT */
291 /* filled by CLG_(get_fn_node) if debug info is available */
292 fn_node
* fn
; /* debug info for this BB */
294 Bool is_entry
; /* True if this BB is a function entry */
296 BBCC
* bbcc_list
; /* BBCCs for same BB (see next_bbcc in BBCC) */
297 BBCC
* last_bbcc
; /* Temporary: Cached for faster access (LRU) */
299 /* filled by CLG_(instrument) if not seen before */
300 UInt cjmp_count
; /* number of side exits */
301 CJmpInfo
* jmp
; /* array of info for condition jumps,
302 * allocated directly after this struct */
303 Bool cjmp_inverted
; /* is last side exit actually fall through? */
307 InstrInfo instr
[0]; /* info on instruction sizes and costs */
315 * Basic blocks are always executed in the scope of a context.
316 * A function context is a list of function nodes representing
317 * the call chain to the current context: I.e. fn[0] is the
318 * function we are currently in, fn[1] has called fn[0], and so on.
319 * Recursion levels are used for fn[0].
321 * To get a unique number for a full execution context, use
322 * rec_index = min(<fn->rec_separation>,<active>) - 1;
323 * unique_no = <number> + rec_index
325 * For each Context, recursion index and BB, there can be a BBCC.
328 UInt size
; // number of function dependencies
329 UInt base_number
; // for context compression & dump array
330 Context
* next
; // entry chaining for hash
331 UWord hash
; // for faster lookup...
337 * Cost info for a side exits from a BB
339 typedef struct _JmpData JmpData
;
341 ULong ecounter
; /* number of times the BB was left at this exit */
342 jCC
* jcc_list
; /* JCCs used for this exit */
347 * Basic Block Cost Center
349 * On demand, multiple BBCCs will be created for the same BB
350 * dependend on command line options and:
351 * - current function (it's possible that a BB is executed in the
352 * context of different functions, e.g. in manual assembler/PLT)
353 * - current thread ID
354 * - position where current function is called from
355 * - recursion level of current function
357 * The cost centres for the instructions of a basic block are
358 * stored in a contiguous array.
359 * They are distinguishable by their tag field.
362 BB
* bb
; /* BB for this cost center */
364 Context
* cxt
; /* execution context of this BBCC */
365 ThreadId tid
; /* only for assertion check purpose */
366 UInt rec_index
; /* Recursion index in rec->bbcc for this bbcc */
367 BBCC
** rec_array
; /* Variable sized array of pointers to
368 * recursion BBCCs. Shared. */
369 ULong ret_counter
; /* how often returned from jccs of this bbcc;
370 * used to check if a dump for this BBCC is needed */
372 BBCC
* next_bbcc
; /* Chain of BBCCs for same BB */
373 BBCC
* lru_next_bbcc
; /* BBCC executed next the last time */
375 jCC
* lru_from_jcc
; /* Temporary: Cached for faster access (LRU) */
376 jCC
* lru_to_jcc
; /* Temporary: Cached for faster access (LRU) */
377 FullCost skipped
; /* cost for skipped functions called from
378 * jmp_addr. Allocated lazy */
380 BBCC
* next
; /* entry chain in hash */
381 ULong
* cost
; /* start of 64bit costs for this BBCC */
382 ULong ecounter_sum
; /* execution counter for first instruction of BB */
387 /* the <number> of fn_node, file_node and obj_node are for compressed dumping
388 * and a index into the dump boolean table and fn_info_table
394 Context
* last_cxt
; /* LRU info */
395 Context
* pure_cxt
; /* the context with only the function itself */
396 file_node
* file
; /* reverse mapping for 2nd hash */
402 Bool toggle_collect
:1;
404 Bool pop_on_jump
: 1;
411 Int separate_callers
;
412 Int separate_recursions
;
414 Int verbosity
; /* Stores old verbosity level while in function */
418 /* Quite arbitrary fixed hash sizes */
420 #define N_OBJ_ENTRIES 47
421 #define N_FILE_ENTRIES 53
422 #define N_FN_ENTRIES 87
426 fn_node
* fns
[N_FN_ENTRIES
];
432 /* If an object is dlopened multiple times, we hope that <name> is unique;
433 * <start> and <offset> can change with each dlopen, and <start> is
434 * zero when object is unmapped (possible at dump time).
440 Addr start
; /* Start address of text segment mapping */
441 SizeT size
; /* Length of mapping */
442 PtrdiffT offset
; /* Offset between symbol address and file offset */
444 file_node
* files
[N_FILE_ENTRIES
];
449 /* an entry in the callstack
451 * <nonskipped> is 0 if the function called is not skipped (usual case).
452 * Otherwise, it is the last non-skipped BBCC. This one gets all
453 * the calls to non-skipped functions and all costs in skipped
457 jCC
* jcc
; /* jCC for this call */
458 FullCost enter_cost
; /* cost event counters at entering frame */
459 Addr sp
; /* stack pointer directly after call */
460 Addr ret_addr
; /* address to which to return to
461 * is 0 on a simulated call */
462 BBCC
* nonskipped
; /* see above */
463 Context
* cxt
; /* context before call */
464 Int fn_sp
; /* function stack index before call */
469 * Execution state of main thread or a running signal handler in
470 * a thread while interrupted by another signal handler.
471 * As there's no scheduling among running signal handlers of one thread,
472 * we only need a subset of a full thread state:
475 * - last BB, last jump kind, last nonskipped BB
476 * - callstack pointer for sanity checking and correct unwinding
479 typedef struct _exec_state exec_state
;
482 /* the signum of the handler, 0 for main thread context
486 /* the old call stack pointer at entering the signal handler */
493 /* number of conditional jumps passed in last BB */
495 BBCC
* bbcc
; /* last BB executed */
498 Int call_stack_bottom
; /* Index into fn_stack */
501 /* Global state structures */
502 typedef struct _bb_hash bb_hash
;
508 typedef struct _cxt_hash cxt_hash
;
514 /* Thread specific state structures, i.e. parts of a thread state.
515 * There are variables for the current state of each part,
516 * on which a thread state is copied at thread switch.
518 typedef struct _bbcc_hash bbcc_hash
;
524 typedef struct _jcc_hash jcc_hash
;
531 typedef struct _fn_array fn_array
;
537 typedef struct _call_stack call_stack
;
544 typedef struct _fn_stack fn_stack
;
547 fn_node
**bottom
, **top
;
550 /* The maximum number of simultaneous running signal handlers per thread.
551 * This is the number of execution states storable in a thread.
553 #define MAX_SIGHANDLERS 10
555 typedef struct _exec_stack exec_stack
;
557 Int sp
; /* > 0 if a handler is running */
558 exec_state
* entry
[MAX_SIGHANDLERS
];
563 * This structure stores thread specific info while a thread is *not*
564 * running. See function switch_thread() for save/restore on thread switch.
566 * If --separate-threads=no, BBCCs and JCCs can be shared by all threads, i.e.
567 * only structures of thread 1 are used.
568 * This involves variables fn_info_table, bbcc_table and jcc_table.
570 struct _thread_info
{
573 fn_stack fns
; /* function stack */
574 call_stack calls
; /* context call arc stack */
575 exec_stack states
; /* execution states interrupted by signals */
577 /* dump statistics */
578 FullCost lastdump_cost
; /* Cost at last dump */
579 FullCost sighandler_cost
;
581 /* thread specific data structure containers */
587 /* Structs used for dumping */
589 /* Address position inside of a BBCC:
591 * - the address offset from the BB start address
592 * - file/line from debug info for that address (can change inside a BB)
594 typedef struct _AddrPos AddrPos
;
602 /* a simulator cost entity that can be written out in one line */
603 typedef struct _AddrCost AddrCost
;
609 /* A function in an execution context */
610 typedef struct _FnPos FnPos
;
620 /*------------------------------------------------------------*/
621 /*--- Cache simulator interface ---*/
622 /*------------------------------------------------------------*/
626 void (*print_opts
)(void);
627 Bool (*parse_opt
)(const HChar
* arg
);
628 void (*post_clo_init
)(void);
630 void (*dump_desc
)(VgFile
*fp
);
631 void (*printstat
)(Int
,Int
,Int
);
632 void (*add_icost
)(SimCost
, BBCC
*, InstrInfo
*, ULong
);
633 void (*finish
)(void);
635 void (*log_1I0D
)(InstrInfo
*) VG_REGPARM(1);
636 void (*log_2I0D
)(InstrInfo
*, InstrInfo
*) VG_REGPARM(2);
637 void (*log_3I0D
)(InstrInfo
*, InstrInfo
*, InstrInfo
*) VG_REGPARM(3);
639 void (*log_1I1Dr
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
640 void (*log_1I1Dw
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
642 void (*log_0I1Dr
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
643 void (*log_0I1Dw
)(InstrInfo
*, Addr
, Word
) VG_REGPARM(3);
645 // function names of helpers (for debugging generated code)
646 const HChar
*log_1I0D_name
, *log_2I0D_name
, *log_3I0D_name
;
647 const HChar
*log_1I1Dr_name
, *log_1I1Dw_name
;
648 const HChar
*log_0I1Dr_name
, *log_0I1Dw_name
;
663 EventSet
*base
, *full
;
666 #define fullOffset(group) (CLG_(sets).full->offset[group])
669 /*------------------------------------------------------------*/
670 /*--- Functions ---*/
671 /*------------------------------------------------------------*/
675 void CLG_(set_clo_defaults
)(void);
676 void CLG_(update_fn_config
)(fn_node
*);
677 Bool
CLG_(process_cmd_line_option
)(const HChar
*);
678 void CLG_(print_usage
)(void);
679 void CLG_(print_debug_usage
)(void);
682 void CLG_(init_eventsets
)(void);
685 Bool
CLG_(get_debug_info
)(Addr
, const HChar
**dirname
,
686 const HChar
**filename
,
687 const HChar
**fn_name
, UInt
*, DebugInfo
**);
688 void CLG_(collectBlockInfo
)(IRSB
* bbIn
, UInt
*, UInt
*, Bool
*);
689 void CLG_(set_instrument_state
)(const HChar
*,Bool
);
690 void CLG_(dump_profile
)(const HChar
* trigger
,Bool only_current_thread
);
691 void CLG_(zero_all_cost
)(Bool only_current_thread
);
692 Int
CLG_(get_dump_counter
)(void);
693 void CLG_(fini
)(Int exitcode
);
696 void CLG_(init_bb_hash
)(void);
697 bb_hash
* CLG_(get_bb_hash
)(void);
698 BB
* CLG_(get_bb
)(Addr addr
, IRSB
* bb_in
, Bool
*seen_before
);
699 void CLG_(delete_bb
)(Addr addr
);
701 static __inline__ Addr
bb_addr(BB
* bb
)
702 { return bb
->offset
+ bb
->obj
->offset
; }
703 static __inline__ Addr
bb_jmpaddr(BB
* bb
)
704 { UInt off
= (bb
->instr_count
> 0) ? bb
->instr
[bb
->instr_count
-1].instr_offset
: 0;
705 return off
+ bb
->offset
+ bb
->obj
->offset
; }
708 void CLG_(init_fn_array
)(fn_array
*);
709 void CLG_(copy_current_fn_array
)(fn_array
* dst
);
710 fn_array
* CLG_(get_current_fn_array
)(void);
711 void CLG_(set_current_fn_array
)(fn_array
*);
712 UInt
* CLG_(get_fn_entry
)(Int n
);
714 void CLG_(init_obj_table
)(void);
715 obj_node
* CLG_(get_obj_node
)(DebugInfo
* si
);
716 file_node
* CLG_(get_file_node
)(obj_node
*, const HChar
*dirname
,
717 const HChar
* filename
);
718 fn_node
* CLG_(get_fn_node
)(BB
* bb
);
721 void CLG_(init_bbcc_hash
)(bbcc_hash
* bbccs
);
722 void CLG_(copy_current_bbcc_hash
)(bbcc_hash
* dst
);
723 bbcc_hash
* CLG_(get_current_bbcc_hash
)(void);
724 void CLG_(set_current_bbcc_hash
)(bbcc_hash
*);
725 void CLG_(forall_bbccs
)(void (*func
)(BBCC
*));
726 void CLG_(zero_bbcc
)(BBCC
* bbcc
);
727 BBCC
* CLG_(get_bbcc
)(BB
* bb
);
728 BBCC
* CLG_(clone_bbcc
)(BBCC
* orig
, Context
* cxt
, Int rec_index
);
729 void CLG_(setup_bbcc
)(BB
* bb
) VG_REGPARM(1);
733 void CLG_(init_jcc_hash
)(jcc_hash
*);
734 void CLG_(copy_current_jcc_hash
)(jcc_hash
* dst
);
735 void CLG_(set_current_jcc_hash
)(jcc_hash
*);
736 jCC
* CLG_(get_jcc
)(BBCC
* from
, UInt
, BBCC
* to
);
738 /* from callstack.c */
739 void CLG_(init_call_stack
)(call_stack
*);
740 void CLG_(copy_current_call_stack
)(call_stack
* dst
);
741 void CLG_(set_current_call_stack
)(call_stack
*);
742 call_entry
* CLG_(get_call_entry
)(Int n
);
744 void CLG_(push_call_stack
)(BBCC
* from
, UInt jmp
, BBCC
* to
, Addr sp
, Bool skip
);
745 void CLG_(pop_call_stack
)(void);
746 Int
CLG_(unwind_call_stack
)(Addr sp
, Int
);
749 void CLG_(init_fn_stack
)(fn_stack
*);
750 void CLG_(copy_current_fn_stack
)(fn_stack
*);
751 void CLG_(set_current_fn_stack
)(fn_stack
*);
753 void CLG_(init_cxt_table
)(void);
754 Context
* CLG_(get_cxt
)(fn_node
** fn
);
755 void CLG_(push_cxt
)(fn_node
* fn
);
758 void CLG_(init_threads
)(void);
759 thread_info
** CLG_(get_threads
)(void);
760 thread_info
* CLG_(get_current_thread
)(void);
761 void CLG_(switch_thread
)(ThreadId tid
);
762 void CLG_(forall_threads
)(void (*func
)(thread_info
*));
763 void CLG_(run_thread
)(ThreadId tid
);
765 void CLG_(init_exec_state
)(exec_state
* es
);
766 void CLG_(init_exec_stack
)(exec_stack
*);
767 void CLG_(copy_current_exec_stack
)(exec_stack
*);
768 void CLG_(set_current_exec_stack
)(exec_stack
*);
769 void CLG_(pre_signal
)(ThreadId tid
, Int sigNum
, Bool alt_stack
);
770 void CLG_(post_signal
)(ThreadId tid
, Int sigNum
);
771 void CLG_(run_post_signal_on_call_stack_bottom
)(void);
774 void CLG_(init_dumps
)(void);
776 /*------------------------------------------------------------*/
777 /*--- Exported global variables ---*/
778 /*------------------------------------------------------------*/
780 extern CommandLineOptions
CLG_(clo
);
781 extern Statistics
CLG_(stat
);
782 extern EventMapping
* CLG_(dumpmap
);
784 /* Function active counter array, indexed by function number */
785 extern UInt
* CLG_(fn_active_array
);
786 extern Bool
CLG_(instrument_state
);
787 /* min of L1 and LL cache line sizes */
788 extern Int
CLG_(min_line_size
);
789 extern call_stack
CLG_(current_call_stack
);
790 extern fn_stack
CLG_(current_fn_stack
);
791 extern exec_state
CLG_(current_state
);
792 extern ThreadId
CLG_(current_tid
);
793 extern FullCost
CLG_(total_cost
);
794 extern struct cachesim_if
CLG_(cachesim
);
795 extern struct event_sets
CLG_(sets
);
797 // set by setup_bbcc at start of every BB, and needed by log_* helpers
798 extern Addr
CLG_(bb_base
);
799 extern ULong
* CLG_(cost_base
);
802 /*------------------------------------------------------------*/
803 /*--- Debug output ---*/
804 /*------------------------------------------------------------*/
808 #define CLG_DEBUGIF(x) \
809 if (UNLIKELY( (CLG_(clo).verbose >x) && \
810 (CLG_(stat).bb_executions >= CLG_(clo).verbose_start)))
812 #define CLG_DEBUG(x,format,args...) \
814 CLG_(print_bbno)(); \
815 VG_(printf)(format,##args); \
818 #define CLG_ASSERT(cond) \
819 if (UNLIKELY(!(cond))) { \
820 CLG_(print_context)(); \
821 CLG_(print_bbno)(); \
826 #define CLG_DEBUGIF(x) if (0)
827 #define CLG_DEBUG(x...) {}
828 #define CLG_ASSERT(cond) tl_assert(cond);
832 void CLG_(print_bbno
)(void);
833 void CLG_(print_context
)(void);
834 void CLG_(print_jcc
)(int s
, jCC
* jcc
);
835 void CLG_(print_bbcc
)(int s
, BBCC
* bbcc
);
836 void CLG_(print_bbcc_fn
)(BBCC
* bbcc
);
837 void CLG_(print_execstate
)(int s
, exec_state
* es
);
838 void CLG_(print_eventset
)(int s
, EventSet
* es
);
839 void CLG_(print_cost
)(int s
, EventSet
*, ULong
* cost
);
840 void CLG_(print_bb
)(int s
, BB
* bb
);
841 void CLG_(print_bbcc_cost
)(int s
, BBCC
*);
842 void CLG_(print_cxt
)(int s
, Context
* cxt
, int rec_index
);
843 void CLG_(print_short_jcc
)(jCC
* jcc
);
844 void CLG_(print_stackentry
)(int s
, int sp
);
845 void CLG_(print_addr
)(Addr addr
);
846 void CLG_(print_addr_ln
)(Addr addr
);
848 void* CLG_(malloc
)(const HChar
* cc
, UWord s
, const HChar
* f
);
849 void* CLG_(free
)(void* p
, const HChar
* f
);
851 #define CLG_MALLOC(_cc,x) CLG_(malloc)((_cc),x,__FUNCTION__)
852 #define CLG_FREE(p) CLG_(free)(p,__FUNCTION__)
854 #define CLG_MALLOC(_cc,x) VG_(malloc)((_cc),x)
855 #define CLG_FREE(p) VG_(free)(p)
858 #endif /* CLG_GLOBAL */