Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: rogeriodec on March 21, 2018, 03:19:30 pm

Title: Copy Debug Watch variable content to clipboard
Post by: rogeriodec on March 21, 2018, 03:19:30 pm
It is often interesting to get values that appear in "Watches" to do external calculations.
However it does not seem possible to use Ctrl + C to copy these values.
Is there any way to copy these values to the clipboard?
Title: Re: Copy Debug Watch variable content to clipboard
Post by: oBFusCATed on March 21, 2018, 03:59:43 pm
Have you tried Right click -> Copy?
The global ctrl-c is used for accelerator for the editor and so it is not really possible to use it in other windows.
This is how things worked in wxWidgets the last time I've investigated this.
Title: Re: Copy Debug Watch variable content to clipboard
Post by: rogeriodec on March 21, 2018, 04:46:46 pm
There is no "copy" option right clicking on watched variable as the attatched image.
Where can I find this option?
Title: Re: Copy Debug Watch variable content to clipboard
Post by: oBFusCATed on March 21, 2018, 05:10:18 pm
I guess the read only values cannot be copied.
You can post a request on the tickets sections about this.
Title: Re: Copy Debug Watch variable content to clipboard
Post by: rogeriodec on March 28, 2018, 09:35:29 pm
Ticked opened: https://sourceforge.net/p/codeblocks/tickets/654/
Title: Re: Copy Debug Watch variable content to clipboard
Post by: AndrewCot on August 07, 2021, 11:43:50 am
I have added support for copying watch data in my unofficial release, which you can read up on following thread:
https://forums.codeblocks.org/index.php/topic,24592.0.html

An example of the copied data for a wxString  example is:
"Copy data to clipboard"
0x25b21e4a4a0 L"ConfigurationName1 : %s"

"Copy row to clipboard"
[symbol =_M_p] , [value =0x25b21e4a4a0 L"ConfigurationName1 : %s"]


"Copy tree to clipboard"
[symbol =test1]
[value =]
[children = 3]
[child 0]
    [symbol =static npos]
    [value =18446744073709551615]
[child 1]
    [symbol =m_impl]
    [value =]
    [children = 4]
    [child 0]
        [symbol =static npos]
        [value =18446744073709551615]
    [child 1]
        [symbol =_M_dataplus]
        [value =]
        [children = 2]
        [child 0]
            [symbol =<std::allocator<wchar_t>>]
            [value =]
            [children = 2]
            [child 0]
                [symbol =<__gnu_cxx::new_allocator<wchar_t>>]
                [value =]
                [children = 1]
                [child 0]
                    [symbol =[0]]
                    [value =<No data fields>]
            [child 1]
                [symbol =[1]]
                [value =<No data fields>]
        [child 1]
            [symbol =_M_p]
            [value =0x25b21e4a4a0 L"ConfigurationName1 : %s"]
    [child 2]
        [symbol =_M_string_length]
        [value =23]
    [child 3]
        [symbol =[3]]
        [value =]
        [children = 2]
        [child 0]
            [symbol =_M_local_buf]
            [value =L"\027\000\000\000\250\024\x1c2e\375\177"]
        [child 1]
            [symbol =_M_allocated_capacity]
            [value =23]
[child 2]
    [symbol =m_convertedToChar]
    [value =]
    [children = 2]
    [child 0]
        [symbol =m_str]
        [value =0x0]
    [child 1]
        [symbol =m_len]
        [value =0]
--------------------


Attached is the updated context menu.
Title: Re: Copy Debug Watch variable content to clipboard
Post by: cacb on August 07, 2021, 01:33:56 pm
Great work! Improving debugger capabilities is important IMHO.
Title: Re: Copy Debug Watch variable content to clipboard
Post by: ollydbg on August 07, 2021, 02:17:12 pm
Great work!
Title: Re: Copy Debug Watch variable content to clipboard
Post by: oBFusCATed on August 08, 2021, 06:54:14 pm
I think this view should be removed in 2021. In 2009 it was useful when I was working on the watches dlg, but in 2021 is more than useless. :(
Title: Re: Copy Debug Watch variable content to clipboard
Post by: BlueHazzard on August 08, 2021, 10:49:23 pm
I think this view should be removed in 2021.
What view?

I have added support for copying watch data in my unofficial release, which you can read up on following thread:
Can you post a patch on SF?
Title: Re: Copy Debug Watch variable content to clipboard
Post by: AndrewCot on August 09, 2021, 12:45:04 am
@BlueHazzard Sorry for this rant (which is not your fault) as I have noticed that if your not in the IN crowd the SF tickets patches is allot of cases go no where or you have to jump through so many crazy hoops that people give up or they are not looked at or ignored or etc , so I upload a patch will get  get looked at?

If you have a Github branch I can create a PR from my https://github.com/acotty/codeblocks_sf/tree/AC-WatchsCopyData branch to it so you can look at it. If I put a PR to your master it shows 7 files changes, as your master is not up to date.


The changed files are:
    src/src/watchesdlg.cpp
    src/src/watchesdlg.h
Title: Re: Copy Debug Watch variable content to clipboard
Post by: oBFusCATed on August 09, 2021, 08:47:48 am
What view?
The view used to implement the copy function. It it shown by pressing the [...] button in the watch (I can never remember if pressing ctrl or shitf is required, see the tooltip).
Title: Re: Copy Debug Watch variable content to clipboard
Post by: AndrewCot on August 10, 2021, 01:03:03 pm
Check out reply #5 above.