[PATCH 5/8] DWARF-5 basic functionality

Pedro Alves palves@redhat.com
Mon Feb 20 11:41:00 GMT 2017


On 02/19/2017 09:26 PM, Jan Kratochvil wrote:

>>> -/* Call CALLBACK from DW_AT_ranges attribute value OFFSET.
>>> +/* Call CALLBACK from DW_AT_ranges attribute value OFFSET
>>> +   reading .debug_rnglists.
>>> +   Return 1 if the attributes are present and valid, otherwise, return 0.  */
>>> +
>>> +static int
>>> +dwarf2_rnglists_process (unsigned offset, struct dwarf2_cu *cu,
>>
>> bool/true/false?
> 
> It is just a variant of dwarf2_ranges_process which still does use int from
> the C days of GDB.
> Its return value is also passed as a return value of
> dwarf2_ranges_process.  Using bool here would need to refactor
> dwarf2_ranges_process first. 

Why would it?  bool converts to int just fine.
You're already using bool inside the function, which prompted
my comment.

Not that I'd be opposed to changing dwarf2_ranges_process too,
but I'm not seeing the "need".  If we stick with the easy
incremental progress, then over time using "int" as bool ends up
fading that way.  If we keep using "int" as bool, then we'll
never evolve past it.

> And then one can rather refactor it all to
> a virtual class and after more refactoring to a different debugger.
> 
> So I have kept it as it was.  Otherwise specify which level of refactorization
> do you wish.

All I meant was to use bool in the new code.

> 
>>> +			 std::function<void (CORE_ADDR range_beginning,
>>> +					     CORE_ADDR range_end)> callback)
>>
>> Same comment about std::function.  (and I had forgotten to suggest
>> that callback should probably be a universal reference / "&&callback").
> 
> That is OK, I have already noticed you had studied a lot of C++ schoolbooks
> before you permitted GDB to use C++.

If my comment was incorrect, feel free to correct me.
Otherwise, let's keep the discussion technical please.  How I learned
C++ is not called for here.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list