public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
@ 2016-05-29 14:10 Jan Kratochvil
  2016-05-30 10:44 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2016-05-29 14:10 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

Hi,

make the code (maybe) more readable + primarily prepare it for [patch 2/2]
enum extension.

This change should have no code change impact.


Jan

[-- Attachment #2: contig.patch --]
[-- Type: text/plain, Size: 7850 bytes --]

gdb/ChangeLog
2016-05-29  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
	* dwarf2read.c (enum pc_bounds_kind) New.
	(dwarf2_get_pc_bounds): Use it in the declaration.
	(process_psymtab_comp_unit_reader, read_func_scope)
	(read_lexical_block_scope, read_call_site_scope): Adjust callers.
	(dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
	(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.

--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1606,9 +1606,24 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
 static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
 			       struct dwarf2_cu *, struct partial_symtab *);
 
-static int dwarf2_get_pc_bounds (struct die_info *,
-				 CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
-				 struct partial_symtab *);
+/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
+   values.  */
+enum pc_bounds_kind
+{
+  /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
+     was found.  */
+  pc_bounds_not_present,
+
+  /* Discontiguous range was found - that is DW_AT_ranges was found.  */
+  pc_bounds_ranges,
+
+  /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found.  */
+  pc_bounds_high_low,
+};
+static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
+						 CORE_ADDR *, CORE_ADDR *,
+						 struct dwarf2_cu *,
+						 struct partial_symtab *);
 
 static void get_scope_pc_bounds (struct die_info *,
 				 CORE_ADDR *, CORE_ADDR *,
@@ -5947,7 +5962,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   CORE_ADDR baseaddr;
   CORE_ADDR best_lowpc = 0, best_highpc = 0;
   struct partial_symtab *pst;
-  int has_pc_info;
+  enum pc_bounds_kind has_pc_info;
   const char *filename;
   struct process_psymtab_comp_unit_data *info
     = (struct process_psymtab_comp_unit_data *) data;
@@ -5979,7 +5994,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
      `DW_AT_ranges'.  */
   has_pc_info = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
 				      &best_highpc, cu, pst);
-  if (has_pc_info == 1 && best_lowpc < best_highpc)
+  if (has_pc_info == pc_bounds_high_low && best_lowpc < best_highpc)
     /* Store the contiguous range if it is not empty; it can be empty for
        CUs with no code.  */
     addrmap_set_empty (objfile->psymtabs_addrmap,
@@ -6003,7 +6018,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
       first_die = load_partial_dies (reader, info_ptr, 1);
 
       scan_partial_symbols (first_die, &lowpc, &highpc,
-			    ! has_pc_info, cu);
+			    has_pc_info == pc_bounds_not_present, cu);
 
       /* If we didn't find a lowpc, set it to highpc to avoid
 	 complaints from `maint check'.	 */
@@ -6012,7 +6027,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 
       /* If the compilation unit didn't have an explicit address range,
 	 then use the information extracted from its child dies.  */
-      if (! has_pc_info)
+      if (has_pc_info == pc_bounds_not_present)
 	{
 	  best_lowpc = lowpc;
 	  best_highpc = highpc;
@@ -11373,7 +11388,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     }
 
   /* Ignore functions with missing or invalid low and high pc attributes.  */
-  if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+      == pc_bounds_not_present)
     {
       attr = dwarf2_attr (die, DW_AT_external, cu);
       if (!attr || !DW_UNSND (attr))
@@ -11535,7 +11551,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
      as multiple lexical blocks?  Handling children in a sane way would
      be nasty.  Might be easier to properly extend generic blocks to
      describe ranges.  */
-  if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+      == pc_bounds_not_present)
     return;
   lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
   highpc = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
@@ -11745,7 +11762,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  CORE_ADDR lowpc;
 
 	  /* DW_AT_entry_pc should be preferred.  */
-	  if (!dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL))
+	  if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
+	      == pc_bounds_not_present)
 	    complaint (&symfile_complaints,
 		       _("DW_AT_GNU_call_site_target target DIE has invalid "
 		         "low pc, for referencing DIE 0x%x [in module %s]"),
@@ -12020,11 +12038,11 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
   return 1;
 }
 
-/* Get low and high pc attributes from a die.  Return 1 if the attributes
-   are present and valid, otherwise, return 0.  Return -1 if the range is
-   discontinuous, i.e. derived from DW_AT_ranges information.  */
+/* Get low and high pc attributes from a die.  See enum pc_bounds_kind
+   definition for the return value.  *LOWPC and *HIGHPC are set iff
+   pc_bounds_not_present is not returned.  */
 
