]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove BLOCK_CONTIGUOUS_P macro
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 7 Feb 2022 03:38:14 +0000 (22:38 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 28 Apr 2022 02:05:03 +0000 (22:05 -0400)
Replace with an equivalent method.

Change-Id: I60fd3be7b4c2601c2a74328f635fa48ed80eb7f5

gdb/block.h
gdb/blockframe.c
gdb/cli/cli-cmds.c

index eb77f746037e71970aca3554b8c09303a12b8079..80b0616116dca142ead7939ce2eb88a20517ac53 100644 (file)
@@ -167,6 +167,10 @@ struct block
   void set_ranges (blockranges *ranges)
   { m_ranges = ranges; }
 
+  /* Return true if all addresses within this block are contiguous.  */
+  bool is_contiguous () const
+  { return this->ranges ().size () <= 1; }
+
   /* Addresses in the executable code that are in this block.  */
 
   CORE_ADDR m_start;
@@ -215,11 +219,6 @@ struct global_block
   struct compunit_symtab *compunit_symtab;
 };
 
-/* Are all addresses within a block contiguous?  */
-
-#define BLOCK_CONTIGUOUS_P(bl) ((bl)->ranges ().size () == 0 \
-                                || (bl)->ranges ().size () == 1)
-
 /* Define the "entry pc" for a block BL to be the lowest (start) address
    for the block when all addresses within the block are contiguous.  If
    non-contiguous, then use the start address for the first range in the
@@ -234,7 +233,7 @@ struct global_block
    the entry_pc field can be set from the dwarf reader (and other readers
    too).  BLOCK_ENTRY_PC can then be redefined to be less DWARF-centric.  */
 
-#define BLOCK_ENTRY_PC(bl)     (BLOCK_CONTIGUOUS_P (bl) \
+#define BLOCK_ENTRY_PC(bl)     (bl->is_contiguous () \
                                 ? bl->start () \
                                 : bl->ranges ()[0].start ())
 
index 78c9daabf2361e18c771bb5b826f6332ce6e4aac..694cd047c754c1f354f8479a3bb3446cd141fad1 100644 (file)
@@ -276,7 +276,7 @@ find_pc_partial_function_sym (CORE_ADDR pc,
             comment preceding declaration of find_pc_partial_function
             in symtab.h for more information.  */
 
-         if (BLOCK_CONTIGUOUS_P (b))
+         if (b->is_contiguous ())
            {
              cache_pc_function_low = b->start ();
              cache_pc_function_high = b->end ();
@@ -390,7 +390,7 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
   const struct block *block;
   bool status = find_pc_partial_function (pc, name, address, endaddr, &block);
 
-  if (status && block != nullptr && !BLOCK_CONTIGUOUS_P (block))
+  if (status && block != nullptr && !block->is_contiguous ())
     {
       CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block);
 
index 7a6a8ea20a15da5da6f82611f995cba421a16b5f..31911ebe61fca060b7886eb4472581a9d28710f0 100644 (file)
@@ -1428,7 +1428,7 @@ print_disassembly (struct gdbarch *gdbarch, const char *name,
       if (name != NULL)
        gdb_printf (_("for function %ps:\n"),
                    styled_string (function_name_style.style (), name));
-      if (block == nullptr || BLOCK_CONTIGUOUS_P (block))
+      if (block == nullptr || block->is_contiguous ())
        {
          if (name == NULL)
            gdb_printf (_("from %ps to %ps:\n"),