Register
RemedyBG»Forums»Bug in struct pass-by-value display
2 posts
Bug in struct pass-by-value display
1 month, 1 week ago Edited by thynnmas on April 12, 2020, 2:29 a.m. Reason: Initial post
Hi.

First off, thanks for making something good!

Second, I couldn't find another place for bug reports, so here it goes:

The deubgger appears to struggle with pass-by-value structs in C. With the test program below you can break in `test_me`, and observe that `test` is interpreted wrong, but `wat` shows correct data. The print works as intended, so it looks like the symbol lookup for the struct is off by an indirection.

This might be related to https://remedybg.handmade.network...nspecting_forward_declared_struct but I though a simple repro might be useful nontheless.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdint.h>
#include <stdio.h>
#include <string.h>

typedef struct string {
   uint8_t *p;
   uint32_t length;
} string;

string string_from_c( const char *s )
{
   return ( string ){ .p = ( uint8_t* )s, .length = ( uint32_t )strlen( s ) };
}

void test_me( string test ){
   string wat = *(string*)&test;
   printf( "%.*s", test.length, test.p );
}

int main( int argc, char **argv )
{
   string test = string_from_c( "testing\n" );
   test_me( test );
   return 0;
}


189 posts / 1 project

None

Bug in struct pass-by-value display
1 month, 1 week ago
I assume you are using Clang? (This works fine with CL). There are some fixes for this in the latest patch as this was reported earlier in the week (0.3.0.3; available on itch.io) but there are some other additional cases that I'm working on now.

Sorry for the trouble!
2 posts
Bug in struct pass-by-value display
1 month, 1 week ago
Yes, this is clang. Sorry, I should have mentioned that.
I'm was still on 0.3.0.2, after an upgrade this case works.

Thanks!