Skip to content

Commit

Permalink
Add debug statements in cwd.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Jun 8, 2024
1 parent 60e4c4a commit 128dcb6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/engine/cwd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,62 @@ namespace

void cwd_init( void )
{
err_puts( "Entering cwd_init()\n" );

int buffer_size = PATH_MAX;
char * cwd_buffer = 0;
int error;

assert( !cwd_ );

err_puts( "After assert() in cwd_init\n" );

do
{
char * const buffer = (char *)BJAM_MALLOC_RAW( buffer_size );

err_puts( "After BJAM_MALLOC_RAW() in cwd_init\n" );

#ifdef OS_VMS
/* cwd in POSIX-format */
cwd_buffer = getcwd( buffer, buffer_size, 0 );
#else
cwd_buffer = getcwd( buffer, buffer_size );
#endif

err_puts( "After getcwd() in cwd_init\n" );

error = errno;

if ( cwd_buffer )
{
err_puts( "In if(cwd_buffer) in cwd_init\n" );

/* We store the path using its canonical/long/key format. */
OBJECT * cwd = object_new( cwd_buffer );

err_puts( "After object_new(cwd_buffer) in cwd_init\n" );

cwd_ = path_as_key( cwd );

err_puts( "After path_as_key(cwd) in cwd_init\n" );

object_free( cwd );

err_puts( "After object_free(cwd) in cwd_init\n" );

cwd_s = cwd_buffer;
}

buffer_size *= 2;
BJAM_FREE_RAW( buffer );

err_puts( "After BJAM_FREE_RAW(buffer) in cwd_init\n" );
}
while ( !cwd_ && error == ERANGE );

err_puts( "After do..while in cwd_init\n" );

if ( !cwd_ )
{
errno_puts( "can not get current working directory" );
Expand Down
2 changes: 2 additions & 0 deletions src/engine/jam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,8 @@ int main( int argc, char * * argv )
InitGraf( &qd.thePort );
#endif

err_puts( "After InitGraf()\n" );

cwd_init();

err_puts( "After cwd_init()\n" );
Expand Down

0 comments on commit 128dcb6

Please sign in to comment.