-static int
+static enum pc_bounds_kind
 dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 		      CORE_ADDR *highpc, struct dwarf2_cu *cu,
 		      struct partial_symtab *pst)
@@ -12033,7 +12051,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
   struct attribute *attr_high;
   CORE_ADDR low = 0;
   CORE_ADDR high = 0;
-  int ret = 0;
+  enum pc_bounds_kind ret = pc_bounds_not_present;
 
   attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
   if (attr_high)
@@ -12048,10 +12066,10 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 	}
       else
 	/* Found high w/o low attribute.  */
-	return 0;
+	return pc_bounds_not_present;
 
       /* Found consecutive range of addresses.  */
-      ret = 1;
+      ret = pc_bounds_high_low;
     }
   else
     {
@@ -12070,15 +12088,15 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 	  /* Value of the DW_AT_ranges attribute is the offset in the
 	     .debug_ranges section.  */
 	  if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
-	    return 0;
+	    return pc_bounds_not_present;
 	  /* Found discontinuous range of addresses.  */
-	  ret = -1;
+	  ret = pc_bounds_ranges;
 	}
     }
 
   /* read_partial_die has also the strict LOW < HIGH requirement.  */
   if (high <= low)
-    return 0;
+    return pc_bounds_not_present;
 
   /* When using the GNU linker, .gnu.linkonce. sections are used to
      eliminate duplicate copies of functions and vtables and such.
@@ -12089,7 +12107,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
      If this is a discarded function, mark the pc bounds as invalid,
      so that GDB will ignore it.  */
   if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
-    return 0;
+    return pc_bounds_not_present;
 
   *lowpc = low;
   if (highpc)
@@ -12110,7 +12128,8 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
   CORE_ADDR low, high;
   struct die_info *child = die->child;
 
-  if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
+      != pc_bounds_not_present)
     {
       *lowpc = min (*lowpc, low);
       *highpc = max (*highpc, high);
@@ -12147,7 +12166,8 @@ get_scope_pc_bounds (struct die_info *die,
   CORE_ADDR best_high = (CORE_ADDR) 0;
   CORE_ADDR current_low, current_high;
 
-  if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL)
+      != pc_bounds_not_present)
     {
       best_low = current_low;
       best_high = current_high;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
  2016-05-29 14:10 [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum Jan Kratochvil
@ 2016-05-30 10:44 ` Pedro Alves
  2016-05-30 12:17   ` [commit] " Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2016-05-30 10:44 UTC (permalink / raw)
  To: Jan Kratochvil, gdb-patches

On 05/29/2016 03:10 PM, Jan Kratochvil wrote:

> 
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -1606,9 +1606,24 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
>  static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
>  			       struct dwarf2_cu *, struct partial_symtab *);
>  
> -static int dwarf2_get_pc_bounds (struct die_info *,
> -				 CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
> -				 struct partial_symtab *);
> +/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
> +   values.  */
> +enum pc_bounds_kind
> +{
> +  /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
> +     was found.  */
> +  pc_bounds_not_present,
> +
> +  /* Discontiguous range was found - that is DW_AT_ranges was found.  */
> +  pc_bounds_ranges,
> +
> +  /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found.  */
> +  pc_bounds_high_low,

I think it's much more common in GDB to uppercase enum values.

> +};

Add empty line here.

> +static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
> +						 CORE_ADDR *, CORE_ADDR *,
> +						 struct dwarf2_cu *,
> +						 struct partial_symtab *);
>  


> -  int has_pc_info;
> +  enum pc_bounds_kind has_pc_info;

Shouldn't we rename the variable name too?

