This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH] Fixup gdb.python/py-value.exp for bare-metal aarch64-elf


On 10/07/2016 09:48 AM, Yao Qi wrote:
On Fri, Oct 7, 2016 at 1:08 PM, Luis Machado <lgustavo@codesourcery.com> wrote:

I went back and read the standard and we're dealing with a freestanding
environment for bare metal here.

The descriptions above seem to make sense for a hosted environment, but not
for a freestanding one, correct?


IMO, bare metal != freestadning environment.  Since "main" function is used,
it is a hosted environment.  See
https://gcc.gnu.org/onlinedocs/gcc/Standards.html

I'm slightly confused. Are you implying that using main makes this a hosted environment even though there is no underlying OS facility at play?

The documentation states freestanding environments can use any type of startup routine they want, only having to honor a small subset of clauses.

This seems to imply that the use of "main" is allowed and the lack of underlying OS facilities make it freestanding.

Skipping the discussion of whether we have a hosted x freestanding environment, the testcase itself uses main/argc/argv. Does that mean it is supposed to be exercised only on hosted environments or only on targets providing sane argc/argv values?


"a hosted environment, which is not required, in which all the library
facilities are provided and startup is through a function int main
(void) or int main (int, char *[])."

On the other hand, in the C standard, function "main" is only mentioned in
the section of "5.1.2.2 Hosted environment".


They are mentioned there because it is a requirement for a hosted environment but, as mentioned above, freestanding programs could have a function called main as the startup function. There is no restriction on that part, correct?

More importantly, does it really matter, from a gdb testsuite point of view, whether the freestanding implementation provides main/argc/argv or not? The tests get exercised anyway, with only a small adjustment being required to make it not crash due to an assumption that is not always true (presence of argc/argv).


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