Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix includes from to ignoring dir.types ##types #14073

Merged
merged 1 commit into from
May 15, 2019

Conversation

oxcabe
Copy link
Contributor

@oxcabe oxcabe commented May 14, 2019

Fixes #14031

int len = snprintf (filepath, sizeof (filepath),
"/usr/include/%s", buf);
if (!dirname) {
dirname = "/usr/include";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random though #1: maybe /usr/include is not where we want to look at.. maybe it's just '.' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote that as a fallback, in case dirname wasn't already set as the value on dir.types (it would be a null pointer in that case).
Also, "/usr/include" is the default value for dir.types. Based on C include priorities, it will prioritize a header with the same name located in the current directory than the header file located in the dir.types path

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats's what I thought while writing that. Might be wrong, though! :p

@@ -1252,7 +1253,7 @@ static int cmd_type(void *data, const char *input) {
}
} else {
char *error_msg = NULL;
char *out = r_parse_c_file (core->anal, filename, &error_msg);
char *out = r_parse_c_file (core->anal, filename, dir, &error_msg);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random though #2 - what if we want to add more includedirs? or maybe other options to the parser? the rparse api needs a refactor. and this must be added to the list of things to do at some point

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we already set more than one includedir in the eval var, I mean, is that already implemented?
I believe it shouldn't be way too hard to pass a dirlist as the argument, to be parsed by tcc in order to add many include directories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt?

Copy link
Collaborator

@radare radare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@codecov-io
Copy link

Codecov Report

Merging #14073 into master will increase coverage by <.01%.
The diff coverage is 64.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14073      +/-   ##
==========================================
+ Coverage   36.86%   36.87%   +<.01%     
==========================================
  Files         941      941              
  Lines      304184   304191       +7     
==========================================
+ Hits       112150   112156       +6     
- Misses     192034   192035       +1
Impacted Files Coverage Δ
shlr/tcc/tccgen.c 37.91% <ø> (ø) ⬆️
shlr/tcc/tcc.h 83.33% <ø> (ø) ⬆️
libr/core/cmd.c 46.67% <0%> (-0.02%) ⬇️
shlr/tcc/tccpp.c 41.53% <0%> (-0.05%) ⬇️
libr/core/cmd_type.c 59.53% <100%> (+0.03%) ⬆️
shlr/tcc/libtcc.c 79.1% <100%> (+0.11%) ⬆️
libr/parse/code.c 62.24% <100%> (ø) ⬆️
libr/core/cmd_print.c 46.4% <100%> (-0.02%) ⬇️
libr/util/sys.c 54.69% <0%> (+0.27%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6762f88...245555f. Read the comment docs.

@radare radare merged commit 31e7cf5 into radareorg:master May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dir.types not being used for includes
3 participants