-
Notifications
You must be signed in to change notification settings - Fork 686
Update the debugger to work on Windows #2684
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
Conversation
|
Currently on newer gcc there is a bit of problem: Currently checking on how this can be fixed. |
b797774 to
52dc2e6
Compare
5a067a2 to
f5921cd
Compare
|
I've updated the PR. |
rerobika
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good patch, only minor things.
f5921cd to
e2d380a
Compare
|
@rerobika I've updated the PR. |
zherczeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much % of the file changed? Is it worth to keep this in 1 file?
jerry-ext/debugger/debugger-tcp.c
Outdated
| #include <arpa/inet.h> | ||
| #include <errno.h> | ||
|
|
||
| #if defined (WIN32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: All over the PR this is used like #ifdef WIN32. Could we unify it?
|
@zherczeg the biggest change is the creation of the |
jerry-ext/CMakeLists.txt
Outdated
| target_link_libraries(${JERRY_EXT_NAME} jerry-core) | ||
|
|
||
| if(USING_MSVC AND FEATURE_DEBUGGER) | ||
| target_link_libraries(${JERRY_EXT_NAME} ws2_32.lib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's state it upfront, I'm not completely familiar with cmake on windows (although I had to play with it a bit): but is the .lib suffix/extension needed for target_link_libraries? Isn't that function working with "library names" and appends/prepends whatever is mandated by the platform/os? (E.g., name "xxx" gets converted to libxxx.a, libxxx.so, xxx.lib, xxx.dll, etc. as needed?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, there is no need for the .lib extension.
jerry-ext/debugger/debugger-tcp.c
Outdated
| */ | ||
| static void | ||
| jerryx_debugger_tcp_log_error (int err_val) | ||
| jerryx_debugger_tcp_log_error (const char *prefix, /**< message prefix */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: is the prefix really necessary? Are not all errors TCP-related so that it shouldn't be hardcoded? This is the TCP transport implementation after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I wanted to use the simple TCP error hard-coded prefix, but in this variant I've followed the original Error/TCP Error prefixes. I'm happy to change this to the "TCP Error" prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Well, then, it's no big deal. I vote for a single prefix but whatever majority votes for should prevail.
jerry-ext/debugger/debugger-tcp.c
Outdated
| } | ||
|
|
||
| int opt_value = 1; | ||
| if (bind (server_socket, (struct sockaddr *)&addr, sizeof (struct sockaddr)) != 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs of bind the 3rd arg should be the size of the 2nd arg. But addr is of type struct sockaddr_in, not struct sockaddr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh yeah. Currently it works as the sockaddr_in can be considered as a "subclass" of the sockaddr and they have the same size (at least on linux). But will change it to sizeof (struct sockaddr_in)
jerry-ext/debugger/debugger-tcp.c
Outdated
| { | ||
| JERRYX_ERROR_MSG ("Error: %s\n", strerror (errno)); | ||
| int error = jerryx_debugger_tcp_get_errno (); | ||
| jerryx_debugger_tcp_log_error ("Error", error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two lines can be merged. There is no need for a temp var.
zherczeg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
e2d380a to
827c78a
Compare
Changed the debugger-tcp.c file to include Windows specific socket handling code and mode user all components are compilable for Windows. Added appveyor configuration to build with and without debugger. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
827c78a to
1a0ac06
Compare
rerobika
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (informal)
akosthekiss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Changed the debugger-tcp.c file to include Windows specific
socket handling code.
Added appveyor configuration to build with and without debugger.