Skip to content

Commit 1b4314e

Browse files
author
Levente Orban
committed
initial #5
1 parent 98305f2 commit 1b4314e

File tree

6 files changed

+42
-39
lines changed

6 files changed

+42
-39
lines changed

jerry-core/debugger/debugger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern int remote_init(void);
2222
extern void connection_closed(void);
2323
extern void send_to_client(const char* data, uint16_t data_len);
2424

25-
int connection;
25+
int sockfd_connection;
2626

2727
typedef enum
2828
{

jerry-core/parser/js/js-parser-internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#ifdef PARSER_DEBUG
2828
#include "debugger.h"
29-
package bp_info[128];
29+
package bp_info[128];
3030
jmem_cpointer_t debug_bytecode_data_cp; /* < Compressed main program byte code pointer*/
3131
jmem_cpointer_t debug_func_bytecode_data_cp; /* < Compressed function byte code pointer*/
3232
#endif /* !PARSER_DEBUG */

jerry-core/parser/js/js-parser-statm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -376,10 +376,10 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
376376

377377
function_name_t.type = FUNCTION_NAME; // Type 2 is the parsed function name
378378
function_name_t.msg_len = name_p->prop.length;
379-
379+
380380
memcpy(function_name_t.msg, name_p->u.char_p, function_name_t.msg_len);
381381
function_name_t.msg[function_name_t.msg_len]='\0';
382-
send(connection, &function_name_t, sizeof(function_name_t), 0);
382+
send(sockfd_connection, &function_name_t, sizeof(function_name_t), 0);
383383
}
384384
#endif /* !PARSER_DEBUG */
385385

@@ -1673,11 +1673,11 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
16731673
context_p->statement_line = context_p->line;
16741674
context_p->line_info.pairs[context_p->line_info.count].line = context_p->statement_line;
16751675

1676-
printf("<<< line_info.pairs[%d].line=%d\n", context_p->line_info.count, context_p->statement_line);
1676+
//printf("<<< line_info.pairs[%d].line=%d\n", context_p->line_info.count, context_p->statement_line);
16771677
context_p->line_info.count++;
16781678

16791679
bp_info[context_p->line_info.count].line_index = context_p->statement_line;
1680-
1680+
printf("bp_info[%d].line_index = %d\n", context_p->line_info.count, bp_info[context_p->line_info.count].line_index );
16811681
// Push breakpoint to the CBC code
16821682
parser_emit_cbc (context_p, CBC_BREAKPOINT);
16831683
parser_flush_cbc (context_p);

jerry-core/parser/js/js-parser.c

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
#ifdef PARSER_DEBUG
2424
uint8_t bp_count = 0;
25-
// debug_breakpoints bp_info;
2625
#endif /* !PARSER_DEBUG */
26+
2727
/** \addtogroup parser Parser
2828
* @{
2929
*
@@ -1267,9 +1267,9 @@ parser_post_processing (parser_context_t *context_p) /**< context */
12671267
jmem_cpointer_t *literal_pool_p;
12681268
uint8_t *dst_p;
12691269

1270-
#ifdef PARSER_DEBUG
1271-
debug_literal_map_t literal_map_p;
1272-
#endif /* PARSER_DEBUG */
1270+
// #ifdef PARSER_DEBUG
1271+
// debug_literal_map_t literal_map_p;
1272+
// #endif /* PARSER_DEBUG */
12731273

12741274
printf("\n @@@@@@@@ parser post processing start @@@@@@@@@ \n");
12751275

@@ -1305,18 +1305,18 @@ parser_post_processing (parser_context_t *context_p) /**< context */
13051305
page_p = context_p->byte_code.first_p;
13061306
offset = 0;
13071307

