Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MUST-containers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
High Performance Computing - Public
MUST-containers
Commits
898062bd
Verified
Commit
898062bd
authored
1 year ago
by
Simon Schwitanski
Browse files
Options
Downloads
Patches
Plain Diff
Add stack path depth patch
parent
2d103921
No related branches found
No related tags found
No related merge requests found
Pipeline
#396486
passed
1 year ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Dockerfile
+1
-0
1 addition, 0 deletions
Dockerfile
patches/stack-path-depth.patch
+75
-0
75 additions, 0 deletions
patches/stack-path-depth.patch
with
76 additions
and
0 deletions
Dockerfile
+
1
−
0
View file @
898062bd
...
@@ -115,6 +115,7 @@ RUN cd MUST-v${MUST_VERSION} && \
...
@@ -115,6 +115,7 @@ RUN cd MUST-v${MUST_VERSION} && \
patch externals/typeart/scripts/typeart-wrapper.in < /patches/typeart-fpic.patch
&&
\
patch externals/typeart/scripts/typeart-wrapper.in < /patches/typeart-fpic.patch
&&
\
patch modules/MpiTypeArt/MpiTypeArt.cpp < /patches/typeart-output.patch
&&
\
patch modules/MpiTypeArt/MpiTypeArt.cpp < /patches/typeart-output.patch
&&
\
patch
-p1
< /patches/relative-paths.patch
&&
\
patch
-p1
< /patches/relative-paths.patch
&&
\
patch
-p1
< /patches/stack-path-depth.patch
&&
\
cd
build
&&
\
cd
build
&&
\
CC
=
clang
CXX
=
clang++
MPICH_CC
=
clang
MPICH_CXX
=
clang++
OMPI_CC
=
clang
OMPI_CXX
=
clang
\
CC
=
clang
CXX
=
clang++
MPICH_CC
=
clang
MPICH_CXX
=
clang++
OMPI_CC
=
clang
OMPI_CXX
=
clang
\
cmake ..
-DCMAKE_INSTALL_PREFIX
=
/opt/must
-DUSE_BACKWARD
=
ON
-DENABLE_TESTS
=
ON
-DENABLE_FORTRAN
=
ON
-DLLVM_FILECHECK_PATH
=
$(
which FileCheck
)
-DCMAKE_BUILD_TYPE
=
Release
&&
\
cmake ..
-DCMAKE_INSTALL_PREFIX
=
/opt/must
-DUSE_BACKWARD
=
ON
-DENABLE_TESTS
=
ON
-DENABLE_FORTRAN
=
ON
-DLLVM_FILECHECK_PATH
=
$(
which FileCheck
)
-DCMAKE_BUILD_TYPE
=
Release
&&
\
...
...
This diff is collapsed.
Click to expand it.
patches/stack-path-depth.patch
0 → 100644
+
75
−
0
View file @
898062bd
diff --git a/modules/MustBase/InitLocationId.cpp b/modules/MustBase/InitLocationId.cpp
index 202cf077..184b61f7 100644
--- a/modules/MustBase/InitLocationId.cpp
+++ b/modules/MustBase/InitLocationId.cpp
@@ -72,6 +72,12 @@
InitLocationId::InitLocationId(const char* instanceName)
<< std::endl;
assert(0);
}
+
+ myStackPathDepth = -1;
+ const char* depth_str = std::getenv("MUST_STACKTRACE_PATH_DEPTH");
+ if (depth_str != nullptr) {
+ myStackPathDepth = std::atoi(depth_str);
+ }
}
//=============================
@@ -90,6 +96,31 @@
InitLocationId::~InitLocationId()
}
}
+std::string InitLocationId::truncatePath(int height, std::string path)
+{
+ if (height <= 0)
+ return std::string(path);
+
+ auto rit = path.rbegin();
+ std::string::size_type pos = path.length();
+ int path_separator_count = 0;
+ // search for path separators backwards and abort if height is reached
+ while (path_separator_count < height) {
+ pos = path.rfind('/', pos - 1);
+ if (pos == std::string::npos) {
+ pos = 0;
+ break;
+ } else {
+ path_separator_count++;
+ }
+ }
+
+ if (pos > 0) // prepend truncation sequence
+ return "[...]" + path.substr(pos, path.length());
+ else
+ return std::string(path);
+}
+
//=============================
// init
//=============================
@@ -186,7 +217,7 @@
GTI_ANALYSIS_RETURN InitLocationId::init(MustLocationId* pStorage, const char* c
thisFullLocation.stack.emplace_back(trace.object_filename, trace.object_function);
} else {
thisFullLocation.stack.emplace_back(
- trace.source.filename,
+ truncatePath(myStackPathDepth, trace.source.filename),
trace.source.function,
std::to_string(trace.source.line));
}
diff --git a/modules/MustBase/InitLocationId.h b/modules/MustBase/InitLocationId.h
index 2aee6407..d1fdc01f 100644
--- a/modules/MustBase/InitLocationId.h
+++ b/modules/MustBase/InitLocationId.h
@@ -68,6 +68,10 @@
class InitLocationId : public gti::ModuleBase<InitLocationId, I_InitLocationId>
I_GenerateLocationId* myGenLId;
handleNewLocationP myNewLocFct;
+ private:
+ int myStackPathDepth;
+ std::string truncatePath(int length, std::string path);
+
#ifdef ENABLE_STACKTRACE
/**
* Helper function to call the handleNewLocation call when we use the callpath module
--
2.39.1
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment