Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
7df06083
Commit
7df06083
authored
May 28, 2018
by
Mark OLESEN
Browse files
STYLE: inline shorterPath function for printStack
parent
d318a630
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OSspecific/POSIX/printStack.C
View file @
7df06083
...
...
@@ -50,7 +50,7 @@ string pOpen(const string& cmd, label line=0)
char
*
buf
=
nullptr
;
// Read line number of lines
for
(
label
cnt
=
0
;
cnt
<=
line
;
cnt
++
)
for
(
label
cnt
=
0
;
cnt
<=
line
;
++
cnt
)
{
size_t
linecap
=
0
;
ssize_t
linelen
=
::
getline
(
&
buf
,
&
linecap
,
cmdPipe
);
...
...
@@ -96,6 +96,14 @@ inline word addressToWord(const uintptr_t addr)
}
inline
string
&
shorterPath
(
string
&
s
)
{
s
.
replace
(
cwd
()
+
'/'
,
""
);
s
.
replace
(
home
(),
"~"
);
return
s
;
}
void
printSourceFileAndLine
(
Ostream
&
os
,
...
...
@@ -132,14 +140,12 @@ void printSourceFileAndLine
}
else
if
(
line
==
"??:0"
)
{
os
<<
" in "
<<
filename
;
line
=
filename
;
os
<<
" in "
<<
shorterPath
(
line
).
c_str
();
}
else
{
string
cwdLine
(
line
.
replaceAll
(
cwd
()
+
'/'
,
""
));
string
homeLine
(
cwdLine
.
replaceAll
(
home
(),
"~"
));
os
<<
" at "
<<
homeLine
.
c_str
();
os
<<
" at "
<<
shorterPath
(
line
).
c_str
();
}
}
}
...
...
@@ -202,7 +208,7 @@ void Foam::error::safePrintStack(std::ostream& os)
// See if they contain function between () e.g. "(__libc_start_main+0xd0)"
// and see if cplus_demangle can make sense of part before +
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
string
msg
(
strings
[
i
]);
fileName
programFile
;
...
...
@@ -226,7 +232,7 @@ void Foam::error::printStack(Ostream& os)
fileName
fname
=
"???"
;
word
address
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
int
st
=
dladdr
(
callstack
[
i
],
info
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment