9
9
This file is part of Valgrind, a dynamic binary instrumentation
12
Copyright (C) 2000-2011 Julian Seward
12
Copyright (C) 2000-2012 Julian Seward
15
15
This program is free software; you can redistribute it and/or
260
#elif defined(VGA_mips32)
265
UChar cfa_how; /* a CFIC_ value */
266
UChar ra_how; /* a CFIR_ value */
267
UChar sp_how; /* a CFIR_ value */
268
UChar fp_how; /* a CFIR_ value */
261
276
# error "Unknown arch"
405
421
true. The initial state is one in which we have no observations,
406
422
so have_rx_map and have_rw_map are both false.
408
This is all rather ad-hoc; for example it has no way to record more
409
than one rw or rx mapping for a given object, not because such
410
events have never been observed, but because we've never needed to
411
note more than the first one of any such in order when to decide to
412
read debug info. It may be that in future we need to track more
413
state in order to make the decision, so this struct would then get
424
This all started as a rather ad-hoc solution, but was further
425
expanded to handle weird object layouts, e.g. more than one rw
426
or rx mapping for one binary.
416
428
The normal sequence of events is one of
428
440
where the upgrade is done by a call to vm_protect. Hence we
429
441
need to also track this possibility.
444
struct _DebugInfoMapping
446
Addr avma; /* these fields record the file offset, length */
447
SizeT size; /* and map address of each mapping */
449
Bool rx, rw, ro; /* memory access flags for this mapping */
431
452
struct _DebugInfoFSM
433
/* --- all targets --- */
434
UChar* filename; /* in mallocville (VG_AR_DINFO) */
454
UChar* filename; /* in mallocville (VG_AR_DINFO) */
455
XArray* maps; /* XArray of _DebugInfoMapping structs */
436
456
Bool have_rx_map; /* did we see a r?x mapping yet for the file? */
437
457
Bool have_rw_map; /* did we see a rw? mapping yet for the file? */
439
Addr rx_map_avma; /* these fields record the file offset, length */
440
SizeT rx_map_size; /* and map address of the r?x mapping we believe */
441
OffT rx_map_foff; /* is the .text segment mapping */
443
Addr rw_map_avma; /* ditto, for the rw? mapping we believe is the */
444
SizeT rw_map_size; /* .data segment mapping */
447
/* --- OSX 10.7, 32-bit only --- */
448
458
Bool have_ro_map; /* did we see a r-- mapping yet for the file? */
450
Addr ro_map_avma; /* file offset, length, avma for said mapping */
515
521
we have committed to reading the symbols and debug info (that
516
522
is, at the point where .have_dinfo is set to True). */
518
/* The file's soname. FIXME: ensure this is always allocated in
524
/* The file's soname. */
522
527
/* Description of some important mapped segments. The presence or
531
536
Comment_on_IMPORTANT_CFSI_REPRESENTATIONAL_INVARIANTS: we require that
533
either (rx_map_size == 0 && cfsi == NULL) (the degenerate case)
538
either (size of all rx maps == 0 && cfsi == NULL) (the degenerate case)
535
540
or the normal case, which is the AND of the following:
537
(1) no two DebugInfos with rx_map_size > 0
538
have overlapping [rx_map_avma,+rx_map_size)
539
(2) [cfsi_minavma,cfsi_maxavma] does not extend
540
beyond [rx_map_avma,+rx_map_size); that is, the former is a
541
subrange or equal to the latter.
541
(0) size of at least one rx mapping > 0
542
(1) no two DebugInfos with some rx mapping of size > 0
543
have overlapping rx mappings
544
(2) [cfsi_minavma,cfsi_maxavma] does not extend beyond
545
[avma,+size) of one rx mapping; that is, the former
546
is a subrange or equal to the latter.
542
547
(3) all DiCfSI in the cfsi array all have ranges that fall within
543
[rx_map_avma,+rx_map_size).
548
[avma,+size) of that rx mapping.
544
549
(4) all DiCfSI in the cfsi array are non-overlapping
546
551
The cumulative effect of these restrictions is to ensure that
794
800
/* An array of guarded DWARF3 expressions. */
795
801
XArray* admin_gexprs;
803
/* Cached last rx mapping matched and returned by ML_(find_rx_mapping).
804
This helps performance a lot during ML_(addLineInfo) etc., which can
805
easily be invoked hundreds of thousands of times. */
806
struct _DebugInfoMapping* last_rx_map;
798
809
/* --------------------- functions --------------------- */
861
872
if not found. Binary search. */
862
873
extern Word ML_(search_one_fpotab) ( struct _DebugInfo* di, Addr ptr );
875
/* Helper function for the most often needed searching for an rx
876
mapping containing the specified address range. The range must
877
fall entirely within the mapping to be considered to be within it.
878
Asserts if lo > hi; caller must ensure this doesn't happen. */
879
extern struct _DebugInfoMapping* ML_(find_rx_mapping) ( struct _DebugInfo* di,
864
882
/* ------ Misc ------ */
866
884
/* Show a non-fatal debug info reading error. Use vg_panic if