GNU Binutils with patches for OS216
Revision | b084d499897043f621ec43c38594957e859ee884 (tree) |
---|---|
Time | 2008-10-01 01:57:37 |
Author | Joel Brobecker <brobecker@gnat...> |
Commiter | Joel Brobecker |
@@ -1,3 +1,8 @@ | ||
1 | +2008-09-30 Joel Brobecker <brobecker@adacore.com> | |
2 | + | |
3 | + * dwarf2read.c (dwarf2_get_subprogram_pc_bounds): New function. | |
4 | + (get_scope_pc_bounds): Use it. | |
5 | + | |
1 | 6 | 2008-09-27 Tom Tromey <tromey@redhat.com> |
2 | 7 | |
3 | 8 | * NEWS: Update. |
@@ -3324,6 +3324,43 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc, | ||
3324 | 3324 | return ret; |
3325 | 3325 | } |
3326 | 3326 | |
3327 | +/* Assuming that DIE represents a subprogram DIE or a lexical block, get | |
3328 | + its low and high PC addresses. Do nothing if these addresses could not | |
3329 | + be determined. Otherwise, set LOWPC to the low address if it is smaller, | |
3330 | + and HIGHPC to the high address if greater than HIGHPC. */ | |
3331 | + | |
3332 | +static void | |
3333 | +dwarf2_get_subprogram_pc_bounds (struct die_info *die, | |
3334 | + CORE_ADDR *lowpc, CORE_ADDR *highpc, | |
3335 | + struct dwarf2_cu *cu) | |
3336 | +{ | |
3337 | + CORE_ADDR low, high; | |
3338 | + struct die_info *child = die->child; | |
3339 | + | |
3340 | + if (dwarf2_get_pc_bounds (die, &low, &high, cu)) | |
3341 | + { | |
3342 | + *lowpc = min (*lowpc, low); | |
3343 | + *highpc = max (*highpc, high); | |
3344 | + } | |
3345 | + | |
3346 | + /* If the language does not allow nested subprograms (either inside | |
3347 | + subprograms or lexical blocks), we're done. */ | |
3348 | + if (cu->language != language_ada) | |
3349 | + return; | |
3350 | + | |
3351 | + /* Check all the children of the given DIE. If it contains nested | |
3352 | + subprograms, then check their pc bounds. Likewise, we need to | |
3353 | + check lexical blocks as well, as they may also contain subprogram | |
3354 | + definitions. */ | |
3355 | + while (child && child->tag) | |
3356 | + { | |
3357 | + if (child->tag == DW_TAG_subprogram | |
3358 | + || child->tag == DW_TAG_lexical_block) | |
3359 | + dwarf2_get_subprogram_pc_bounds (child, lowpc, highpc, cu); | |
3360 | + child = sibling_die (child); | |
3361 | + } | |
3362 | +} | |
3363 | + | |
3327 | 3364 | /* Get the low and high pc's represented by the scope DIE, and store |
3328 | 3365 | them in *LOWPC and *HIGHPC. If the correct values can't be |
3329 | 3366 | determined, set *LOWPC to -1 and *HIGHPC to 0. */ |
@@ -3350,11 +3387,7 @@ get_scope_pc_bounds (struct die_info *die, | ||
3350 | 3387 | { |
3351 | 3388 | switch (child->tag) { |
3352 | 3389 | case DW_TAG_subprogram: |
3353 | - if (dwarf2_get_pc_bounds (child, ¤t_low, ¤t_high, cu)) | |
3354 | - { | |
3355 | - best_low = min (best_low, current_low); | |
3356 | - best_high = max (best_high, current_high); | |
3357 | - } | |
3390 | + dwarf2_get_subprogram_pc_bounds (child, &best_low, &best_high, cu); | |
3358 | 3391 | break; |
3359 | 3392 | case DW_TAG_namespace: |
3360 | 3393 | /* FIXME: carlton/2004-01-16: Should we do this for |