[Top][All Lists]

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

Re: [Tinycc-devel] Add debug information.

From: Michael Matz
Subject: Re: [Tinycc-devel] Add debug information.
Date: Mon, 20 Jan 2020 01:37:55 +0100 (CET)
User-agent: Alpine 2.21 (LSU 202 2017-01-01)


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 :-/


 int main(int argc, char *argv[])

 is supported.

 Other things like structs/unions/enums/bitfields are all translated to
 This should probably change in the future.

 I also generate a new type whenever I see a pointer or array.
 This creates a lot of types but gdb seems happy with it.
 If I compile tcc with bounds-checking I see 1473 types.
 In the future types should be optimized.

 Can I apply this patch?

Attachment: tcc-add-dbg.diff
Description: Text Data

reply via email to

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