pgbackrest.git / summary / log / commit / refs
commit dde2e2326b8b8d732ebdc6e48764d0fc381062ca
Author: David Steele <david@pgmasters.net>
Date: Mon Mar 08 22:32:36 2021 +0000
Print module type (e.g. c or h) in stack trace.
Now that there are inline functions in .h files it is important to include the extension so the functions can be found when debugging.
src/common/stackTrace.c | 6 ++----
test/src/module/common/errorTest.c | 2 +-
test/src/module/common/exitTest.c | 8 ++++----
test/src/module/common/stackTraceTest.c | 14 +++++++-------
4 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/common/stackTrace.c b/src/common/stackTrace.c
index ec929b461..023216ee4 100644
--- a/src/common/stackTrace.c
+++ b/src/common/stackTrace.c
@@ -319,8 +319,7 @@ stackTraceToZ(char *buffer, size_t bufferSize, const char *fileName, const char
}
// Output the current function
- result = stackTraceFmt(
- buffer, bufferSize, 0, "%.*s:%s:%u:(%s)", (int)(strlen(fileName) - 2), fileName, functionName, fileLine, param);
+ result = stackTraceFmt(buffer, bufferSize, 0, "%s:%s:%u:(%s)", fileName, functionName, fileLine, param);
// Output stack if there is anything on it
if (stackIdx >= 0)
@@ -334,8 +333,7 @@ stackTraceToZ(char *buffer, size_t bufferSize, const char *fileName, const char
{
StackTraceData *data = &stackTraceLocal.stack[stackIdx];
- result += stackTraceFmt(
- buffer, bufferSize, result, "\n%.*s:%s", (int)(strlen(data->fileName) - 2), data->fileName, data->functionName);
+ result += stackTraceFmt(buffer, bufferSize, result, "\n%s:%s", data->fileName, data->functionName);
if (data->fileLine > 0)
result += stackTraceFmt(buffer, bufferSize, result, ":%u", data->fileLine);
diff --git a/test/src/module/common/errorTest.c b/test/src/module/common/errorTest.c
index 7c66288b6..28655ae5f 100644
--- a/test/src/module/common/errorTest.c
+++ b/test/src/module/common/errorTest.c
@@ -215,7 +215,7 @@ testRun(void)
assert(
strcmp(
errorStackTrace(),
- TEST_PGB_PATH "/test/src/module/common/errorTest:testTryRecurse:29:(test build required for parameters)")
+ TEST_PGB_PATH "/test/src/module/common/errorTest.c:testTryRecurse:29:(test build required for parameters)")
== 0);
assert(strcmp(errorMessage(), "too many nested try blocks") == 0);
assert(strcmp(errorName(), AssertError.name) == 0);
diff --git a/test/src/module/common/exitTest.c b/test/src/module/common/exitTest.c
index ccf25f752..c50d5107f 100644
--- a/test/src/module/common/exitTest.c
+++ b/test/src/module/common/exitTest.c
@@ -105,8 +105,8 @@ testRun(void)
" options: --exec-id=1-test --process-max=4 --stanza=test\n"
" \n"
" stack trace:\n"
- " " TEST_PGB_PATH "/test/src/module/common/exitTest:testRun:92:(void)\n"
- " test:main:(argListSize: 1, argList: (char *[]))\n"
+ " " TEST_PGB_PATH "/test/src/module/common/exitTest.c:testRun:92:(void)\n"
+ " test.c:main:(argListSize: 1, argList: (char *[]))\n"
" --------------------------------------------------------------------\n"
"P00 INFO: archive-push:async command end: aborted with exception [122]\n"
"P00 DEBUG: " TEST_PGB_PATH "/src/common/lock::lockRelease: (failOnNoLock: false)\n"
@@ -135,8 +135,8 @@ testRun(void)
" options: --exec-id=1-test --process-max=4 --stanza=test\n"
" \n"
" stack trace:\n"
- " " TEST_PGB_PATH "/test/src/module/common/exitTest:testRun:123:(void)\n"
- " test:main:(argListSize: 1, argList: (char *[]))\n"
+ " " TEST_PGB_PATH "/test/src/module/common/exitTest.c:testRun:123:(void)\n"
+ " test.c:main:(argListSize: 1, argList: (char *[]))\n"
" --------------------------------------------------------------------\n"
"P00 INFO: archive-push:async command end: aborted with exception [025]");
}
diff --git a/test/src/module/common/stackTraceTest.c b/test/src/module/common/stackTraceTest.c
index 880d2e61a..4f64324c7 100644
--- a/test/src/module/common/stackTraceTest.c
+++ b/test/src/module/common/stackTraceTest.c
@@ -98,9 +98,9 @@ testRun(void)
TEST_RESULT_Z(
buffer,
- "file1:function2:99:(test build required for parameters)\n"
+ "file1.c:function2:99:(test build required for parameters)\n"
" ... function(s) omitted ...\n"
- "file1:function1:(void)",
+ "file1.c:function1:(void)",
" check stack trace");
assert(stackTracePush("file1.c", "function2", logLevelTrace) == logLevelTrace);
@@ -154,11 +154,11 @@ testRun(void)
TEST_RESULT_Z(
buffer,
- "file4:function4:99:(buffer full - parameters not available)\n"
- "file3:function3:7777:(param1: value1, param2: value2)\n"
- "file2:function2:7777:(param1: value1)\n"
- "file1:function2:7777:(debug log level required for parameters)\n"
- "file1:function1:7777:(void)",
+ "file4.c:function4:99:(buffer full - parameters not available)\n"
+ "file3.c:function3:7777:(param1: value1, param2: value2)\n"
+ "file2.c:function2:7777:(param1: value1)\n"
+ "file1.c:function2:7777:(debug log level required for parameters)\n"
+ "file1.c:function1:7777:(void)",
"stack trace");
stackTracePop("file4.c", "function4", false);
[parent: fe4ba455ed7f]