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
3c49b1db
Commit
3c49b1db
authored
6 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: use dladdr() instead of parsing /proc/self/maps
parent
dc80f9d0
Show 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 @
3c49b1db
...
...
@@ -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'
))
{
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
)
Dl_info
info
;
if
(
0
!=
dladdr
(
addr
,
&
info
))
{
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
...
...
This diff is collapsed.
Click to expand it.
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