Otherwise LGTM.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [commit] [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
  2016-05-30 10:44 ` Pedro Alves
@ 2016-05-30 12:17   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2016-05-30 12:17 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

On Mon, 30 May 2016 12:44:46 +0200, Pedro Alves wrote:
> Otherwise LGTM.

Implemented + checked-in.


Thanks,
Jan

[-- Attachment #2: Type: message/rfc822, Size: 9455 bytes --]

From: Jan Kratochvil <jan.kratochvil@redhat.com>
Subject: [PATCH 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
Date: Mon, 30 May 2016 14:11:43 +0200

Make the code (maybe) more readable + primarily prepare it for [patch 2/2]
enum extension.

This change should have no code change impact.

gdb/ChangeLog
2016-05-30  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
	* dwarf2read.c (enum pc_bounds_kind) New.
	(dwarf2_get_pc_bounds): Use it in the declaration.
	(process_psymtab_comp_unit_reader): Adjust caller.  Rename has_pc_info
	to cu_bounds_kind.
	(read_func_scope, read_lexical_block_scope, read_call_site_scope):
	Adjust callers.
	(dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
	(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
---
 gdb/ChangeLog    | 12 ++++++++++
 gdb/dwarf2read.c | 71 ++++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 58 insertions(+), 25 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0b4d622..de20257 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2016-05-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum
+	* dwarf2read.c (enum pc_bounds_kind) New.
+	(dwarf2_get_pc_bounds): Use it in the declaration.
+	(process_psymtab_comp_unit_reader): Adjust caller.  Rename has_pc_info
+	to cu_bounds_kind.
+	(read_func_scope, read_lexical_block_scope, read_call_site_scope):
+	Adjust callers.
+	(dwarf2_get_pc_bounds): Use enum pc_bounds_kind in the definition.
+	(dwarf2_get_subprogram_pc_bounds, get_scope_pc_bounds): Adjust callers.
+
 2016-05-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	* NEWS (QCatchSyscalls): Remove the parameter.  Include ...
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 7b794c4..f90db00 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -1606,9 +1606,25 @@ static void read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu);
 static int dwarf2_ranges_read (unsigned, CORE_ADDR *, CORE_ADDR *,
 			       struct dwarf2_cu *, struct partial_symtab *);
 
-static int dwarf2_get_pc_bounds (struct die_info *,
-				 CORE_ADDR *, CORE_ADDR *, struct dwarf2_cu *,
-				 struct partial_symtab *);
+/* How dwarf2_get_pc_bounds constructed its *LOWPC and *HIGHPC return
+   values.  */
+enum pc_bounds_kind
+{
+  /* No valid combination of DW_AT_low_pc, DW_AT_high_pc or DW_AT_ranges
+     was found.  */
+  PC_BOUNDS_NOT_PRESENT,
+
+  /* Discontiguous range was found - that is DW_AT_ranges was found.  */
+  PC_BOUNDS_RANGES,
+
+  /* Contiguous range was found - DW_AT_low_pc and DW_AT_high_pc were found.  */
+  PC_BOUNDS_HIGH_LOW,
+};
+
+static enum pc_bounds_kind dwarf2_get_pc_bounds (struct die_info *,
+						 CORE_ADDR *, CORE_ADDR *,
+						 struct dwarf2_cu *,
+						 struct partial_symtab *);
 
 static void get_scope_pc_bounds (struct die_info *,
 				 CORE_ADDR *, CORE_ADDR *,
@@ -5947,7 +5963,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   CORE_ADDR baseaddr;
   CORE_ADDR best_lowpc = 0, best_highpc = 0;
   struct partial_symtab *pst;
-  int has_pc_info;
+  enum pc_bounds_kind cu_bounds_kind;
   const char *filename;
   struct process_psymtab_comp_unit_data *info
     = (struct process_psymtab_comp_unit_data *) data;
@@ -5977,9 +5993,9 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 
   /* Possibly set the default values of LOWPC and HIGHPC from
      `DW_AT_ranges'.  */
-  has_pc_info = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
-				      &best_highpc, cu, pst);
-  if (has_pc_info == 1 && best_lowpc < best_highpc)
+  cu_bounds_kind = dwarf2_get_pc_bounds (comp_unit_die, &best_lowpc,
+					 &best_highpc, cu, pst);
+  if (cu_bounds_kind == PC_BOUNDS_HIGH_LOW && best_lowpc < best_highpc)
     /* Store the contiguous range if it is not empty; it can be empty for
        CUs with no code.  */
     addrmap_set_empty (objfile->psymtabs_addrmap,
@@ -6003,7 +6019,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
       first_die = load_partial_dies (reader, info_ptr, 1);
 
       scan_partial_symbols (first_die, &lowpc, &highpc,
-			    ! has_pc_info, cu);
+			    cu_bounds_kind == PC_BOUNDS_NOT_PRESENT, cu);
 
       /* If we didn't find a lowpc, set it to highpc to avoid
 	 complaints from `maint check'.	 */
@@ -6012,7 +6028,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 
       /* If the compilation unit didn't have an explicit address range,
 	 then use the information extracted from its child dies.  */
-      if (! has_pc_info)
+      if (cu_bounds_kind == PC_BOUNDS_NOT_PRESENT)
 	{
 	  best_lowpc = lowpc;
 	  best_highpc = highpc;
@@ -11373,7 +11389,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
     }
 
   /* Ignore functions with missing or invalid low and high pc attributes.  */
