Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
840fb8e3
Commit
840fb8e3
authored
Nov 19, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug origin lines
parent
4215c51c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
8 deletions
+35
-8
asn1c/asn1c.c
asn1c/asn1c.c
+3
-0
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+1
-1
libasn1compiler/asn1c_ioc.c
libasn1compiler/asn1c_ioc.c
+2
-2
libasn1compiler/asn1c_out.c
libasn1compiler/asn1c_out.c
+19
-3
libasn1compiler/asn1c_out.h
libasn1compiler/asn1c_out.h
+5
-2
libasn1compiler/asn1compiler.h
libasn1compiler/asn1compiler.h
+5
-0
No files found.
asn1c/asn1c.c
View file @
840fb8e3
...
...
@@ -101,6 +101,9 @@ main(int ac, char **av) {
strdup
(
optarg
+
17
);
debug_type_names
[
debug_type_names_count
]
=
NULL
;
break
;
}
else
if
(
strcmp
(
optarg
,
"ebug-output-origin-lines"
)
==
0
)
{
asn1_compiler_flags
|=
A1C_DEBUG_OUTPUT_ORIGIN_LINES
;
break
;
}
usage
(
av
[
0
]);
case
'E'
:
...
...
libasn1compiler/asn1c_C.c
View file @
840fb8e3
...
...
@@ -2026,7 +2026,7 @@ emit_single_member_PER_constraint(arg_t *arg, asn1cnst_range_t *range, int alpha
OUT
(
"{ APC_CONSTRAINED%s,%s% d, % d, "
,
range
->
extensible
?
" | APC_EXTENSIBLE"
:
""
,
range
->
extensible
?
" "
:
"
\t
"
,
rbits
,
ebits
);
range
->
extensible
?
" "
:
"
\t
"
,
(
int
)
rbits
,
(
int
)
ebits
);
if
(
alphabetsize
)
{
asn1c_integer_t
lv
=
range
->
left
.
value
;
...
...
libasn1compiler/asn1c_ioc.c
View file @
840fb8e3
...
...
@@ -175,10 +175,10 @@ emit_ioc_value(arg_t *arg, struct asn1p_ioc_cell_s *cell) {
asn1c_integer_t
v
=
expr_value
->
value
->
value
.
v_integer
;
if
(
v
>=
0
)
{
if
(
v
<=
127
)
{
OUT
(
"
\"\\
x%02x
\"
, 1"
,
v
);
OUT
(
"
\"\\
x%02x
\"
, 1"
,
(
int
)
v
);
break
;
}
else
if
(
v
<=
32767
)
{
OUT
(
"
\"\\
x%02x
\\
x%02x
\"
, 2"
,
(
v
>>
8
),
(
v
&
0xff
));
OUT
(
"
\"\\
x%02x
\\
x%02x
\"
, 2"
,
(
int
)(
v
>>
8
),
(
int
)
(
v
&
0xff
));
break
;
}
}
...
...
libasn1compiler/asn1c_out.c
View file @
840fb8e3
...
...
@@ -6,7 +6,8 @@
* into appropriate output stream.
*/
int
asn1c_compiled_output
(
arg_t
*
arg
,
const
char
*
fmt
,
...)
{
asn1c_compiled_output
(
arg_t
*
arg
,
const
char
*
source
,
int
lineno
,
const
char
*
func
,
const
char
*
fmt
,
...)
{
struct
compiler_stream_destination_s
*
dst
;
const
char
*
p
;
int
lf_found
;
...
...
@@ -45,13 +46,19 @@ asn1c_compiled_output(arg_t *arg, const char *fmt, ...) {
}
dst
->
indented
=
1
;
while
(
i
--
)
{
ret
=
asn1c_compiled_output
(
arg
,
"
\t
"
);
ret
=
asn1c_compiled_output
(
arg
,
source
,
lineno
,
func
,
"
\t
"
);
if
(
ret
==
-
1
)
return
-
1
;
}
}
if
(
lf_found
)
dst
->
indented
=
0
;
size_t
debug_reserve_size
=
0
;
if
(
lf_found
&&
(
arg
->
flags
&
A1C_DEBUG_OUTPUT_ORIGIN_LINES
))
{
debug_reserve_size
=
sizeof
(
"
\t
// :100000 ()"
)
+
strlen
(
source
)
+
strlen
(
func
);
}
/*
* Allocate buffer.
*/
...
...
@@ -62,7 +69,7 @@ asn1c_compiled_output(arg_t *arg, const char *fmt, ...) {
do
{
void
*
tmp
;
m
->
len
<<=
2
;
tmp
=
realloc
(
m
->
buf
,
m
->
len
);
tmp
=
realloc
(
m
->
buf
,
m
->
len
+
debug_reserve_size
);
if
(
tmp
)
{
m
->
buf
=
(
char
*
)
tmp
;
}
else
{
...
...
@@ -77,6 +84,15 @@ asn1c_compiled_output(arg_t *arg, const char *fmt, ...) {
m
->
len
=
ret
;
/* Print out the origin of the lines */
if
(
lf_found
&&
(
arg
->
flags
&
A1C_DEBUG_OUTPUT_ORIGIN_LINES
))
{
assert
(
m
->
buf
[
m
->
len
-
1
]
==
'\n'
);
ret
=
snprintf
(
m
->
buf
+
m
->
len
-
1
,
debug_reserve_size
,
"
\t
// %s:%03d %s()
\n
"
,
source
,
lineno
,
func
);
assert
(
ret
>
0
&&
(
size_t
)
ret
<
debug_reserve_size
);
m
->
len
=
m
->
len
-
1
+
ret
;
}
if
(
arg
->
target
->
target
==
OT_INCLUDES
||
arg
->
target
->
target
==
OT_FWD_DECLS
||
arg
->
target
->
target
==
OT_POST_INCLUDE
)
{
...
...
libasn1compiler/asn1c_out.h
View file @
840fb8e3
...
...
@@ -39,7 +39,9 @@ typedef struct compiler_streams {
static
char
*
_compiler_stream2str
[]
__attribute__
((
unused
))
=
{
"IGNORE"
,
"INCLUDES"
,
"DEPS"
,
"FWD-DECLS"
,
"FWD-DEFS"
,
"TYPE-DECLS"
,
"FUNC-DECLS"
,
"POST-INCLUDE"
,
"IOC-TABLES"
,
"CTABLES"
,
"CODE"
,
"CTDEFS"
,
"STAT-DEFS"
};
int
asn1c_compiled_output
(
arg_t
*
arg
,
const
char
*
fmt
,
...);
int
asn1c_compiled_output
(
arg_t
*
arg
,
const
char
*
file
,
int
lineno
,
const
char
*
func
,
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
5
,
6
)));
/*****************************************************************
...
...
@@ -80,7 +82,8 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
} while(0)
/* Output a piece of text into a default stream */
#define OUT(fmt, args...) asn1c_compiled_output(arg, fmt, ##args)
#define OUT(fmt, args...) \
asn1c_compiled_output(arg, __FILE__, __LINE__, __func__, fmt, ##args)
#define OUT_NOINDENT(fmt, args...) do { \
int _saved_indent = INDENT_LEVEL; \
INDENT_LEVEL = 0; \
...
...
libasn1compiler/asn1compiler.h
View file @
840fb8e3
...
...
@@ -92,6 +92,11 @@ enum asn1c_flags {
* Generate top-level configure.ac and Makefile.am
*/
A1C_GEN_AUTOTOOLS_EXAMPLE
=
0x200000
,
/*
* Print the source of generated lines.
* -debug-output-origin-lines
*/
A1C_DEBUG_OUTPUT_ORIGIN_LINES
=
0x400000
,
};
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment