Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
b73065f7
Commit
b73065f7
authored
4 years ago
by
Andre Maroneze
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] fix chdir issue with JCDB, when running from a different directory
parent
0f95546b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kernel_services/ast_queries/file.ml
+21
-8
21 additions, 8 deletions
src/kernel_services/ast_queries/file.ml
with
21 additions
and
8 deletions
src/kernel_services/ast_queries/file.ml
+
21
−
8
View file @
b73065f7
...
@@ -523,10 +523,23 @@ let build_cpp_cmd = function
...
@@ -523,10 +523,23 @@ let build_cpp_cmd = function
include_args
define_args
include_args
define_args
in
in
let
cpp_command
=
replace_in_cpp_cmd
cmdl
supp_args
(
f
:>
string
)
(
ppf
:>
string
)
in
let
cpp_command
=
replace_in_cpp_cmd
cmdl
supp_args
(
f
:>
string
)
(
ppf
:>
string
)
in
let
cpp_command_with_chdir
=
if
Kernel
.
JsonCompilationDatabase
.
is_set
()
then
let
jcdb_path
=
(
Kernel
.
JsonCompilationDatabase
.
get
()
:>
string
)
in
let
dir
=
if
Sys
.
is_directory
jcdb_path
then
jcdb_path
else
Filename
.
dirname
jcdb_path
in
let
cwd
=
Unix
.
getcwd
()
in
if
cwd
<>
dir
then
"cd "
^
dir
^
" && "
^
cpp_command
else
cpp_command
else
cpp_command
in
Kernel
.
feedback
~
dkey
:
Kernel
.
dkey_pp
Kernel
.
feedback
~
dkey
:
Kernel
.
dkey_pp
"preprocessing with
\"
%s
\"
"
"preprocessing with
\"
%s
\"
"
cpp_command
;
cpp_command
_with_chdir
;
Some
(
cpp_command
,
ppf
,
supp_args
)
Some
(
cpp_command
_with_chdir
,
ppf
,
supp_args
)
let
parse_cabs
cpp_command
=
function
let
parse_cabs
cpp_command
=
function
|
NoCPP
f
->
|
NoCPP
f
->
...
@@ -1744,17 +1757,17 @@ let prepare_from_c_files () =
...
@@ -1744,17 +1757,17 @@ let prepare_from_c_files () =
let
files
=
Files
.
get
()
in
(* Allow pre-registration of prolog files *)
let
files
=
Files
.
get
()
in
(* Allow pre-registration of prolog files *)
let
cpp_commands
=
List
.
map
(
fun
f
->
(
f
,
build_cpp_cmd
f
))
files
in
let
cpp_commands
=
List
.
map
(
fun
f
->
(
f
,
build_cpp_cmd
f
))
files
in
if
Kernel
.
PrintCppCommands
.
get
()
then
print_and_exit
cpp_commands
;
if
Kernel
.
PrintCppCommands
.
get
()
then
print_and_exit
cpp_commands
;
if
not
(
Kernel
.
AuditCheck
.
is_empty
()
)
then
begin
let
audit_check_path
=
Kernel
.
AuditCheck
.
get
()
in
if
not
(
Filepath
.
Normalized
.
is_empty
audit_check_path
)
then
begin
let
all_sources_tbl
=
compute_sources_table
cpp_commands
in
let
all_sources_tbl
=
compute_sources_table
cpp_commands
in
let
expected_hashes
=
source_hashes_of_json
(
Kernel
.
A
udit
C
heck
.
get
()
)
in
let
expected_hashes
=
source_hashes_of_json
a
udit
_c
heck
_path
in
check_source_hashes
expected_hashes
all_sources_tbl
check_source_hashes
expected_hashes
all_sources_tbl
end
;
end
;
if
not
(
Kernel
.
AuditPrepare
.
is_empty
()
)
then
begin
let
audit_path
=
Kernel
.
AuditPrepare
.
get
()
in
if
not
(
Filepath
.
Normalized
.
is_empty
audit_path
)
then
begin
let
all_sources_tbl
=
compute_sources_table
cpp_commands
in
let
all_sources_tbl
=
compute_sources_table
cpp_commands
in
let
audit_path
=
Kernel
.
AuditPrepare
.
get
()
in
print_all_sources
audit_path
all_sources_tbl
;
print_all_sources
audit_path
all_sources_tbl
;
if
not
(
Filepath
.
Normalized
.
is_special_stdout
audit_path
)
if
not
(
Filepath
.
Normalized
.
is_special_stdout
audit_path
)
then
then
Kernel
.
feedback
"Audit: sources list written to: %a@."
Kernel
.
feedback
"Audit: sources list written to: %a@."
Filepath
.
Normalized
.
pretty
audit_path
;
Filepath
.
Normalized
.
pretty
audit_path
;
end
;
end
;
...
...
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