-  if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+      == PC_BOUNDS_NOT_PRESENT)
     {
       attr = dwarf2_attr (die, DW_AT_external, cu);
       if (!attr || !DW_UNSND (attr))
@@ -11535,7 +11552,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
      as multiple lexical blocks?  Handling children in a sane way would
      be nasty.  Might be easier to properly extend generic blocks to
      describe ranges.  */
-  if (!dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
+      == PC_BOUNDS_NOT_PRESENT)
     return;
   lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + baseaddr);
   highpc = gdbarch_adjust_dwarf2_addr (gdbarch, highpc + baseaddr);
@@ -11745,7 +11763,8 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
 	  CORE_ADDR lowpc;
 
 	  /* DW_AT_entry_pc should be preferred.  */
-	  if (!dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL))
+	  if (dwarf2_get_pc_bounds (target_die, &lowpc, NULL, target_cu, NULL)
+	      == PC_BOUNDS_NOT_PRESENT)
 	    complaint (&symfile_complaints,
 		       _("DW_AT_GNU_call_site_target target DIE has invalid "
 		         "low pc, for referencing DIE 0x%x [in module %s]"),
@@ -12020,11 +12039,11 @@ dwarf2_ranges_read (unsigned offset, CORE_ADDR *low_return,
   return 1;
 }
 
-/* Get low and high pc attributes from a die.  Return 1 if the attributes
-   are present and valid, otherwise, return 0.  Return -1 if the range is
-   discontinuous, i.e. derived from DW_AT_ranges information.  */
+/* Get low and high pc attributes from a die.  See enum pc_bounds_kind
+   definition for the return value.  *LOWPC and *HIGHPC are set iff
+   PC_BOUNDS_NOT_PRESENT is not returned.  */
 
-static int
+static enum pc_bounds_kind
 dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 		      CORE_ADDR *highpc, struct dwarf2_cu *cu,
 		      struct partial_symtab *pst)
@@ -12033,7 +12052,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
   struct attribute *attr_high;
   CORE_ADDR low = 0;
   CORE_ADDR high = 0;
-  int ret = 0;
+  enum pc_bounds_kind ret = PC_BOUNDS_NOT_PRESENT;
 
   attr_high = dwarf2_attr (die, DW_AT_high_pc, cu);
   if (attr_high)
@@ -12048,10 +12067,10 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 	}
       else
 	/* Found high w/o low attribute.  */
-	return 0;
+	return PC_BOUNDS_NOT_PRESENT;
 
       /* Found consecutive range of addresses.  */
-      ret = 1;
+      ret = PC_BOUNDS_HIGH_LOW;
     }
   else
     {
@@ -12070,15 +12089,15 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
 	  /* Value of the DW_AT_ranges attribute is the offset in the
 	     .debug_ranges section.  */
 	  if (!dwarf2_ranges_read (ranges_offset, &low, &high, cu, pst))
-	    return 0;
+	    return PC_BOUNDS_NOT_PRESENT;
 	  /* Found discontinuous range of addresses.  */
-	  ret = -1;
+	  ret = PC_BOUNDS_RANGES;
 	}
     }
 
   /* read_partial_die has also the strict LOW < HIGH requirement.  */
   if (high <= low)
-    return 0;
+    return PC_BOUNDS_NOT_PRESENT;
 
   /* When using the GNU linker, .gnu.linkonce. sections are used to
      eliminate duplicate copies of functions and vtables and such.
@@ -12089,7 +12108,7 @@ dwarf2_get_pc_bounds (struct die_info *die, CORE_ADDR *lowpc,
      If this is a discarded function, mark the pc bounds as invalid,
      so that GDB will ignore it.  */
   if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
-    return 0;
+    return PC_BOUNDS_NOT_PRESENT;
 
   *lowpc = low;
   if (highpc)
@@ -12110,7 +12129,8 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
   CORE_ADDR low, high;
   struct die_info *child = die->child;
 
-  if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL)
+      != PC_BOUNDS_NOT_PRESENT)
     {
       *lowpc = min (*lowpc, low);
       *highpc = max (*highpc, high);
@@ -12147,7 +12167,8 @@ get_scope_pc_bounds (struct die_info *die,
   CORE_ADDR best_high = (CORE_ADDR) 0;
   CORE_ADDR current_low, current_high;
 
-  if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL))
+  if (dwarf2_get_pc_bounds (die, &current_low, &current_high, cu, NULL)
+      != PC_BOUNDS_NOT_PRESENT)
     {
       best_low = current_low;
       best_high = current_high;
-- 
2.5.5

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-30 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-29 14:10 [patch 1/2] Code cleanup: dwarf2_get_pc_bounds: -1/0/+1 -> enum Jan Kratochvil
2016-05-30 10:44 ` Pedro Alves
2016-05-30 12:17   ` [commit] " Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).