Re: word addressing issues

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 2017-06-07 07:27 AM, Ashutosh Pal wrote:
> Hi Simon,
> 
> Thanks for your prompt reply! Actually, this processor is also an internal one like in your case, so cannot be up-streamed either. But, as you suggest I will provide the patch and also the test scenarios it fixes, in a few days.

Thanks!

> I had one more question related to handling of character size in the word-addressed architectures: Did you change the TARGET_CHAR_BIT in gdb at your side to reflect the char size, which will at least be a single word in size here? In general, is gdb prepared to handle the change in TARGET_CHAR_BIT?

Yes, we changed TARGET_CHAR_BIT, as there are many places that use it properly.  In our case, we
changed its definition to be a call to this new function:

int
get_current_target_char_bits (void)
{
  struct gdbarch *gdbarch = target_gdbarch ();
  return gdbarch != NULL ? gdbarch_addressable_memory_unit_size (gdbarch) * 8 : 8;
}

This allows keeping compatibility with other architectures (the same GDB that debugs our
target can also be used to debug x86, for example).  If you don't care about that, you
can probably just hardcode the definition, e.g.:

#define TARGET_CHAR_BIT 32

At least that should be good for prototyping.

As I said in my previous mail, you'll probably hit a few road bumps where we either
forgot to upstream some bits or if you use features we don't use.

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.