tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] A few question


From: Kieron Dunbar
Subject: Re: [Tinycc-devel] A few question
Date: Wed, 12 Feb 2003 16:58:17 +0000

Once upon a time, Peter Finderup Lund wrote thus:
> On Wed, 12 Feb 2003, Kieron Dunbar wrote:

>> #0  0x081acc92 in bound_error ()
> What if you try without tcc's bounds checking?

It works fine then (although I can crash gdb by asking it to set a breakpoint).

>> If I replace the strcpy() in user_name() with sprintf(), it crashes at the
>> same point with:

> Okay, so you actually /do/ know where in your code it happens?  A code
> snippet would be oh so extremely useful :)

I do now. The code in question isn't that useful, as simply calling that code
gives no error. In any case, it's:

void user_name(char *buf, int id)
{
        struct passwd *pw;

        /* Look up the user name */
        if ((pw = getpwuid(id)))
        {
                (void)strcpy(buf, pw->pw_name);
                buf[16] = '\0';
...

where buf is a global 32 character array.

> otherwise it would be so slow as to be unusable on many programs.  It
> looks like it has some problems with the house keeping...

I don't know what the problem is, but I haven't found tcc programs to work
properly in gdb in general. For instance, "int main(void) { return 0; }" gives
the following error if I step through it to the end of the program:

Warning:
Cannot insert breakpoint 0.
Error accessing memory address 0x1: Input/output error.
The same program may be running in another process.

I haven't tried running other complicated programs with it because it tends to
run into problems with them (e.g. it includes most of stdbool.h, but not all of
it).

-- 
kwaheri, Kieron




reply via email to

[Prev in Thread] Current Thread [Next in Thread]