Menu

#290 Code::Blocks crashes when adding vector to watch

Undefined
open
nobody
Debugger (27)
Bug_Report
2018-10-14
2016-01-21
effemmeffe
No

C::B 15.12 rev 10596
SDK version 1.29.0
wx2.8.12 (Windows, Unicode) - 32 bit

Windows 10 Pro 64 bit

I define a locale vector in a function:
char buffer_data[SIZE_BUFFER];
where SIZE_BUFFER is 16384
If I try to watch size_buffer C::B freezes and I can't do anything but force it to close with task manager.

Discussion

  • ollydbg

    ollydbg - 2016-01-22

    I suggest you give us a minimal test code, and the steps you did when debugging, so that other people can try the steps in their computers.

     
  • effemmeffe

    effemmeffe - 2016-01-22

    I can provide all the project.
    It's a small project to concatenate two intel-hex files.
    It's just a main.c, a main.h and two files for the intel-hex functions.
    Is there some place I can upload the whole project zipped?

     
  • ollydbg

    ollydbg - 2016-01-24

    Just upload the test file as attachments.

     
  • effemmeffe

    effemmeffe - 2016-01-25

    Let me know if it works.

     
  • ollydbg

    ollydbg - 2016-01-26

    OK, I can build your project, but this project is quite complex, and I suggest you give us a minimal code. Also, you should tell us what is the steps you do when you debugging? When you add the watch? Thanks.

     
  • effemmeffe

    effemmeffe - 2016-01-26

    I'm sorry, I forgot to point out where the problem happens.
    If you look at the end of main.c file you can see the function append_file_boot.
    In it is defined the vector char buffer_data[SIZE_BUFFER]
    Put a breakpoint in the first line of that function and run the debugger, of course in debug mode, it should run straight to the breakpoint with the program argument I set up in the cbp project.
    Then try to watch the vector buffer_data you should get the freeze I'm getting.
    It's happening even with the locals disabled.
    I can see the watch window with the vector in it, but as soon as I try to move the watch window C::B freezes.
    Let me know if you need more directions.

     
  • ollydbg

    ollydbg - 2016-01-26

    I can debug the app, but I can't reach the breakpoint.

    For your issue, this is because you try to see some un-initialized local variable. I think you can add a command like: (200 is the max number to print)

        set print elements 200
    

    See here: http://stackoverflow.com/a/233339/154911

    This way, GDB should work quite well.

     
  • effemmeffe

    effemmeffe - 2016-01-26

    In the project->set programs' argument setting put this for Debug target:
    -a TestApp.hex -b TestBoot.hex -s 0x7000 -o Test-App+Boot.hex
    Then compile and run, it should breaks on the first line of append_file_boot function.

     
  • ollydbg

    ollydbg - 2016-01-26

    Still can't hit the breakpoint.
    Did you take my suggest way already? That should fix your issue.

     
  • effemmeffe

    effemmeffe - 2016-01-26

    No, I don't. Because it would be useless to me: I need to see what happens at the end of the buffer, so I don't care to watch the first 200 bytes of it.

    About debugging: sorry, I changed the project to upload here and I wrote the wrong program argument, it should be:
    -a Test\Test-App.hex -b Test\Test-Boot.hex -s 0x7000 -o Test\Test-App+Boot.hex
    and works with the attached files put in the Test directory.

     
    • ollydbg

      ollydbg - 2016-01-30

      I need to see what happens at the end of the buffer

      You can use the GDB's x command to view all the contents, such as:

      [debug]> x /30x buffer_data+16000
      [debug]0x22fa04:    0x15    0x9e    0x80    0x7c    0x20    0x29    0x24    0x00
      [debug]0x22fa0c:    0x1c    0x00    0xfa    0x7f    0x94    0x68    0x40    0x00
      [debug]0x22fa14:    0x00    0x00    0x40    0x00    0x0f    0x00    0x00    0x00
      [debug]0x22fa1c:    0x00    0x00    0x00    0x00    0xa8    0x32
      

      Which means you want to see 30 bytes from the address "buffer_data+16000".

       
  • ollydbg

    ollydbg - 2016-01-30

    OK, I can see the content of the buffer, not from the watch window, but from the debugger debug log penel, here is the log:

    [debug]> whatis buffer_data
    [debug]type = char [16384]
    [debug]>>>>>>cb_gdb:
    [debug]> output buffer_data
    [debug]'\000' <repeats 10914 times>, "\065\000!窋|T\350\"\000h煈|鸁憒P\006\000\000\000\000\065\000\001", '\000' <repeats 23 times>, "p)\000\000\000\000\000\000\350\f5\000\000\000\000\000\030\000\000\000\000\000\000\000x\001\065", '\000' <repeats 33 times>, "@\006\065", '\000' <repeats 89 times>, "x\001\065", '\000' <repeats 25 times>, "x\001\065\000\360\f5", '\000' <repeats 109 times>, "\320\000\000\000\000\000\000\000\340\f5", '\000' <repeats 25 times>, "c\004\000\000\000\000\000\000\000\000\000\000p)", '\000' <repeats 14 times>, "x\001\065\000x\001\065\000\000\000\000\000\210\006\065", '\000'......
    

    You see, all the contents is shown. But they are just random values.

     
  • Teodor Petrov

    Teodor Petrov - 2016-01-30

    You see random values, because this is treated as char string. If you go to the watch properties (right click -> properties) and then you can tell c::b to interpret it as array. You can give it the start position and the size.

    Also the x command is the same as the examine memory window.

     
  • Teodor Petrov

    Teodor Petrov - 2016-01-30

    Also you can enter buffer_data+16000 in the watches. It supports evaluating expressions.

     
  • Teodor Petrov

    Teodor Petrov - 2018-10-14
    • labels: --> Debugger
    • Milestone: Release_xx.yy --> Undefined
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.