Commit afe4b605 authored by Jimmy Yang's avatar Jimmy Yang

Fix Bug #11765975 __FILE__ macros expanded to full path instead of relative

in CMake builds

rb://600 approved by Sunny Bains
parent 700bec21
......@@ -51,6 +51,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <mysql/plugin.h>
#include <mysql/innodb_priv.h>
#include <mysql/psi/psi.h>
#include <my_sys.h>
/** @file ha_innodb.cc */
......@@ -1146,6 +1147,20 @@ innobase_strcasecmp(
return(my_strcasecmp(system_charset_info, a, b));
}
/******************************************************************//**
Strip dir name from a full path name and return only the file name
@return file name or "null" if no file name */
extern "C" UNIV_INTERN
const char*
innobase_basename(
/*==============*/
const char* path_name) /*!< in: full path name */
{
const char* name = base_name(path_name);
return((name) ? name : "null");
}
/******************************************************************//**
Makes all characters in a NUL-terminated UTF-8 string lower case. */
extern "C" UNIV_INTERN
......@@ -9251,7 +9266,8 @@ innodb_mutex_show_status(
if (mutex->count_using > 0) {
buf1len= my_snprintf(buf1, sizeof(buf1),
"%s:%s",
mutex->cmutex_name, mutex->cfile_name);
mutex->cmutex_name,
innobase_basename(mutex->cfile_name));
buf2len= my_snprintf(buf2, sizeof(buf2),
"count=%lu, spin_waits=%lu,"
" spin_rounds=%lu, "
......@@ -9281,7 +9297,8 @@ innodb_mutex_show_status(
}
#else /* UNIV_DEBUG */
buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu",
mutex->cfile_name, (ulong) mutex->cline);
innobase_basename(mutex->cfile_name),
(ulong) mutex->cline);
buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu",
(ulong) mutex->count_os_wait);
......@@ -9297,7 +9314,8 @@ innodb_mutex_show_status(
if (block_mutex) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
"combined %s:%lu",
block_mutex->cfile_name,
innobase_basename(
block_mutex->cfile_name),
(ulong) block_mutex->cline);
buf2len = (uint) my_snprintf(buf2, sizeof buf2,
"os_waits=%lu",
......@@ -9328,7 +9346,8 @@ innodb_mutex_show_status(
}
buf1len = my_snprintf(buf1, sizeof buf1, "%s:%lu",
lock->cfile_name, (ulong) lock->cline);
innobase_basename(lock->cfile_name),
(ulong) lock->cline);
buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu",
(ulong) lock->count_os_wait);
......@@ -9343,7 +9362,8 @@ innodb_mutex_show_status(
if (block_lock) {
buf1len = (uint) my_snprintf(buf1, sizeof buf1,
"combined %s:%lu",
block_lock->cfile_name,
innobase_basename(
block_lock->cfile_name),
(ulong) block_lock->cline);
buf2len = (uint) my_snprintf(buf2, sizeof buf2,
"os_waits=%lu",
......
......@@ -173,6 +173,15 @@ innobase_strcasecmp(
const char* a, /*!< in: first string to compare */
const char* b); /*!< in: second string to compare */
/******************************************************************//**
Strip dir name from a full path name and return only its file name.
@return file name or "null" if no file name */
UNIV_INTERN
const char*
innobase_basename(
/*==============*/
const char* path_name); /*!< in: full path name */
/******************************************************************//**
Returns true if the thread is executing a SELECT statement.
@return true if thd is executing SELECT */
......
......@@ -400,7 +400,7 @@ mem_hash_remove(
fprintf(stderr,
"Memory heap or buffer freed in %s line %lu"
" did not exist.\n",
file_name, (ulong) line);
innobase_basename(file_name), (ulong) line);
ut_error;
}
......@@ -419,8 +419,9 @@ mem_hash_remove(
"in %s line %lu and tried to free in %s line %lu.\n"
"Hex dump of 400 bytes around memory heap"
" first block start:\n",
node->nth_heap, node->file_name, (ulong) node->line,
file_name, (ulong) line);
node->nth_heap,
innobase_basename(node->file_name), (ulong) node->line,
innobase_basename(file_name), (ulong) line);
ut_print_buf(stderr, (byte*)node->heap - 200, 400);
fputs("\nDump of the mem heap:\n", stderr);
mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
......@@ -763,7 +764,8 @@ mem_validate_no_assert(void)
"Inconsistency in memory heap"
" or buffer created\n"
"in %s line %lu.\n",
node->file_name, node->line);
innobase_basename(node->file_name),
node->line);
mutex_exit(&mem_hash_mutex);
......@@ -989,7 +991,8 @@ mem_print_info_low(
fprintf(outfile,
"%lu: file %s line %lu of size %lu phys.size %lu"
" with %lu blocks, type %lu\n",
node->nth_heap, node->file_name, node->line,
node->nth_heap,
innobase_basename(node->file_name), node->line,
allocated_mem, ph_size, n_blocks,
(node->heap)->type);
next_heap:
......
......@@ -40,6 +40,7 @@ Created 9/5/1995 Heikki Tuuri
#include "os0sync.h"
#include "os0file.h"
#include "srv0srv.h"
#include "ha_prototypes.h"
/*
WAIT ARRAY
......@@ -478,8 +479,8 @@ sync_array_cell_print(
fprintf(file,
"--Thread %lu has waited at %s line %lu"
" for %.2f seconds the semaphore:\n",
(ulong) os_thread_pf(cell->thread), cell->file,
(ulong) cell->line,
(ulong) os_thread_pf(cell->thread),
innobase_basename(cell->file), (ulong) cell->line,
difftime(time(NULL), cell->reservation_time));
if (type == SYNC_MUTEX) {
......@@ -493,7 +494,8 @@ sync_array_cell_print(
"Last time reserved in file %s line %lu, "
#endif /* UNIV_SYNC_DEBUG */
"waiters flag %lu\n",
(void*) mutex, mutex->cfile_name, (ulong) mutex->cline,
(void*) mutex, innobase_basename(mutex->cfile_name),
(ulong) mutex->cline,
(ulong) mutex->lock_word,
#ifdef UNIV_SYNC_DEBUG
mutex->file_name, (ulong) mutex->line,
......@@ -512,7 +514,7 @@ sync_array_cell_print(
fprintf(file,
" RW-latch at %p created in file %s line %lu\n",
(void*) rwlock, rwlock->cfile_name,
(void*) rwlock, innobase_basename(rwlock->cfile_name),
(ulong) rwlock->cline);
writer = rw_lock_get_writer(rwlock);
if (writer != RW_LOCK_NOT_LOCKED) {
......@@ -533,7 +535,7 @@ sync_array_cell_print(
(ulong) rw_lock_get_reader_count(rwlock),
(ulong) rwlock->waiters,
rwlock->lock_word,
rwlock->last_s_file_name,
innobase_basename(rwlock->last_s_file_name),
(ulong) rwlock->last_s_line,
rwlock->last_x_file_name,
(ulong) rwlock->last_x_line);
......
......@@ -407,7 +407,8 @@ rw_lock_s_lock_spin(
" cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()),
(void*) lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
innobase_basename(lock->cfile_name),
(ulong) lock->cline, (ulong) i);
}
/* We try once again to obtain the lock */
......@@ -442,7 +443,8 @@ rw_lock_s_lock_spin(
"Thread %lu OS wait rw-s-lock at %p"
" cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()),
(void*) lock, lock->cfile_name,
(void*) lock,
innobase_basename(lock->cfile_name),
(ulong) lock->cline);
}
......@@ -664,7 +666,8 @@ rw_lock_x_lock_func(
"Thread %lu spin wait rw-x-lock at %p"
" cfile %s cline %lu rnds %lu\n",
os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
innobase_basename(lock->cfile_name),
(ulong) lock->cline, (ulong) i);
}
sync_array_reserve_cell(sync_primary_wait_array,
......@@ -687,7 +690,8 @@ rw_lock_x_lock_func(
"Thread %lu OS wait for rw-x-lock at %p"
" cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline);
innobase_basename(lock->cfile_name),
(ulong) lock->cline);
}
/* these stats may not be accurate */
......
......@@ -543,7 +543,8 @@ mutex_spin_wait(
"Thread %lu spin wait mutex at %p"
" cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
innobase_basename(mutex->cfile_name),
(ulong) mutex->cline, (ulong) i);
#endif
mutex_spin_round_count += i;
......@@ -620,7 +621,8 @@ mutex_spin_wait(
fprintf(stderr,
"Thread %lu OS wait mutex at %p cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
innobase_basename(mutex->cfile_name),
(ulong) mutex->cline, (ulong) i);
#endif
mutex_os_wait_count++;
......@@ -869,7 +871,8 @@ sync_print_warning(
if (mutex->magic_n == MUTEX_MAGIC_N) {
fprintf(stderr,
"Mutex created at %s %lu\n",
mutex->cfile_name, (ulong) mutex->cline);
innobase_basename(mutex->cfile_name),
(ulong) mutex->cline);
if (mutex_get_lock_word(mutex) != 0) {
ulint line;
......
......@@ -25,6 +25,7 @@ Created 1/30/1994 Heikki Tuuri
#include "univ.i"
#include "ut0dbg.h"
#include "ha_prototypes.h"
#if defined(__GNUC__) && (__GNUC__ > 2)
#else
......@@ -55,12 +56,13 @@ ut_dbg_assertion_failed(
ut_print_timestamp(stderr);
#ifdef UNIV_HOTBACKUP
fprintf(stderr, " InnoDB: Assertion failure in file %s line %lu\n",
file, line);
innobase_basename(file), line);
#else /* UNIV_HOTBACKUP */
fprintf(stderr,
" InnoDB: Assertion failure in thread %lu"
" in file %s line %lu\n",
os_thread_pf(os_thread_get_curr_id()), file, line);
os_thread_pf(os_thread_get_curr_id()),
innobase_basename(file), line);
#endif /* UNIV_HOTBACKUP */
if (expr) {
fprintf(stderr,
......@@ -93,7 +95,8 @@ ut_dbg_stop_thread(
{
#ifndef UNIV_HOTBACKUP
fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
os_thread_pf(os_thread_get_curr_id()), file, line);
os_thread_pf(os_thread_get_curr_id()),
innobase_basename(file), line);
os_thread_sleep(1000000000);
#endif /* !UNIV_HOTBACKUP */
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment