Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
36b6bcb6
Commit
36b6bcb6
authored
Nov 25, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13268 from alalek:core_findfile_linux_use_dladdr
parents
5a804e3c
3c49b1db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
20 deletions
+5
-20
datafile.cpp
modules/core/src/utils/datafile.cpp
+5
-20
No files found.
modules/core/src/utils/datafile.cpp
View file @
36b6bcb6
...
...
@@ -24,6 +24,8 @@
#undef min
#undef max
#undef abs
#elif defined(__linux__)
#include <dlfcn.h> // requires -ldl
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#if TARGET_OS_MAC
...
...
@@ -123,27 +125,10 @@ static cv::String getModuleLocation(const void* addr)
}
}
#elif defined(__linux__)
std
::
ifstream
fs
(
"/proc/self/maps"
);
std
::
string
line
;
while
(
std
::
getline
(
fs
,
line
,
'\n'
))
Dl_info
info
;
if
(
0
!=
dladdr
(
addr
,
&
info
))
{
long
long
int
addr_begin
=
0
,
addr_end
=
0
;
if
(
2
==
sscanf
(
line
.
c_str
(),
"%llx-%llx"
,
&
addr_begin
,
&
addr_end
))
{
if
((
intptr_t
)
addr
>=
(
intptr_t
)
addr_begin
&&
(
intptr_t
)
addr
<
(
intptr_t
)
addr_end
)
{
size_t
pos
=
line
.
rfind
(
" "
);
// 2 spaces
if
(
pos
==
cv
::
String
::
npos
)
pos
=
line
.
rfind
(
' '
);
// 1 spaces
else
pos
++
;
if
(
pos
==
cv
::
String
::
npos
)
{
CV_LOG_DEBUG
(
NULL
,
"Can't parse module path: '"
<<
line
<<
'\''
);
}
return
line
.
substr
(
pos
+
1
);
}
}
return
cv
::
String
(
info
.
dli_fname
);
}
#elif defined(__APPLE__)
# if TARGET_OS_MAC
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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