Skip to content

Commit bf9aa86

Browse files
committed
Fixes to make dbug traces from Windows easier to compare with Unix traces
- Remove DBUG calls from my_winfile.c where call and parameters are already printed by mysys. - Remove DBUG from my_get_osfhandle() and my_get_open_flags() to remove DBUG noise. - Updated convert-debug-for-diff to take into account windows. - Changed some DBUG_RETURN(function()) to tmp=function(); DBUG_RETURN(tmp); This is needed as Visual C++ prints for DBUG binaries a trace for func_a() { DBUG_ENTER("func_a"); DBUG_RETURN(func_b()) } as >func_a <func_a >func_b <func_b instead of when using gcc: >func_a | >func_b | <func_b <func_a
1 parent a1211a4 commit bf9aa86

File tree

7 files changed

+44
-51
lines changed

7 files changed

+44
-51
lines changed

mysys/my_winfile.c

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,15 @@ static void invalidate_fd(File fd)
8989
/* Get Windows handle for a file descriptor */
9090
HANDLE my_get_osfhandle(File fd)
9191
{
92-
DBUG_ENTER("my_get_osfhandle");
9392
DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit);
94-
DBUG_RETURN(my_file_info[fd].fhandle);
93+
return (my_file_info[fd].fhandle);
9594
}
9695

9796

9897
static int my_get_open_flags(File fd)
9998
{
100-
DBUG_ENTER("my_get_open_flags");
10199
DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit);
102-
DBUG_RETURN(my_file_info[fd].oflag);
100+
return (my_file_info[fd].oflag);
103101
}
104102

105103
/*
@@ -347,10 +345,8 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
347345
OVERLAPPED ov= {0};
348346
LARGE_INTEGER li;
349347

350-
DBUG_ENTER("my_win_pread");
351-
352348
if(!Count)
353-
DBUG_RETURN(0);
349+
return(0);
354350
#ifdef _WIN64
355351
if(Count > UINT_MAX)
356352
Count= UINT_MAX;
@@ -369,11 +365,11 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
369365
through e.g. a command pipe in windows : see MSDN on ReadFile.
370366
*/
371367
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
372-
DBUG_RETURN(0); /*return 0 at EOF*/
368+
return(0); /*return 0 at EOF*/
373369
my_osmaperr(lastError);
374-
DBUG_RETURN((size_t)-1);
370+
return((size_t)-1);
375371
}
376-
DBUG_RETURN(nBytesRead);
372+
return(nBytesRead);
377373
}
378374

379375

@@ -382,9 +378,8 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count)
382378
DWORD nBytesRead;
383379
HANDLE hFile;
384380

385-
DBUG_ENTER("my_win_read");
386381
if(!Count)
387-
DBUG_RETURN(0);
382+
return(0);
388383
#ifdef _WIN64
389384
if(Count > UINT_MAX)
390385
Count= UINT_MAX;
@@ -400,11 +395,11 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count)
400395
through e.g. a command pipe in windows : see MSDN on ReadFile.
401396
*/
402397
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
403-
DBUG_RETURN(0); /*return 0 at EOF*/
398+
return(0); /*return 0 at EOF*/
404399
my_osmaperr(lastError);
405-
DBUG_RETURN((size_t)-1);
400+
return((size_t)-1);
406401
}
407-
DBUG_RETURN(nBytesRead);
402+
return(nBytesRead);
408403
}
409404

410405

@@ -416,12 +411,8 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
416411
OVERLAPPED ov= {0};
417412
LARGE_INTEGER li;
418413

419-
DBUG_ENTER("my_win_pwrite");
420-
DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %llu, offset: %llu",
421-
Filedes, Buffer, (ulonglong)Count, (ulonglong)offset));
422-
423414
if(!Count)
424-
DBUG_RETURN(0);
415+
return(0);
425416

426417
#ifdef _WIN64
427418
if(Count > UINT_MAX)
@@ -436,10 +427,10 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
436427
if(!WriteFile(hFile, Buffer, (DWORD)Count, &nBytesWritten, &ov))
437428
{
438429
my_osmaperr(GetLastError());
439-
DBUG_RETURN((size_t)-1);
430+
return((size_t)-1);
440431
}
441432
else
442-
DBUG_RETURN(nBytesWritten);
433+
return(nBytesWritten);
443434
}
444435

445436

@@ -448,19 +439,17 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence)
448439
LARGE_INTEGER offset;
449440
LARGE_INTEGER newpos;
450441

