Register
RemedyBG»Forums»Not all breakpoints being hit?
Jason
122 posts
Not all breakpoints being hit?
3 weeks, 2 days ago Edited by Jason on Nov. 15, 2019, 5:32 p.m. Reason: Initial post
So it seems I'm able to break on certain parts of my code but not others. For example, I set three breakpoints at lines 388, 393 and 404:

 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
26
27
28
29
30
31
32
33
34
388   if (KeyPressed(keyboard->ActionRight))
         {
             QueueAnimation($(player->animQueue), player->animData, "right-cross", PlayBackStatus::IMMEDIATE);
         };

393   player->currentAnim = UpdateAnimationState($(player->animQueue), deltaT);
         defer { CleanUpAnimation($(player->currentAnim)); };

         ApplyAnimationToSkeleton($(player->skel), player->currentAnim);

         UpdateSkeletonBoneWorldPositions($(player->skel), player->world.translation);
         UpdateSkeletonBoneWorldPositions($(enemy->skel), enemy->world.translation);

         UpdateCollisionBoxWorldPos_BasedOnCenterPoint($(player->hurtBox), player->world.translation);
         UpdateCollisionBoxWorldPos_BasedOnCenterPoint($(enemy->hurtBox), enemy->world.translation);

404   if(StringCmp(player->currentAnim.name, "right-cross"))
         {
             UpdateHitBoxStatus($(player->hitBox), player->currentAnim.currentTime);
             UpdateHitBoxStatus($(enemy->hitBox), enemy->currentAnim.currentTime);

             if(player->hitBox.isActive)
             {
                 player->hitBox.worldPos = {0.0f, 0.0f};
                 player->hitBox.worldPosOffset = {0.2f, 1.0f};
                 player->hitBox.size = {0.4f, 0.4f};

                 UpdateCollisionBoxWorldPos_BasedOnCenterPoint($(player->hitBox), player->world.translation);
                 b collisionOccurred = CheckForFighterCollisions_AxisAligned(player->hitBox, enemy->hurtBox);

                 if(collisionOccurred)
                     BGZ_CONSOLE("ahhahha");
             }
         }


breakpoints 388 and 393 seem to work fine but breakpoint 404 does not work. This also occurs at other points in my code.

I'm running the current remedy version (0.2.8.9)
I'm building with msvc 2017
Here is my current msvc bat file:

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@echo off

misc\ctime -begin timings_file_for_this_build.ctm

if not defined DevEnvDir ( call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" )

w: REM since above call to vcvars seems to change directories we need to chang back to this project dir

REM %~dp0 represents the full directory path to your batch file 
set cwd=%~dp0\

set PreProcessorSwitches=-DDEVELOPMENT_BUILD=1 -DGLEW_STATIC=1

REM Debug/Development build                                     
set CommonCompilerFlags=-Gm- -MP -Z7 -nologo -Oi -Od -WX -W3 -GR -EHa- -arch:AVX -std:c++17 -wd4505 -wd4101 -wd4530 -w14700 
set CommonLinkerFlags=-subsystem:windows -machine:x64 -incremental:no -nologo -opt:ref -debug -ignore:4099

set GameIncludePaths=-I %cwd%"third_party/boagz/include" -I %cwd%"third_party/boagz/src" -I %cwd%"third_party/stb/include"
set GameLibraryPaths=

set PlatformIncludePaths=-I %cwd%"third_party/boagz/include" -I %cwd%"third_party/boagz/src" -I %cwd%"third_party/glew-2.1.0/include" -I %cwd%"third_party/stb/include"
set PlatformLibraryPaths=-LIBPATH:%cwd%"third_party/glew-2.1.0/lib/win64-release"
set PlatformImportLibraries="user32.lib" "OpenGL32.lib" "gdi32.lib" "xinput.lib" "Winmm.lib"
set PlatformStaticLibraries="glew32s.lib"

IF NOT EXIST build mkdir build
pushd build

REM Clear out pdb files so build directory doesn't get too huge and build app DLL
del *.pdb > NUL 2> NUL
cl /c ..\source\gamecode.cpp %CommonCompilerFlags% %GameIncludePaths% %PreProcessorSwitches%
link gamecode.obj -dll -PDB:gamecode_%random%.pdb -export:GameUpdate %CommonLinkerFlags% 

REM Build exe
cl /c ..\source\win64_shadowgods.cpp %CommonCompilerFlags% %PlatformIncludePaths% %PreProcessorSwitches% 
link win64_shadowgods.obj -OUT:win64_shadowgods.exe %CommonLinkerFlags% %PlatformLibraryPaths% %PlatformImportLibraries% %PlatformStaticLibraries%

popd

misc\ctime -end timings_file_for_this_build.ctm
149 posts / 1 project

None

Not all breakpoints being hit?
3 weeks, 2 days ago
If I may, I would like to ask a few additional questions to help me narrow it down. How is "defer" defined? What is the $() syntax about and how does it work? If possible, can you send me the PDB for the DLL (or wherever that particular code is at) along with the offending function name to the protonmail address? Should be able to track it down pretty quick from there.

Thanks much.

--
George
Simon Anciaux
690 posts
Not all breakpoints being hit?
3 weeks, 1 day ago
I'm not going to help but I also would like to know what the $( ) syntax is ?
Jason
122 posts
Not all breakpoints being hit?
3 weeks, 1 day ago
Oh ya, forgot I had those in there. So my defer is currently defined like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
template <typename F>
struct Defer {
    Defer( F f ) : f( f ) {}
    ~Defer( ) { f( ); }
    F f;
};

template <typename F>
Defer<F> makeDefer( F f ) {
    return Defer<F>( f );
};

#define __defer( line ) defer_ ## line
#define _defer( line ) __defer( line )

struct defer_dummy { };
template<typename F>
Defer<F> operator+( defer_dummy, F&& f )
{
    return makeDefer<F>( std::forward<F>( f ) );
}

#define defer auto _defer( __LINE__ ) = defer_dummy( ) + [ & ]( )


(Think I got this implementation from a post here but can't remember) and the $() syntax is sort of a compiler enforced out param. Just a way for me to explicitly recognize out parameters at the call site. All this is is a #define to std::move:

1
#define $(var) std::move(var)


I know this isn't how std::move is traditionally suppose to be used but been doing it for a couple months now and haven't run into much issue. And no problem x13pixels, I'll email you that stuff shortly
Jason
122 posts
Not all breakpoints being hit?
3 weeks, 1 day ago Edited by Jason on Nov. 16, 2019, 3:08 p.m.
@x13pixels Okay so tested it again today and now the breakpoints for the dll seem to be working fine but I can't get any to work for my exe. I've closed and reopened the app a couple times and get the same issue. I checked the modules pane and it shows that the exe symbols were loaded. I'll keep trying to see if I find any patterns but in the meantime I'll send you my exe pdb file as well as my exe source file. Right now no matter what breakpoint I set in my exe's game loop none of the breakpoints are being hit.
149 posts / 1 project

None

Not all breakpoints being hit?
2 weeks, 6 days ago
For the record, we tracked this down to a problem in the handling of a lambda in the middle of WinMain. RemedyBG makes some assumptions in the symbol / line number handling that are incorrect in this case.

--
George