Skip to content

Add the structures for the debugger #5

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

Merged
merged 1 commit into from
Nov 7, 2016
Merged

Conversation

polaroi8d
Copy link
Owner

Add the structures what the debugger will be use.

JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu

@polaroi8d polaroi8d changed the title Add the structure of the debugger package Add the structures for the debugger Oct 27, 2016
uint16_t count; /**< line count */
} package;

#endif /* JERRY_DEBUG_H */

Choose a reason for hiding this comment

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

Should be /* JERRY_DEBUGGER_H */

@@ -0,0 +1,39 @@
/* Copyright 2016 University of Szeged.

Choose a reason for hiding this comment

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

The file name should be jerry-debug.h

Choose a reason for hiding this comment

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

Or jerry-debugger.h

*/

#ifndef JERRY_DEBUGGER_H
#define JERRY_DEBUGGER_H

Choose a reason for hiding this comment

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

This must come from the file name.

char msg[128]; /**< the literal array */
uint32_t line_offset; /**< line offset */
uint32_t line_index; /**< line index */
uint16_t count; /**< line count */

Choose a reason for hiding this comment

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

There should not be packed everything into one structure. The layout should look like this (without comments):

typdef struct
{
  uint8_t type;
  uint8_t size;
} jerry_debug_message_header;

And each message should have its own type.

typdef struct
{
  jerry_debug_message_header header;
  char file_name[1];
} jerry_debug_message_source_name;

One structure for each message.

Perhaps SOURCE_FILE type is enough for this patch.


typedef struct
{
package_type_t type; /**< type of the package */

Choose a reason for hiding this comment

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

We never use types with unspecified length for network messages because the compiler might use types for them.

@polaroi8d
Copy link
Owner Author

Updated the PR.

typdef struct
{
jerry_debug_message_header header; /**< header of the source file name struct */
char file_name[128]; /**< the message */
Copy link

Choose a reason for hiding this comment

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

The file name should be 1 character long, and the real name should adapt the size

JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
typdef struct
{
jerry_debug_message_header header; /**< header of the source file name struct */
char file_name[1]; /**< the message */
Copy link

Choose a reason for hiding this comment

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

This is definetely wrong. This means 1 character long string.

Copy link

Choose a reason for hiding this comment

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

No, this is correct.

This struct is a mapping struct, mapped to a buffer, and the maximum buffer size limits the file_name.

@zherczeg
Copy link

zherczeg commented Nov 7, 2016

LGTM

@polaroi8d polaroi8d merged commit 101c469 into remote-debugger Nov 7, 2016
@polaroi8d polaroi8d deleted the header-debug branch November 7, 2016 09:07
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.

3 participants