amir9480 / vscode-cpp-helper

vscode extension to create implementation for c++ function prototypes.
https://marketplace.visualstudio.com/items?itemName=amiralizadeh9480.cpp-helper
MIT License
355 stars 31 forks source link

C++ helper "Create Implementaion" cause CPU 100% #76

Open shiwenwang opened 1 month ago

shiwenwang commented 1 month ago

Type: Bug

  1. remote ssh from MAC to Ubuntu
  2. right click and select the "Create Implementaion" will reproduce it.

Extension version: 0.3.4 VS Code version: Code 1.91.1 (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:07:46.768Z) OS version: Darwin arm64 23.5.0 Modes: Connection to 'ssh-remote+ubuntu' could not be established

System Info |Item|Value| |---|---| |CPUs|Apple M3 Pro (12 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 2, 2| |Memory (System)|18.00GB (0.19GB free)| |Process Argv|--crash-reporter-id 6c9e3946-dbdc-41a3-bdcd-5ee3823a4a4b| |Screen Reader|no| |VM|0%| Connection to 'ssh-remote+ubuntu' could not be established
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 f3je6385:31013174 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31102340 nativerepl2:31104044 refactort:31108082 ccplti:31103428 pythonrstrctxtcf:31103194 ```
shiwenwang commented 1 month ago

https://github.com/user-attachments/assets/704c976a-a0eb-4372-a560-ccda0329ef93

It can be reproduced by "Copy Implementaion" also.

asynchronoust commented 2 weeks ago

I also find this problem.

the following code for example:

class USocket 
{
public:
    USocket(int in_fd): socket_fd(in_fd) {}

    ~USocket()  
    {
        if (::close(socket_fd) < 0)
        {
            U_LOG("Socket Close Error fd: %d", socket_fd);   // this is the key of this problem
        }
    }

    void send(uint8_t* src, int32_t size);
    void recv();
    void listen(int backlog);
    void accept();
    void bind(const Address& addr);
};

when the ~USocket() implementation is written in header file,the "create implementation" for other funtions will cause 100% CPU, and the implementation of other funtions will not be created in cpp file , but when i create ~USocket() implementation in cpp file, the "create implementation" works well.


no no no, i finnaly the key point is the following code in ~UScoket() U_LOG("Socket Close Error fd: %d", socket_fd);

when i delete this line, even if ~USocket() implement in header file, it also works well. when this line exist, it does not work.

and U_LOG is the macro: #define U_LOG(Format, ...) fprintf(stdout, "%s:%d "#Format"\n", __FILE__, __LINE__, ##__VA_ARGS__); it is defined in other header file included in this .h file