This is the mail archive of the gdb-patches@sourceware.cygnus.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: (patch) hpjyg21: FAT_FREE_PSYMTABS


Maintainers,

I've another meta maintainer question on this :-)

Is it better to use #ifdef or have the compiler eliminate optional
code?  For instance:

	if (FAT_FREE_PSYMTABS)
	  {
	  }

If the compiler does the elimination (instead of CPP) the code is always
being checked and hence less likely to suffer bit rot.

Yes I know it's something of a radical departure from the existing
conventions.

Andrew


> + #ifdef FAT_FREE_PSYMTABS
> +
> +               /* srikanth, in the case of the Wildebeest, the psymtabs could be empty
> +                  and hence the call to find_pc_sect_psymbol() could fail to find anything.
> +                  Due potentially to a combination of bugs in compilers, linkers, loaders,
> +                  editors and debugger engineers :-), sometimes there is an overlap of
> +                  textlow and texthigh values between and multiple psymtabs. As a result,
> +                  if we are handed an address equal to the texthigh or textlow, we could
> +                  end up identifying the wrong psymtab.
> +
> +                  To be absolutely sure of the identity of the psymtab, let us verify that
> +                  the one we narrow down on, also houses pc + 4.
> +                */
> +
> +               if (p == NULL)
> +                 {
> +                   CORE_ADDR pc_plus4 = pc + 4;
> +                   if (pc_plus4 >= tpst->textlow &&
> +                       pc_plus4 <= tpst->texthigh)
> +                     return tpst;
> +                 }
> + #endif

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