This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [rfa] mips heuristic_proc_start fix


>> 
>> Glarg.  Yes, it's signed, of course!  Let me peer at this for a moment
>> and see why the math was coming out wrong; the patch is correct, but
>> now it's not quite as obvious to me why :)
> 
> 
> No, I stand uncorrected:


Sorry, yes, my bad.

> +  if (start_pc < fence)
> +    {
> +      warning ("Warning: GDB can't find the start of the function at 0x%s (wraparound).",
> +	       paddr_nz (pc));
> +      return 0;
> +    }


Hmm, with this patch UINT_MAX would give a fence of VM_MIN_ADDRESS yet 
UINT_MAX-1 would give the above warning.

Could I suggest instead something like:

   pc = ADDR_BITS_REMOVE (pc);
   start_pc = pc;
   if (start_pc >= heuristic_fence_post)
     fence = start_pc - heuristic_fence_post;
   else
     fence = 0;
   if (start_pc == 0)
     return 0;

   if (heuristic_fence_post == UINT_MAX
       || fence < VM_MIN_ADDRESS)
     fence = VM_MIN_ADDRESS;

The test being moved to before the assignment to make what is happening 
more transparent.

	enjoy,
		Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]