tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Add debug information.


From: Herman ten Brugge
Subject: Re: [Tinycc-devel] Add debug information.
Date: Tue, 21 Jan 2020 22:44:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2020-01-20 01:37, Michael Matz wrote:
Hello,

On Sat, 18 Jan 2020, Herman ten Brugge via Tinycc-devel wrote:

Oops. Sent the wrong patch. See correct one in attachment.

 I created a path to add debug type information (see attachment).

 The patch only supports basic types and array/ptr types of them.

It also doesn't deal with scopes, i.e. represents this incorrectly:

int foo (void) {
  int i = 1;
  float f;
  if (i) {
    float i = 1.0;
    f = i;
  }
  return i + f;
}

It's still useful, of course, also with the limitation.  Some time ago I approached the debug problem from that angle first before dealing with types, see attached patch (which makes all variable be int).  But I didn't like the outcome in that it uses a new data structure for the scopes and the associated book keeping.  The difficulty with stabs is that the variables for a scope need to be emitted directly _before_ the scope-open stab, which really goes against the structure of TCCs parser, as the open/close stabs still need to form a correct nesting, so there's no natural place to emit the variable stabs :-/

I updated the patch. It now uses LBRAC/RBRAC. I also fixed some other minor problems. I also had to use a new struct to save debugging info. With stabs you also cannot mix LINE info and SYM info.

With the current patch debugging is a lot easier.
In a followed up patch I will probably add support for structs/unions/enums/bitfields. This will take some time. Stabs format is a bit difficult to implement correctly.

This also has to wait until the end of next month.

Regards,

    Herman

Attachment: patch
Description: Text document


reply via email to

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