tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] Prevent variables from showing in GDB?


From: Levo D
Subject: [Tinycc-devel] Prevent variables from showing in GDB?
Date: Mon, 20 Feb 2023 07:18:48 +0000 (UTC)

I generate c source code and compile with `tcc -g -`. My generation code isn't 
sophisticated yet so there's a lot of unnamed temporary variables. Is there a 
reserved prefix that tcc will know not to create debug information for? So gdb 
won't show the variables?

If tcc has a way to mark a variable to be hidden that'd be very useful too. 
clang++ hides it when using c++ nodebug attribute. Here's a non tcc demo of 
what I'm trying to accomplish

int main() {
        int a [[gnu::nodebug]] = 1;
        int b = 2;
        int c = 3;
        return 0;
}

$ clang++ -g test.cpp 
$ gdb ./a.out -batch -ex 'br test.cpp:5' -ex 'r' -ex 'info locals'
Breakpoint 1 at 0x1140: file test.cpp, line 5.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Breakpoint 1, main () at test.cpp:5
5               return 0;
b = 2
c = 3




reply via email to

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