451-
DBUG_ENTER("my_win_lseek");
452-
453442
/* Check compatibility of Windows and Posix seek constants */
454-
compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR
455-
&& FILE_END == SEEK_END);
443+
compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR &&
444+
FILE_END == SEEK_END);
456445

457446
offset.QuadPart= pos;
458447
if(!SetFilePointerEx(my_get_osfhandle(fd), offset, &newpos, whence))
459448
{
460449
my_osmaperr(GetLastError());
461450
newpos.QuadPart= -1;
462451
}
463-
DBUG_RETURN(newpos.QuadPart);
452+
return(newpos.QuadPart);
464453
}
465454

466455

@@ -474,12 +463,8 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
474463
OVERLAPPED *pov= NULL;
475464
HANDLE hFile;
476465

477-
DBUG_ENTER("my_win_write");
478-
DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %llu", fd, Buffer,
479-
(ulonglong)Count));
480-
481466
if(!Count)
482-
DBUG_RETURN(0);
467+
return(0);
483468

484469
#ifdef _WIN64
485470
if(Count > UINT_MAX)
@@ -502,29 +487,28 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
502487
if(!WriteFile(hFile, Buffer, (DWORD)Count, &nWritten, pov))
503488
{
504489
my_osmaperr(GetLastError());
505-
DBUG_RETURN((size_t)-1);
490+
return((size_t)-1);
506491
}
507-
DBUG_RETURN(nWritten);
492+
return(nWritten);
508493
}
509494

510495

511496
int my_win_chsize(File fd, my_off_t newlength)
512497
{
513498
HANDLE hFile;
514499
LARGE_INTEGER length;
515-
DBUG_ENTER("my_win_chsize");
516500

517501
hFile= (HANDLE) my_get_osfhandle(fd);
518502
length.QuadPart= newlength;
519503
if (!SetFilePointerEx(hFile, length , NULL , FILE_BEGIN))
520504
goto err;
521505
if (!SetEndOfFile(hFile))
522506
goto err;
523-
DBUG_RETURN(0);
507+
return(0);
524508
err:
525509
my_osmaperr(GetLastError());
526510
my_errno= errno;
527-
DBUG_RETURN(-1);
511+
return(-1);
528512
}
529513

530514

