summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2019-08-14 13:42:37 -0400
committerFrank Ch. Eigler <fche@redhat.com>2019-08-14 13:42:37 -0400
commitda6a53c57ae34d0650d620e9e1e5c09b663e91a3 (patch)
treeea717fa003a17b04e1b8837b33d874026a1473a0
parentfac4830668f462529a211d95f383d4c01b3dbffd (diff)
downloadelfutils-da6a53c57ae34d0650d620e9e1e5c09b663e91a3.tar.gz
dbgserver: uniqueify -F and -R paths
-rw-r--r--dbgserver/dbgserver.85
-rw-r--r--dbgserver/dbgserver.cxx9
2 files changed, 8 insertions, 6 deletions
diff --git a/dbgserver/dbgserver.8 b/dbgserver/dbgserver.8
index a254d6b4..bfb951f1 100644
--- a/dbgserver/dbgserver.8
+++ b/dbgserver/dbgserver.8
@@ -42,13 +42,14 @@ to the original requester.
Add a thread to scan for ELF/DWARF/source files under the given
directory. This option may be repeated to scan multiple paths.
Source files are matched with DWARF files based on the AT_comp_dir
-(compilation directory) attributes inside it.
+(compilation directory) attributes inside it. Duplicate directories
+are ignored.
.TP
.BR \-R, \-\-source\-rpms=PATH
Add a thread to scan for ELF/DWARF/source files contained in RPMs
under the given directory. This option may be repeated to scan
-multiple paths.
+multiple paths. Duplicate directories are ignored.
.TP
.BR \-d, \-\-database=FILE
diff --git a/dbgserver/dbgserver.cxx b/dbgserver/dbgserver.cxx
index c48fd48e..b8e50543 100644
--- a/dbgserver/dbgserver.cxx
+++ b/dbgserver/dbgserver.cxx
@@ -68,6 +68,7 @@ extern "C" {
#include <cstring>
#include <vector>
+#include <set>
#include <string>
#include <iostream>
#include <ostream>
@@ -259,9 +260,9 @@ static unsigned verbose;
static volatile sig_atomic_t interrupted = 0;
static unsigned http_port;
static unsigned rescan_s = 300;
-static vector<string> source_file_paths;
+static set<string> source_file_paths;
static vector<pthread_t> source_file_scanner_threads;
-static vector<string> source_rpm_paths;
+static set<string> source_rpm_paths;
static vector<pthread_t> source_rpm_scanner_threads;
@@ -276,8 +277,8 @@ parse_opt (int key, char *arg,
case 'v': verbose ++; break;
case 'd': db_path = string(arg); break;
case 'p': http_port = atoi(arg); break;
- case 'F': source_file_paths.push_back(string(arg)); break;
- case 'R': source_rpm_paths.push_back(string(arg)); break;
+ case 'F': source_file_paths.insert(string(arg)); break;
+ case 'R': source_rpm_paths.insert(string(arg)); break;
case 't': rescan_s = atoi(arg); break;
// case 'h': argp_state_help (state, stderr, ARGP_HELP_LONG|ARGP_HELP_EXIT_OK);
default: return ARGP_ERR_UNKNOWN;