1308-
#ifdef PARSER_DEBUG
1309-
parser_list_iterator_t literal_iterator;
1310-
lexer_literal_t *literal_p;
1311-
1312-
parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);
1313-
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))
1314-
{
1315-
if (literal_p->type == LEXER_IDENT_LITERAL)
1316-
{
1317-
size_t size = literal_p->prop.length;
1318-
literal_map_p.literal_len = (uint8_t) size; // debug_literal_map_t literal_map_p;
1319-
literal_map_p.index = literal_p->prop.index;
1308+
// #ifdef PARSER_DEBUG
1309+
// parser_list_iterator_t literal_iterator;
1310+
// lexer_literal_t *literal_p;
1311+
1312+
// parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);
1313+
// while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))
1314+
// {
1315+
// if (literal_p->type == LEXER_IDENT_LITERAL)
1316+
// {
1317+
// size_t size = literal_p->prop.length;
1318+
// literal_map_p.literal_len = (uint8_t) size; // debug_literal_map_t literal_map_p;
1319+
// literal_map_p.index = literal_p->prop.index;
13201320
// PRINT THE LITERAL IN THE CBC_CODES TO CHECK IT << NOT FINAL
13211321
// const uint8_t *char_p = literal_p->u.char_p;
13221322
// printf("\n");
@@ -1327,11 +1327,11 @@ parser_post_processing (parser_context_t *context_p) /**< context */
13271327
// size--;
13281328
// }
13291329
// printf("\n");
1330-
}
1331-
literal_map_p.header.type = JERRY_DEBUG_MAP_INFO;
1332-
literal_map_p.header.size = (uint16_t) (sizeof (debug_literal_map_t) - 255 + literal_map_p.literal_len);
1333-
}
1334-
#endif /* !PARSER_DEBUG */
1330+
// }
1331+
// literal_map_p.header.type = JERRY_DEBUG_MAP_INFO;
1332+
// literal_map_p.header.size = (uint16_t) (sizeof (debug_literal_map_t) - 255 + literal_map_p.literal_len);
1333+
// }
1334+
// #endif /* !PARSER_DEBUG */
13351335

13361336
while (page_p != last_page_p || offset < last_position)
13371337
{
@@ -1596,10 +1596,11 @@ parser_post_processing (parser_context_t *context_p) /**< context */
15961596
printf("<<< compressed bytecode: %d ", debug_func_bytecode_data_cp);
15971597
uint32_t rel_offset = (uint32_t)debug_func_bytecode_data_cp - (uint32_t)rel_offset_tmp;
15981598
//context_p->line_info.pairs[bp_count].offset = rel_offset;
1599-
printf("<<< line_info.pairs[%d].offset: %p\n", bp_count, rel_offset);
1600-
16011599
bp_info[bp_count].line_offset = rel_offset;
1600+
1601+
printf("bp_info[%d].line_offset = %p\n ", bp_count, bp_info[bp_count].line_offset);
16021602
bp_count++;
1603+
16031604
}
16041605
#endif /* !PARSER_DEBUG */
16051606

@@ -1740,13 +1741,15 @@ parser_post_processing (parser_context_t *context_p) /**< context */
17401741
context_p->header_info.start_address_p = compiled_code_p;
17411742
context_p->header_info.name_len = 0;
17421743

1743-
printf("\n@@@@@@SEND THE BREAKPOINTS INFOS AFTER PARSING@@@@@@\n");
1744-
bp_info[bp_count].type = BREAKPOINT_INFO;
1745-
int tmp;
1746-
for ( tmp = 0; tmp < bp_count; tmp ++) {
1747-
send(connection, &bp_info[bp_count], sizeof(bp_info[bp_count]), 0);
1748-
}
1749-
bp_count = 0;
1744+
// printf("\n@@@@@@SEND THE BREAKPOINTS INFOS AFTER PARSING@@@@@@\n");
1745+
// bp_info[bp_count].type = BREAKPOINT_INFO;
1746+
// int tmp;
1747+
1748+
// for ( tmp = 0; tmp < bp_count; tmp ++) {
1749+
// send(sockfd_connection, &bp_info[bp_count], sizeof(bp_info[bp_count]), 0);
1750+
// }
1751+
1752+
// bp_count = 0;
17501753
#endif /* PARSER_DEBUG */
17511754

17521755
#ifdef PARSER_DUMP_BYTE_CODE

jerry-debugger/client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ int main()
7070
}
7171

7272
}
73-
73+
7474
return 0;
7575
}

jerry-main/main-unix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ read_file (const char *file_name,
7171
source_file_t.msg_len = strlen(file_name);
7272
memcpy(source_file_t.msg, file_name, source_file_t.msg_len + 1);
7373

74-
send(connection, &source_file_t, sizeof(source_file_t), 0);
74+
send(sockfd_connection, &source_file_t, sizeof(source_file_t), 0);
7575
#endif /* !PARSER_DEBUG */
7676

7777
fclose (file);
@@ -154,7 +154,7 @@ main (int argc,
154154
int files_counter = 0;
155155

156156
#ifdef PARSER_DEBUG
157-
connection = remote_init();
157+
sockfd_connection = remote_init();
158158
#endif /* !PARSER_DEBUG */
159159

160160
size_t max_data_bss_size, max_stack_size;

0 commit comments

Comments
 (0)