@@ -555,7 +539,6 @@ File my_win_handle2File(HANDLE hFile)
555539
{
556540
int retval= -1;
557541
uint i;
558-
559542
DBUG_ENTER("my_win_handle2File");
560543

561544
for(i= MY_FILE_MIN; i < my_file_limit; i++)
@@ -623,7 +606,6 @@ FILE * my_win_fdopen(File fd, const char *type)
623606
FILE *file;
624607
int crt_fd;
625608
int flags= 0;
626-
627609
DBUG_ENTER("my_win_fdopen");
628610

629611
if(strchr(type,'a') != NULL)
@@ -641,8 +623,8 @@ FILE * my_win_fdopen(File fd, const char *type)
641623
int my_win_fclose(FILE *file)
642624
{
643625
File fd;
644-
645626
DBUG_ENTER("my_win_fclose");
627+
646628
fd= my_fileno(file);
647629
if(fd < 0)
648630
DBUG_RETURN(-1);
@@ -665,7 +647,6 @@ int my_win_fstat(File fd, struct _stati64 *buf)
665647
int crt_fd;
666648
int retval;
667649
HANDLE hFile, hDup;
668-
669650
DBUG_ENTER("my_win_fstat");
670651

671652
hFile= my_get_osfhandle(fd);

scripts/convert-debug-for-diff.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ while (<>)
2020
{
2121
s/^T@[0-9]+ *://g;
2222
s/0x[0-9a-f]+(\s|\n|\)|=|,|;)/#$1/g;
23+
s/bitmap: [0-9a-fA-F]+$/bitmap: #/g;
2324
s/size: [0-9-]+/size: #/g;
2425
s/memory_used: [0-9]+/memory_used: #/g;
26+
s/memory_used: -[0-9]+/memory_used: #/g;
2527
s/Total alloc: [0-9]+/Total alloc: #/g;
2628
s/(proc_info: )(.*:)[\d]+ /$1 /;
2729
s/(select_cond.*) at line.*/$1/;
2830
s/\(id: \d+ -> \d+\)/id: #->#/g;
2931
s/(exit: found key at )\d+/$1#/g;
30-
s/enter_stage: ([^\/]*)(\/.*\/)(.*)(:\d+)/enter_stage: ($1)/g;
32+
s/enter_stage: (.* at).*/enter_stage $1 ../g;
3133
s/crc: [0-9]+/crc: #/g;
3234
s/ref_count: [0-9]+/ref_count: #/g;
3335
s/block: # \(\d+\)/block: # (#)/g;
@@ -37,6 +39,7 @@ while (<>)
3739
s/#sql_.*_(\d+)/#sql_xxx_$1/g;
3840
s/fd: [0-9]+/fd: #/g;
3941
s/query_id: (\d+)/query_id: #/g;
40-
s|: .*/mysql-test/var/tmp/mysqld\.\d|d: var/tmp/mysqld|g;
42+
s|: .*/mysql-test/var/tmp/mysqld\.\d|: var/tmp/mysqld|g;
43+
s|: .*\\mysql-test\\var\\tmp\\mysqld\.\d|: var/tmp/mysqld|g;
4144
print $_;
4245
}

storage/maria/ma_bitmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,7 @@ static my_bool move_to_next_bitmap(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap)
11721172
{
11731173
pgcache_page_no_t page= bitmap->page;
11741174
MARIA_STATE_INFO *state= &info->s->state;
1175+
my_bool res;
11751176
DBUG_ENTER("move_to_next_bitmap");
11761177

11771178
if (state->first_bitmap_with_space != ~(pgcache_page_no_t) 0 &&
@@ -1186,7 +1187,8 @@ static my_bool move_to_next_bitmap(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap)
11861187
page+= bitmap->pages_covered;
11871188
DBUG_ASSERT(page % bitmap->pages_covered == 0);
11881189
}
1189-
DBUG_RETURN(_ma_change_bitmap_page(info, bitmap, page));
1190+
res= _ma_change_bitmap_page(info, bitmap, page);
1191+
DBUG_RETURN(res);
11901192
}
11911193

11921194

storage/maria/ma_blockrec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5281,6 +5281,7 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
52815281
{
52825282
MARIA_SHARE *share= info->s;
52835283
myf flag= MY_WME | (share->temporary ? MY_THREAD_SPECIFIC : 0);
5284+
my_bool res;
52845285
DBUG_ENTER("_ma_scan_init_block_record");
52855286
DBUG_ASSERT(info->dfile.file == share->bitmap.file.file);
52865287

@@ -5307,7 +5308,8 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
53075308
_ma_scan_block_record()), we may miss recently inserted rows (bitmap page
53085309
in page cache would be too old).
53095310
*/
5310-
DBUG_RETURN(_ma_bitmap_flush(info->s));
5311+
res= _ma_bitmap_flush(info->s);
5312+
DBUG_RETURN(res);
53115313
}
53125314

53135315

storage/maria/ma_scan.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ int maria_scan_init(register MARIA_HA *info)
4848

4949
int maria_scan(MARIA_HA *info, uchar *record)
5050
{
51+
int res;
5152
DBUG_ENTER("maria_scan");
5253
/* Init all but update-flag */
5354
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
54-
DBUG_RETURN((*info->s->scan)(info, record, info->cur_row.nextpos, 1));
55+
res= (*info->s->scan)(info, record, info->cur_row.nextpos, 1);
56+
DBUG_RETURN(res);
5557
}
5658

5759

storage/maria/ma_write.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,15 @@ int maria_write(MARIA_HA *info, const uchar *record)
428428

429429
my_bool _ma_ck_write(MARIA_HA *info, MARIA_KEY *key)
430430
{
431+
my_bool tmp;
431432
DBUG_ENTER("_ma_ck_write");
432433

433434
if (info->bulk_insert &&
434435
is_tree_inited(&info->bulk_insert[key->keyinfo->key_nr]))
435-
{
436-
DBUG_RETURN(_ma_ck_write_tree(info, key));
437-
}
438-
DBUG_RETURN(_ma_ck_write_btree(info, key));
436+
tmp= _ma_ck_write_tree(info, key);
437+
else
438+
tmp= _ma_ck_write_btree(info, key);
439+
DBUG_RETURN(tmp);
439440
} /* _ma_ck_write */
440441

441442

storage/myisam/mi_scan.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ int mi_scan_init(register MI_INFO *info)
3939

4040
int mi_scan(MI_INFO *info, uchar *buf)
4141
{
42+
int tmp;
4243
DBUG_ENTER("mi_scan");
4344
/* Init all but update-flag */
4445
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
45-
DBUG_RETURN ((*info->s->read_rnd)(info,buf,info->nextpos,1));
46+
tmp= (*info->s->read_rnd)(info,buf,info->nextpos,1);
47+
DBUG_RETURN(tmp);
4648
}

0 commit comments

Comments
 (0)