From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Blandy To: Michael Snyder Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] gdb extension for Harvard architectures Date: Thu, 04 Oct 2001 16:28:00 -0000 Message-id: References: <3BB4D843.A92818B9@cygnus.com> <3BB4E273.5020308@cygnus.com> <3BBB4D90.AE2B5AEE@cygnus.com> <3BBCADB6.6166@redhat.com> X-SW-Source: 2001-10/msg00089.html Michael Snyder writes: > > Instead of using bits, what if we added a new `const char *' field to > > `struct type'? Its value would be a string indicating the name of the > > space qualifier applied to the type, or zero indicating the default. > > Just to make sure I understand you, the string you propose is > something like "code", not the fully qualified type eg. "code int *"; > right? Yes. > > The set of permitted space names would be determined by the > > architecture, following some basic conventions (like `data' and > > `code'). There would be a gdbarch method like this: > > > > - int gdbarch_valid_addr_space_name_p (struct gdbarch *A, const char *NAME); > > Return non-zero if NAME is a valid name of an address space > > for architecture A. > > > > The parser would recognize `@ IDENTIFIER' as a space qualifier, call > > gdbarch_valid_addr_space_name_p to check it, and drop the value into > > the type it creates if so. > > > > The type printer would simply printf ("@%s", type->space); when printing. > > > > There would be a core function: > > > > - const char *type_default_addr_space (struct type *T); > > Return "code" if T is a pointer to function or method; return "data" > > otherwise. > > > > The POINTER_TO_ADDRESS and ADDRESS_TO_POINTER methods, which are the > > ones who actually *use* this info, receive the type object already, > > and can check the space as appropriate. > > OK, the reason I didn't do it like that (and I did consider it) is > a) it required a new field in the type struct, and > b) a strcmp takes longer than an integer (flag) test. > > However, I agree that this might be a reasonable extension, > especially once we get ready to let the target architecture > define its own address spaces. I wanted to get a relatively > simple initial implementation approved before I went overboard > on complexity (it's complex enough as it is). Okay.