From 4b8791e10e574d3279e6783b58556893b0c92853 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 28 Jan 2022 10:59:38 -0500 Subject: [PATCH] gdb: remove BLOCK_{START,END} macros Replace with equivalent methods. Change-Id: I10a6c8a2a86462d9d4a6a6409a3f07a6bea66310 --- gdb/alpha-mdebug-tdep.c | 2 +- gdb/block.c | 6 +-- gdb/block.h | 23 +++++++++--- gdb/blockframe.c | 4 +- gdb/buildsym.c | 48 ++++++++++++------------ gdb/compile/compile-cplus-symbols.c | 4 +- gdb/compile/compile-cplus-types.c | 2 +- gdb/csky-tdep.c | 2 +- gdb/frame.c | 2 +- gdb/guile/scm-block.c | 6 +-- gdb/infcmd.c | 4 +- gdb/jit.c | 16 ++++---- gdb/mdebugread.c | 57 +++++++++++++++-------------- gdb/mips-tdep.c | 4 +- gdb/objfiles.c | 4 +- gdb/psymtab.c | 8 ++-- gdb/python/py-block.c | 4 +- gdb/symmisc.c | 8 ++-- gdb/symtab.c | 8 ++-- gdb/varobj.c | 4 +- 20 files changed, 117 insertions(+), 99 deletions(-) diff --git a/gdb/alpha-mdebug-tdep.c b/gdb/alpha-mdebug-tdep.c index a8b4bcbea4a..10169c76c37 100644 --- a/gdb/alpha-mdebug-tdep.c +++ b/gdb/alpha-mdebug-tdep.c @@ -102,7 +102,7 @@ find_proc_desc (CORE_ADDR pc) CORE_ADDR startaddr; find_pc_partial_function (pc, &sh_name, &startaddr, NULL); - if (startaddr > BLOCK_START (b)) + if (startaddr > b->start ()) /* This is the "pathological" case referred to in a comment in print_frame_info. It might be better to move this check into symbol reading. */ diff --git a/gdb/block.c b/gdb/block.c index bab6868bbbb..a4678ca6a84 100644 --- a/gdb/block.c +++ b/gdb/block.c @@ -155,7 +155,7 @@ find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc) { half = (top - bot + 1) >> 1; b = BLOCKVECTOR_BLOCK (bl, bot + half); - if (BLOCK_START (b) <= pc) + if (b->start () <= pc) bot += half; else top = bot + half; @@ -166,9 +166,9 @@ find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc) while (bot >= STATIC_BLOCK) { b = BLOCKVECTOR_BLOCK (bl, bot); - if (!(BLOCK_START (b) <= pc)) + if (!(b->start () <= pc)) return NULL; - if (BLOCK_END (b) > pc) + if (b->end () > pc) return b; bot--; } diff --git a/gdb/block.h b/gdb/block.h index eedba91ac89..7fe982407f8 100644 --- a/gdb/block.h +++ b/gdb/block.h @@ -90,11 +90,26 @@ struct blockranges struct block { + /* Return this block's start address. */ + CORE_ADDR start () const + { return m_start; } + + /* Set this block's start address. */ + void set_start (CORE_ADDR start) + { m_start = start; } + + /* Return this block's end address. */ + CORE_ADDR end () const + { return m_end; } + + /* Set this block's end address. */ + void set_end (CORE_ADDR end) + { m_end = end; } /* Addresses in the executable code that are in this block. */ - CORE_ADDR startaddr; - CORE_ADDR endaddr; + CORE_ADDR m_start; + CORE_ADDR m_end; /* The symbol that names this block, if the block is the body of a function (real or inlined); otherwise, zero. */ @@ -139,8 +154,6 @@ struct global_block struct compunit_symtab *compunit_symtab; }; -#define BLOCK_START(bl) (bl)->startaddr -#define BLOCK_END(bl) (bl)->endaddr #define BLOCK_FUNCTION(bl) (bl)->function #define BLOCK_SUPERBLOCK(bl) (bl)->superblock #define BLOCK_MULTIDICT(bl) (bl)->multidict @@ -186,7 +199,7 @@ struct global_block too). BLOCK_ENTRY_PC can then be redefined to be less DWARF-centric. */ #define BLOCK_ENTRY_PC(bl) (BLOCK_CONTIGUOUS_P (bl) \ - ? BLOCK_START (bl) \ + ? bl->start () \ : BLOCK_RANGE_START (bl,0)) struct blockvector diff --git a/gdb/blockframe.c b/gdb/blockframe.c index df03901b6e7..fec7f053057 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -278,8 +278,8 @@ find_pc_partial_function_sym (CORE_ADDR pc, if (BLOCK_CONTIGUOUS_P (b)) { - cache_pc_function_low = BLOCK_START (b); - cache_pc_function_high = BLOCK_END (b); + cache_pc_function_low = b->start (); + cache_pc_function_high = b->end (); } else { diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 586c0920468..7db9f344177 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -234,8 +234,8 @@ buildsym_compunit::finish_block_internal } } - BLOCK_START (block) = start; - BLOCK_END (block) = end; + block->set_start (start); + block->set_end (end); /* Put the block in as the value of the symbol that names it. */ @@ -306,7 +306,7 @@ buildsym_compunit::finish_block_internal /* Check to be sure that the blocks have an end address that is greater than starting address. */ - if (BLOCK_END (block) < BLOCK_START (block)) + if (block->end () < block->start ()) { if (symbol) { @@ -318,11 +318,11 @@ buildsym_compunit::finish_block_internal { complaint (_("block end address %s less than block " "start address %s (patched it)"), - paddress (gdbarch, BLOCK_END (block)), - paddress (gdbarch, BLOCK_START (block))); + paddress (gdbarch, block->end ()), + paddress (gdbarch, block->start ())); } /* Better than nothing. */ - BLOCK_END (block) = BLOCK_START (block); + block->set_end (block->start ()); } /* Install this block as the superblock of all blocks made since the @@ -343,8 +343,8 @@ buildsym_compunit::finish_block_internal physically nested inside this other blocks, only lexically nested. */ if (BLOCK_FUNCTION (pblock->block) == NULL - && (BLOCK_START (pblock->block) < BLOCK_START (block) - || BLOCK_END (pblock->block) > BLOCK_END (block))) + && (pblock->block->start () < block->start () + || pblock->block->end () > block->end ())) { if (symbol) { @@ -355,15 +355,17 @@ buildsym_compunit::finish_block_internal { complaint (_("inner block (%s-%s) not " "inside outer block (%s-%s)"), - paddress (gdbarch, BLOCK_START (pblock->block)), - paddress (gdbarch, BLOCK_END (pblock->block)), - paddress (gdbarch, BLOCK_START (block)), - paddress (gdbarch, BLOCK_END (block))); + paddress (gdbarch, pblock->block->start ()), + paddress (gdbarch, pblock->block->end ()), + paddress (gdbarch, block->start ()), + paddress (gdbarch, block->end ())); } - if (BLOCK_START (pblock->block) < BLOCK_START (block)) - BLOCK_START (pblock->block) = BLOCK_START (block); - if (BLOCK_END (pblock->block) > BLOCK_END (block)) - BLOCK_END (pblock->block) = BLOCK_END (block); + + if (pblock->block->start () < block->start ()) + pblock->block->set_start (block->start ()); + + if (pblock->block->end () > block->end ()) + pblock->block->set_end (block->end ()); } BLOCK_SUPERBLOCK (pblock->block) = block; } @@ -413,8 +415,8 @@ buildsym_compunit::record_block_range (struct block *block, become interesting. Note that even if this block doesn't have any "interesting" ranges, some later block might, so we still need to record this block in the addrmap. */ - if (start != BLOCK_START (block) - || end_inclusive + 1 != BLOCK_END (block)) + if (start != block->start () + || end_inclusive + 1 != block->end ()) m_pending_addrmap_interesting = true; if (m_pending_addrmap == nullptr) @@ -473,11 +475,11 @@ buildsym_compunit::make_blockvector () { for (i = 1; i < BLOCKVECTOR_NBLOCKS (blockvector); i++) { - if (BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i - 1)) - > BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i))) + if (BLOCKVECTOR_BLOCK(blockvector, i - 1)->start () + > BLOCKVECTOR_BLOCK(blockvector, i)->start ()) { CORE_ADDR start - = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)); + = BLOCKVECTOR_BLOCK(blockvector, i)->start (); complaint (_("block at %s out of order"), hex_string ((LONGEST) start)); @@ -820,7 +822,7 @@ buildsym_compunit::end_compunit_symtab_get_static_block (CORE_ADDR end_addr, std::stable_sort (barray.begin (), barray.end (), [] (const block *a, const block *b) { - return BLOCK_START (a) > BLOCK_START (b); + return a->start () > b->start (); }); int i = 0; @@ -878,7 +880,7 @@ buildsym_compunit::end_compunit_symtab_with_blockvector gdb_assert (static_block != NULL); gdb_assert (m_subfiles != NULL); - end_addr = BLOCK_END (static_block); + end_addr = static_block->end (); /* Create the GLOBAL_BLOCK and build the blockvector. */ finish_block_internal (NULL, get_global_symbols (), NULL, NULL, diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c index 95d43507c30..ef2a1f57603 100644 --- a/gdb/compile/compile-cplus-symbols.c +++ b/gdb/compile/compile-cplus-symbols.c @@ -87,7 +87,7 @@ convert_one_symbol (compile_cplus_instance *instance, case LOC_BLOCK: { kind = GCC_CP_SYMBOL_FUNCTION; - addr = BLOCK_START (sym.symbol->value_block ()); + addr = sym.symbol->value_block()->start (); if (is_global && sym.symbol->type ()->is_gnu_ifunc ()) addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr); } @@ -441,7 +441,7 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context, gdb_printf (gdb_stdlog, "gcc_symbol_address \"%s\": full symbol\n", identifier); - result = BLOCK_START (sym->value_block ()); + result = sym->value_block ()->start (); if (sym->type ()->is_gnu_ifunc ()) result = gnu_ifunc_resolve_addr (target_gdbarch (), result); found = 1; diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index ab65e47f49d..e7c940b1355 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -766,7 +766,7 @@ compile_cplus_convert_struct_or_union_methods (compile_cplus_instance *instance, const char *filename = sym.symbol->symtab ()->filename; unsigned int line = sym.symbol->line (); - CORE_ADDR address = BLOCK_START (sym.symbol->value_block ()); + CORE_ADDR address = sym.symbol->value_block()->start (); const char *kind; if (TYPE_FN_FIELD_STATIC_P (methods, j)) diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index 105f5fccd12..a9b53916561 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -1839,7 +1839,7 @@ csky_frame_unwind_cache (struct frame_info *this_frame) /* Get the (function) symbol matching prologue_start. */ bl = block_for_pc (prologue_start); if (bl != NULL) - func_size = bl->endaddr - bl->startaddr; + func_size = bl->end () - bl->start (); else { struct bound_minimal_symbol msymbol diff --git a/gdb/frame.c b/gdb/frame.c index 5e3c02e2029..ae45e22d613 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2432,7 +2432,7 @@ inside_main_func (frame_info *this_frame) const struct block *block = bs.symbol->value_block (); gdb_assert (block != nullptr); - sym_addr = BLOCK_START (block); + sym_addr = block->start (); } else sym_addr = msymbol.value_address (); diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c index df0ef7f0b1f..921225dcf47 100644 --- a/gdb/guile/scm-block.c +++ b/gdb/guile/scm-block.c @@ -160,7 +160,7 @@ bkscm_print_block_smob (SCM self, SCM port, scm_print_state *pstate) gdbscm_printf (port, " %s", BLOCK_FUNCTION (b)->print_name ()); gdbscm_printf (port, " %s-%s", - hex_string (BLOCK_START (b)), hex_string (BLOCK_END (b))); + hex_string (b->start ()), hex_string (b->end ())); scm_puts (">", port); @@ -379,7 +379,7 @@ gdbscm_block_start (SCM self) = bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct block *block = b_smob->block; - return gdbscm_scm_from_ulongest (BLOCK_START (block)); + return gdbscm_scm_from_ulongest (block->start ()); } /* (block-end ) -> address */ @@ -391,7 +391,7 @@ gdbscm_block_end (SCM self) = bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); const struct block *block = b_smob->block; - return gdbscm_scm_from_ulongest (BLOCK_END (block)); + return gdbscm_scm_from_ulongest (block->end ()); } /* (block-function ) -> */ diff --git a/gdb/infcmd.c b/gdb/infcmd.c index c7f339a7a94..5368fcd7157 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -980,8 +980,8 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) if (sym->aclass () == LOC_BLOCK) { const block *block = sym->value_block (); - if (BLOCK_END (block) < tp->control.step_range_end) - tp->control.step_range_end = BLOCK_END (block); + if (block->end () < tp->control.step_range_end) + tp->control.step_range_end = block->end (); } } diff --git a/gdb/jit.c b/gdb/jit.c index f7e25e494d4..49db391f80c 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -583,8 +583,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) BLOCK_MULTIDICT (new_block) = mdict_create_linear (&objfile->objfile_obstack, NULL); /* The address range. */ - BLOCK_START (new_block) = (CORE_ADDR) gdb_block_iter.begin; - BLOCK_END (new_block) = (CORE_ADDR) gdb_block_iter.end; + new_block->set_start (gdb_block_iter.begin); + new_block->set_end (gdb_block_iter.end); /* The name. */ block_name->set_domain (VAR_DOMAIN); @@ -599,10 +599,10 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) BLOCK_FUNCTION (new_block) = block_name; BLOCKVECTOR_BLOCK (bv, block_idx) = new_block; - if (begin > BLOCK_START (new_block)) - begin = BLOCK_START (new_block); - if (end < BLOCK_END (new_block)) - end = BLOCK_END (new_block); + if (begin > new_block->start ()) + begin = new_block->start (); + if (end < new_block->end ()) + end = new_block->end (); gdb_block_iter.real_block = new_block; @@ -623,8 +623,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) BLOCK_SUPERBLOCK (new_block) = block_iter; block_iter = new_block; - BLOCK_START (new_block) = (CORE_ADDR) begin; - BLOCK_END (new_block) = (CORE_ADDR) end; + new_block->set_start (begin); + new_block->set_end (end); BLOCKVECTOR_BLOCK (bv, i) = new_block; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 7083beb01ed..1565a86bad0 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -798,7 +798,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, b = new_block (FUNCTION_BLOCK, s->language ()); s->set_value_block (b); BLOCK_FUNCTION (b) = s; - BLOCK_START (b) = BLOCK_END (b) = sh->value; + b->set_start (sh->value); + b->set_end (sh->value); BLOCK_SUPERBLOCK (b) = top_stack->cur_block; add_block (b, top_stack->cur_st); @@ -1126,7 +1127,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, top_stack->blocktype = stBlock; b = new_block (NON_FUNCTION_BLOCK, psymtab_language); - BLOCK_START (b) = sh->value + top_stack->procadr; + b->set_start (sh->value + top_stack->procadr); BLOCK_SUPERBLOCK (b) = top_stack->cur_block; top_stack->cur_block = b; add_block (b, top_stack->cur_st); @@ -1150,7 +1151,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, struct type *ftype = top_stack->cur_type; int i; - BLOCK_END (top_stack->cur_block) += sh->value; /* size */ + top_stack->cur_block->set_end + (top_stack->cur_block->end () + sh->value); /* size */ /* Make up special symbol to contain procedure specific info. */ s = new_symbol (MDEBUG_EFI_SYMBOL_NAME); @@ -1171,11 +1173,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, struct block *b_bad = BLOCKVECTOR_BLOCK (bv, i); if (BLOCK_SUPERBLOCK (b_bad) == cblock - && BLOCK_START (b_bad) == top_stack->procadr - && BLOCK_END (b_bad) == top_stack->procadr) + && b_bad->start () == top_stack->procadr + && b_bad->end () == top_stack->procadr) { - BLOCK_START (b_bad) = BLOCK_START (cblock); - BLOCK_END (b_bad) = BLOCK_END (cblock); + b_bad->set_start (cblock->start ()); + b_bad->set_end (cblock->end ()); } } @@ -1217,7 +1219,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* End of (code) block. The value of the symbol is the displacement from the procedure`s start address of the end of this block. */ - BLOCK_END (top_stack->cur_block) = sh->value + top_stack->procadr; + top_stack->cur_block->set_end (sh->value + top_stack->procadr); } else if (sh->sc == scText && top_stack->blocktype == stNil) { @@ -2024,7 +2026,7 @@ parse_procedure (PDR *pr, struct compunit_symtab *search_symtab, e->pdr.adr is sometimes offset by a bogus value. To work around these problems, we replace e->pdr.adr with the start address of the function. */ - e->pdr.adr = BLOCK_START (b); + e->pdr.adr = b->start (); } /* It would be reasonable that functions that have been compiled @@ -4099,8 +4101,8 @@ mdebug_expand_psymtab (legacy_psymtab *pst, struct objfile *objfile) top_stack->cur_st = cust->primary_filetab (); top_stack->cur_block = BLOCKVECTOR_BLOCK (cust->blockvector (), STATIC_BLOCK); - BLOCK_START (top_stack->cur_block) = pst->text_low (objfile); - BLOCK_END (top_stack->cur_block) = 0; + top_stack->cur_block->set_start (pst->text_low (objfile)); + top_stack->cur_block->set_end (0); top_stack->blocktype = stFile; top_stack->cur_type = 0; top_stack->procadr = 0; @@ -4550,13 +4552,13 @@ add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last) static bool block_is_less_than (const struct block *b1, const struct block *b2) { - CORE_ADDR start1 = BLOCK_START (b1); - CORE_ADDR start2 = BLOCK_START (b2); + CORE_ADDR start1 = b1->start (); + CORE_ADDR start2 = b2->start (); if (start1 != start2) return start1 < start2; - return (BLOCK_END (b2)) < (BLOCK_END (b1)); + return (b2->end ()) < (b1->end ()); } /* Sort the blocks of a symtab S. @@ -4574,10 +4576,10 @@ sort_blocks (struct symtab *s) if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK) { /* Cosmetic */ - if (BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) == 0) - BLOCK_START (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) = 0; - if (BLOCK_END (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) == 0) - BLOCK_START (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) = 0; + if (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->end () == 0) + BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_start (0); + if (BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->end () == 0) + BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_start (0); return; } /* @@ -4596,18 +4598,19 @@ sort_blocks (struct symtab *s) int i, j = BLOCKVECTOR_NBLOCKS (bv); for (i = FIRST_LOCAL_BLOCK; i < j; i++) - if (high < BLOCK_END (BLOCKVECTOR_BLOCK (bv, i))) - high = BLOCK_END (BLOCKVECTOR_BLOCK (bv, i)); - BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) = high; + if (high < BLOCKVECTOR_BLOCK(bv, i)->end ()) + high = BLOCKVECTOR_BLOCK(bv, i)->end (); + BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_end (high); } - BLOCK_START (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)) = - BLOCK_START (BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK)); + BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->set_start + (BLOCKVECTOR_BLOCK(bv, FIRST_LOCAL_BLOCK)->start ()); - BLOCK_START (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) = - BLOCK_START (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)); - BLOCK_END (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) = - BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)); + BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_start + (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->start ()); + + BLOCKVECTOR_BLOCK(bv, STATIC_BLOCK)->set_end + (BLOCKVECTOR_BLOCK(bv, GLOBAL_BLOCK)->end ()); } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 354c2b54e07..ffed8723dce 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -490,11 +490,11 @@ mips_make_symbol_special (struct symbol *sym, struct objfile *objfile) CORE_ADDR compact_block_start; struct bound_minimal_symbol msym; - compact_block_start = BLOCK_START (block) | 1; + compact_block_start = block->start () | 1; msym = lookup_minimal_symbol_by_pc (compact_block_start); if (msym.minsym && !msymbol_is_mips (msym.minsym)) { - BLOCK_START (block) = compact_block_start; + block->set_start (compact_block_start); } } } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 849c6d73cab..e664bcd2da9 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -677,8 +677,8 @@ objfile_relocate1 (struct objfile *objfile, struct mdict_iterator miter; b = BLOCKVECTOR_BLOCK (bv, i); - BLOCK_START (b) += delta[block_line_section]; - BLOCK_END (b) += delta[block_line_section]; + b->set_start (b->start () + delta[block_line_section]); + b->set_end (b->end () + delta[block_line_section]); if (BLOCK_RANGES (b) != nullptr) for (int j = 0; j < BLOCK_NRANGES (b); j++) diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 5d9949bca1d..ce29e1922a1 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1835,8 +1835,8 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) } } if (ps->raw_text_high () != 0 - && (ps->text_low (objfile) < BLOCK_START (b) - || ps->text_high (objfile) > BLOCK_END (b))) + && (ps->text_low (objfile) < b->start () + || ps->text_high (objfile) > b->end ())) { gdb_printf ("Psymtab "); gdb_puts (ps->filename); @@ -1845,9 +1845,9 @@ maintenance_check_psymtabs (const char *ignore, int from_tty) gdb_printf (" - "); gdb_puts (paddress (gdbarch, ps->text_high (objfile))); gdb_printf (" but symtab covers only "); - gdb_puts (paddress (gdbarch, BLOCK_START (b))); + gdb_puts (paddress (gdbarch, b->start ())); gdb_printf (" - "); - gdb_puts (paddress (gdbarch, BLOCK_END (b))); + gdb_puts (paddress (gdbarch, b->end ())); gdb_printf ("\n"); } } diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index cf543c79484..aa8f3df7af9 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -109,7 +109,7 @@ blpy_get_start (PyObject *self, void *closure) BLPY_REQUIRE_VALID (self, block); - return gdb_py_object_from_ulongest (BLOCK_START (block)).release (); + return gdb_py_object_from_ulongest (block->start ()).release (); } static PyObject * @@ -119,7 +119,7 @@ blpy_get_end (PyObject *self, void *closure) BLPY_REQUIRE_VALID (self, block); - return gdb_py_object_from_ulongest (BLOCK_END (block)).release (); + return gdb_py_object_from_ulongest (block->end ()).release (); } static PyObject * diff --git a/gdb/symmisc.c b/gdb/symmisc.c index dee11fdf57d..097dc2dd355 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -295,9 +295,9 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile) wants it. */ gdb_printf (outfile, ", %d syms/buckets in ", mdict_size (BLOCK_MULTIDICT (b))); - gdb_puts (paddress (gdbarch, BLOCK_START (b)), outfile); + gdb_puts (paddress (gdbarch, b->start ()), outfile); gdb_printf (outfile, ".."); - gdb_puts (paddress (gdbarch, BLOCK_END (b)), outfile); + gdb_puts (paddress (gdbarch, b->end ()), outfile); if (BLOCK_FUNCTION (b)) { gdb_printf (outfile, ", function %s", @@ -631,8 +631,8 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, gdb_printf (outfile, "block object %s, %s..%s", host_address_to_string (symbol->value_block ()), - paddress (gdbarch, BLOCK_START (symbol->value_block ())), - paddress (gdbarch, BLOCK_END (symbol->value_block ()))); + paddress (gdbarch, symbol->value_block()->start ()), + paddress (gdbarch, symbol->value_block()->end ())); if (section) gdb_printf (outfile, " section %s", bfd_section_name (section->the_bfd_section)); diff --git a/gdb/symtab.c b/gdb/symtab.c index 6926d1559b2..993b1962c8c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2982,8 +2982,8 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section) const struct blockvector *bv = cust->blockvector (); const struct block *global_block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK); - CORE_ADDR start = BLOCK_START (global_block); - CORE_ADDR end = BLOCK_END (global_block); + CORE_ADDR start = global_block->start (); + CORE_ADDR end = global_block->end (); bool in_range_p = start <= pc && pc < end; if (!in_range_p) continue; @@ -3406,7 +3406,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) else if (alt) val.end = alt->pc; else - val.end = BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)); + val.end = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)->end (); } val.section = section; return val; @@ -3985,7 +3985,7 @@ skip_prologue_sal (struct symtab_and_line *sal) line is still part of the same function. */ if (skip && start_sal.pc != pc && (sym ? (BLOCK_ENTRY_PC (sym->value_block ()) <= start_sal.end - && start_sal.end < BLOCK_END (sym->value_block ())) + && start_sal.end < sym->value_block()->end ()) : (lookup_minimal_symbol_by_pc_section (start_sal.end, section).minsym == lookup_minimal_symbol_by_pc_section (pc, section).minsym))) { diff --git a/gdb/varobj.c b/gdb/varobj.c index 6693dacd786..741fdb6a03b 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1939,8 +1939,8 @@ check_scope (const struct varobj *var) { CORE_ADDR pc = get_frame_pc (fi); - if (pc < BLOCK_START (var->root->valid_block) || - pc >= BLOCK_END (var->root->valid_block)) + if (pc < var->root->valid_block->start () || + pc >= var->root->valid_block->end ()) scope = false; else select_frame (fi); -- 2.30.2