- publishing free software manuals
Valgrind 3.3 - Advanced Debugging and Profiling for GNU/Linux applications
by J. Seward, N. Nethercote, J. Weidendorfer and the Valgrind Development Team
Paperback (6"x9"), 164 pages
ISBN 0954612051
RRP £12.95 ($19.95)

Get a printed copy>>>

13.1.6 Subposition Compression

If a Callgrind data file should hold costs for each assembler instruction of a program, you specify subposition “instr” in the “positions:” header line, and each cost line has to include the address of some instruction. Addresses are allowed to have a size of 64bit to support 64bit architectures. Thus, repeating similar, long addresses for almost every line in the data file can enlarge the file size quite significantly, and motivates for subposition compression: instead of every cost line starting with a 16 character long address, one is allowed to specify relative addresses. This relative specification is not only allowed for instruction addresses, but also for line numbers; both addresses and line numbers are called “subpositions”.

A relative subposition always is based on the corresponding subposition of the last cost line, and starts with a ‘+’ to specify a positive difference, a ‘-’ to specify a negative difference, or consists of ‘*’ to specify the same subposition. Because absolute subpositions always are positive (i.e. never prefixed by ‘-’), any relative specification is non-ambiguous; additionally, absolute and relative subposition specifications can be mixed freely. Assume the following example (subpositions can always be specified as hexadecimal numbers, beginning with ‘0x’):

positions: instr line
events: ticks

fn=func
0x80001234 90 1
0x80001237 90 5
0x80001238 91 6

With subposition compression, this looks like

positions: instr line
events: ticks

fn=func
0x80001234 90 1
+3 * 5
+1 +1 6

Remark: For assembler annotation to work, instruction addresses have to be corrected to correspond to addresses found in the original binary. I.e. for relocatable shared objects, often a load offset has to be subtracted.

ISBN 0954612051Valgrind 3.3 - Advanced Debugging and Profiling for GNU/Linux applicationsSee the print edition