summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2023-03-01 19:36:13 +0200
committerMonty <monty@mariadb.org>2023-03-02 13:11:54 +0200
commitbf9aa8687f7a00c1abc3b23c33a060a1a076bbda (patch)
tree25e32eee53cde5b45c64e71ffb1e267f69c95990
parenta1211a4eda9c7348295ce4a6fdfa8e94860e5e14 (diff)
downloadmariadb-git-bf9aa8687f7a00c1abc3b23c33a060a1a076bbda.tar.gz
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
-rw-r--r--mysys/my_winfile.c63
-rwxr-xr-xscripts/convert-debug-for-diff.sh7
-rw-r--r--storage/maria/ma_bitmap.c4
-rw-r--r--storage/maria/ma_blockrec.c4
-rw-r--r--storage/maria/ma_scan.c4
-rw-r--r--storage/maria/ma_write.c9
-rw-r--r--storage/myisam/mi_scan.c4
7 files changed, 44 insertions, 51 deletions
diff --git a/mysys/my_winfile.c b/mysys/my_winfile.c
index 35bc6b35399..7a1e3e60b12 100644
--- a/mysys/my_winfile.c
+++ b/mysys/my_winfile.c
@@ -89,17 +89,15 @@ static void invalidate_fd(File fd)
/* Get Windows handle for a file descriptor */
HANDLE my_get_osfhandle(File fd)
{
- DBUG_ENTER("my_get_osfhandle");
DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit);
- DBUG_RETURN(my_file_info[fd].fhandle);
+ return (my_file_info[fd].fhandle);
}
static int my_get_open_flags(File fd)
{
- DBUG_ENTER("my_get_open_flags");
DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit);
- DBUG_RETURN(my_file_info[fd].oflag);
+ return (my_file_info[fd].oflag);
}
/*
@@ -347,10 +345,8 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
OVERLAPPED ov= {0};
LARGE_INTEGER li;
- DBUG_ENTER("my_win_pread");
-
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
Count= UINT_MAX;
@@ -369,11 +365,11 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
through e.g. a command pipe in windows : see MSDN on ReadFile.
*/
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
- DBUG_RETURN(0); /*return 0 at EOF*/
+ return(0); /*return 0 at EOF*/
my_osmaperr(lastError);
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
- DBUG_RETURN(nBytesRead);
+ return(nBytesRead);
}
@@ -382,9 +378,8 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count)
DWORD nBytesRead;
HANDLE hFile;
- DBUG_ENTER("my_win_read");
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
Count= UINT_MAX;
@@ -400,11 +395,11 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count)
through e.g. a command pipe in windows : see MSDN on ReadFile.
*/
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
- DBUG_RETURN(0); /*return 0 at EOF*/
+ return(0); /*return 0 at EOF*/
my_osmaperr(lastError);
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
- DBUG_RETURN(nBytesRead);
+ return(nBytesRead);
}
@@ -416,12 +411,8 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
OVERLAPPED ov= {0};
LARGE_INTEGER li;
- DBUG_ENTER("my_win_pwrite");
- DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %llu, offset: %llu",
- Filedes, Buffer, (ulonglong)Count, (ulonglong)offset));
-
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
@@ -436,10 +427,10 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
if(!WriteFile(hFile, Buffer, (DWORD)Count, &nBytesWritten, &ov))
{
my_osmaperr(GetLastError());
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
else
- DBUG_RETURN(nBytesWritten);
+ return(nBytesWritten);
}
@@ -448,11 +439,9 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence)
LARGE_INTEGER offset;
LARGE_INTEGER newpos;
- DBUG_ENTER("my_win_lseek");
-
/* Check compatibility of Windows and Posix seek constants */
- compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR
- && FILE_END == SEEK_END);
+ compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR &&
+ FILE_END == SEEK_END);
offset.QuadPart= pos;
if(!SetFilePointerEx(my_get_osfhandle(fd), offset, &newpos, whence))
@@ -460,7 +449,7 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence)
my_osmaperr(GetLastError());
newpos.QuadPart= -1;
}
- DBUG_RETURN(newpos.QuadPart);
+ return(newpos.QuadPart);
}
@@ -474,12 +463,8 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
OVERLAPPED *pov= NULL;
HANDLE hFile;
- DBUG_ENTER("my_win_write");
- DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %llu", fd, Buffer,
- (ulonglong)Count));
-
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
@@ -502,9 +487,9 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
if(!WriteFile(hFile, Buffer, (DWORD)Count, &nWritten, pov))
{
my_osmaperr(GetLastError());
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
- DBUG_RETURN(nWritten);
+ return(nWritten);
}
@@ -512,7 +497,6 @@ int my_win_chsize(File fd, my_off_t newlength)
{
HANDLE hFile;
LARGE_INTEGER length;
- DBUG_ENTER("my_win_chsize");
hFile= (HANDLE) my_get_osfhandle(fd);
length.QuadPart= newlength;
@@ -520,11 +504,11 @@ int my_win_chsize(File fd, my_off_t newlength)
goto err;
if (!SetEndOfFile(hFile))
goto err;
- DBUG_RETURN(0);
+ return(0);
err:
my_osmaperr(GetLastError());
my_errno= errno;
- DBUG_RETURN(-1);
+ return(-1);
}
@@ -555,7 +539,6 @@ File my_win_handle2File(HANDLE hFile)
{
int retval= -1;
uint i;
-
DBUG_ENTER("my_win_handle2File");
for(i= MY_FILE_MIN; i < my_file_limit; i++)
@@ -623,7 +606,6 @@ FILE * my_win_fdopen(File fd, const char *type)
FILE *file;
int crt_fd;
int flags= 0;
-
DBUG_ENTER("my_win_fdopen");
if(strchr(type,'a') != NULL)
@@ -641,8 +623,8 @@ FILE * my_win_fdopen(File fd, const char *type)
int my_win_fclose(FILE *file)
{
File fd;
-
DBUG_ENTER("my_win_fclose");
+
fd= my_fileno(file);
if(fd < 0)
DBUG_RETURN(-1);
@@ -665,7 +647,6 @@ int my_win_fstat(File fd, struct _stati64 *buf)
int crt_fd;
int retval;
HANDLE hFile, hDup;
-
DBUG_ENTER("my_win_fstat");
hFile= my_get_osfhandle(fd);
diff --git a/scripts/convert-debug-for-diff.sh b/scripts/convert-debug-for-diff.sh
index 4d266a6d526..3a22c74555d 100755
--- a/scripts/convert-debug-for-diff.sh
+++ b/scripts/convert-debug-for-diff.sh
@@ -20,14 +20,16 @@ while (<>)
{
s/^T@[0-9]+ *://g;
s/0x[0-9a-f]+(\s|\n|\)|=|,|;)/#$1/g;
+ s/bitmap: [0-9a-fA-F]+$/bitmap: #/g;
s/size: [0-9-]+/size: #/g;
s/memory_used: [0-9]+/memory_used: #/g;
+ s/memory_used: -[0-9]+/memory_used: #/g;
s/Total alloc: [0-9]+/Total alloc: #/g;
s/(proc_info: )(.*:)[\d]+ /$1 /;
s/(select_cond.*) at line.*/$1/;
s/\(id: \d+ -> \d+\)/id: #->#/g;
s/(exit: found key at )\d+/$1#/g;
- s/enter_stage: ([^\/]*)(\/.*\/)(.*)(:\d+)/enter_stage: ($1)/g;
+ s/enter_stage: (.* at).*/enter_stage $1 ../g;
s/crc: [0-9]+/crc: #/g;
s/ref_count: [0-9]+/ref_count: #/g;
s/block: # \(\d+\)/block: # (#)/g;
@@ -37,6 +39,7 @@ while (<>)
s/#sql_.*_(\d+)/#sql_xxx_$1/g;
s/fd: [0-9]+/fd: #/g;
s/query_id: (\d+)/query_id: #/g;
- s|: .*/mysql-test/var/tmp/mysqld\.\d|d: var/tmp/mysqld|g;
+ s|: .*/mysql-test/var/tmp/mysqld\.\d|: var/tmp/mysqld|g;
+ s|: .*\\mysql-test\\var\\tmp\\mysqld\.\d|: var/tmp/mysqld|g;
print $_;
}
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 61fe4f9d080..ec1b0955655 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -1172,6 +1172,7 @@ static my_bool move_to_next_bitmap(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap)
{
pgcache_page_no_t page= bitmap->page;
MARIA_STATE_INFO *state= &info->s->state;
+ my_bool res;
DBUG_ENTER("move_to_next_bitmap");
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)
page+= bitmap->pages_covered;
DBUG_ASSERT(page % bitmap->pages_covered == 0);
}
- DBUG_RETURN(_ma_change_bitmap_page(info, bitmap, page));
+ res= _ma_change_bitmap_page(info, bitmap, page);
+ DBUG_RETURN(res);
}
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index baa777edcf0..744b0f656b5 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -5281,6 +5281,7 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
{
MARIA_SHARE *share= info->s;
myf flag= MY_WME | (share->temporary ? MY_THREAD_SPECIFIC : 0);
+ my_bool res;
DBUG_ENTER("_ma_scan_init_block_record");
DBUG_ASSERT(info->dfile.file == share->bitmap.file.file);
@@ -5307,7 +5308,8 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info)
_ma_scan_block_record()), we may miss recently inserted rows (bitmap page
in page cache would be too old).
*/
- DBUG_RETURN(_ma_bitmap_flush(info->s));
+ res= _ma_bitmap_flush(info->s);
+ DBUG_RETURN(res);
}
diff --git a/storage/maria/ma_scan.c b/storage/maria/ma_scan.c
index 5f2945a3078..3e789489090 100644
--- a/storage/maria/ma_scan.c
+++ b/storage/maria/ma_scan.c
@@ -48,10 +48,12 @@ int maria_scan_init(register MARIA_HA *info)
int maria_scan(MARIA_HA *info, uchar *record)
{
+ int res;
DBUG_ENTER("maria_scan");
/* Init all but update-flag */
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
- DBUG_RETURN((*info->s->scan)(info, record, info->cur_row.nextpos, 1));
+ res= (*info->s->scan)(info, record, info->cur_row.nextpos, 1);
+ DBUG_RETURN(res);
}
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 1dbee5d744a..88f3d22c205 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -428,14 +428,15 @@ err2:
my_bool _ma_ck_write(MARIA_HA *info, MARIA_KEY *key)
{
+ my_bool tmp;
DBUG_ENTER("_ma_ck_write");
if (info->bulk_insert &&
is_tree_inited(&info->bulk_insert[key->keyinfo->key_nr]))
- {
- DBUG_RETURN(_ma_ck_write_tree(info, key));
- }
- DBUG_RETURN(_ma_ck_write_btree(info, key));
+ tmp= _ma_ck_write_tree(info, key);
+ else
+ tmp= _ma_ck_write_btree(info, key);
+ DBUG_RETURN(tmp);
} /* _ma_ck_write */
diff --git a/storage/myisam/mi_scan.c b/storage/myisam/mi_scan.c
index 8d436c4eada..24aca8e8751 100644
--- a/storage/myisam/mi_scan.c
+++ b/storage/myisam/mi_scan.c
@@ -39,8 +39,10 @@ int mi_scan_init(register MI_INFO *info)
int mi_scan(MI_INFO *info, uchar *buf)
{
+ int tmp;
DBUG_ENTER("mi_scan");
/* Init all but update-flag */
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
- DBUG_RETURN ((*info->s->read_rnd)(info,buf,info->nextpos,1));
+ tmp= (*info->s->read_rnd)(info,buf,info->nextpos,1);
+ DBUG_RETURN(tmp);
}