@@ -66,8 +66,10 @@ class java_bytecode_parsert final : public parsert
66
66
{
67
67
if (index ==0 || index >=constant_pool.size ())
68
68
{
69
- error () << " invalid constant pool index (" << index << " )" << eom;
70
- error () << " constant pool size: " << constant_pool.size () << eom;
69
+ log .error () << " invalid constant pool index (" << index << " )"
70
+ << messaget::eom;
71
+ log .error () << " constant pool size: " << constant_pool.size ()
72
+ << messaget::eom;
71
73
throw 0 ;
72
74
}
73
75
@@ -117,7 +119,7 @@ class java_bytecode_parsert final : public parsert
117
119
{
118
120
if (!*in)
119
121
{
120
- error () << " unexpected end of bytecode file" << eom;
122
+ log . error () << " unexpected end of bytecode file" << messaget:: eom;
121
123
throw 0 ;
122
124
}
123
125
in->get ();
@@ -135,7 +137,7 @@ class java_bytecode_parsert final : public parsert
135
137
{
136
138
if (!*in)
137
139
{
138
- error () << " unexpected end of bytecode file" << eom;
140
+ log . error () << " unexpected end of bytecode file" << messaget:: eom;
139
141
throw 0 ;
140
142
}
141
143
result <<= 8u ;
@@ -384,19 +386,19 @@ bool java_bytecode_parsert::parse()
384
386
385
387
catch (const char *message)
386
388
{
387
- error () << message << eom;
389
+ log . error () << message << messaget:: eom;
388
390
return true ;
389
391
}
390
392
391
393
catch (const std::string &message)
392
394
{
393
- error () << message << eom;
395
+ log . error () << message << messaget:: eom;
394
396
return true ;
395
397
}
396
398
397
399
catch (...)
398
400
{
399
- error () << " parsing error" << eom;
401
+ log . error () << " parsing error" << messaget:: eom;
400
402
return true ;
401
403
}
402
404
@@ -435,13 +437,13 @@ void java_bytecode_parsert::rClassFile()
435
437
436
438
if (magic!=0xCAFEBABE )
437
439
{
438
- error () << " wrong magic" << eom;
440
+ log . error () << " wrong magic" << messaget:: eom;
439
441
throw 0 ;
440
442
}
441
443
442
444
if (major_version<44 )
443
445
{
444
- error () << " unexpected major version" << eom;
446
+ log . error () << " unexpected major version" << messaget:: eom;
445
447
throw 0 ;
446
448
}
447
449
@@ -641,7 +643,7 @@ void java_bytecode_parsert::rconstant_pool()
641
643
const u2 constant_pool_count = read <u2>();
642
644
if (constant_pool_count==0 )
643
645
{
644
- error () << " invalid constant_pool_count" << eom;
646
+ log . error () << " invalid constant_pool_count" << messaget:: eom;
645
647
throw 0 ;
646
648
}
647
649
@@ -683,7 +685,7 @@ void java_bytecode_parsert::rconstant_pool()
683
685
// Eight-byte constants take up two entries in the constant_pool table.
684
686
if (it==constant_pool.end ())
685
687
{
686
- error () << " invalid double entry" << eom;
688
+ log . error () << " invalid double entry" << messaget:: eom;
687
689
throw 0 ;
688
690
}
689
691
it++;
@@ -707,8 +709,8 @@ void java_bytecode_parsert::rconstant_pool()
707
709
break ;
708
710
709
711
default :
710
- error () << " unknown constant pool entry (" << it->tag << " )"
711
- << eom;
712
+ log . error () << " unknown constant pool entry (" << it->tag << " )"
713
+ << messaget:: eom;
712
714
throw 0 ;
713
715
}
714
716
}
@@ -1140,7 +1142,7 @@ void java_bytecode_parsert::rbytecode(std::vector<instructiont> &instructions)
1140
1142
1141
1143
if (address!=code_length)
1142
1144
{
1143
- error () << " bytecode length mismatch" << eom;
1145
+ log . error () << " bytecode length mismatch" << messaget:: eom;
1144
1146
throw 0 ;
1145
1147
}
1146
1148
}
@@ -1809,7 +1811,7 @@ optionalt<java_bytecode_parse_treet> java_bytecode_parse(
1809
1811
{
1810
1812
java_bytecode_parsert java_bytecode_parser (skip_instructions);
1811
1813
java_bytecode_parser.in =&istream;
1812
- java_bytecode_parser.set_message_handler (message_handler);
1814
+ java_bytecode_parser.log . set_message_handler (message_handler);
1813
1815
1814
1816
bool parser_result=java_bytecode_parser.parse ();
1815
1817
@@ -1979,8 +1981,8 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
1979
1981
method_handle_infot method_handle{entry};
1980
1982
1981
1983
const u2 num_bootstrap_arguments = read <u2>();
1982
- debug () << " INFO: parse BootstrapMethod handle " << num_bootstrap_arguments
1983
- << " #args" << eom;
1984
+ log . debug () << " INFO: parse BootstrapMethod handle "
1985
+ << num_bootstrap_arguments << " #args" << messaget:: eom;
1984
1986
1985
1987
// read u2 values of entry into vector
1986
1988
std::vector<u2> u2_values (num_bootstrap_arguments);
@@ -2020,9 +2022,9 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
2020
2022
if (num_bootstrap_arguments < 3 )
2021
2023
{
2022
2024
store_unknown_method_handle (bootstrap_method_index);
2023
- debug ()
2025
+ log . debug ()
2024
2026
<< " format of BootstrapMethods entry not recognized: too few arguments"
2025
- << eom;
2027
+ << messaget:: eom;
2026
2028
continue ;
2027
2029
}
2028
2030
@@ -2043,9 +2045,9 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
2043
2045
2044
2046
if (!recognized)
2045
2047
{
2046
- debug () << " format of BootstrapMethods entry not recognized: extra "
2047
- " arguments of wrong type"
2048
- << eom;
2048
+ log . debug () << " format of BootstrapMethods entry not recognized: extra "
2049
+ " arguments of wrong type"
2050
+ << messaget:: eom;
2049
2051
store_unknown_method_handle (bootstrap_method_index);
2050
2052
continue ;
2051
2053
}
@@ -2060,22 +2062,23 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
2060
2062
method_handle_argument.tag != CONSTANT_MethodHandle ||
2061
2063
method_type_argument.tag != CONSTANT_MethodType)
2062
2064
{
2063
- debug () << " format of BootstrapMethods entry not recognized: arguments "
2064
- " wrong type"
2065
- << eom;
2065
+ log .debug ()
2066
+ << " format of BootstrapMethods entry not recognized: arguments "
2067
+ " wrong type"
2068
+ << messaget::eom;
2066
2069
store_unknown_method_handle (bootstrap_method_index);
2067
2070
continue ;
2068
2071
}
2069
2072
2070
- debug () << " INFO: parse lambda handle" << eom;
2073
+ log . debug () << " INFO: parse lambda handle" << messaget:: eom;
2071
2074
optionalt<lambda_method_handlet> lambda_method_handle =
2072
2075
parse_method_handle (method_handle_infot{method_handle_argument});
2073
2076
2074
2077
if (!lambda_method_handle.has_value ())
2075
2078
{
2076
- debug () << " format of BootstrapMethods entry not recognized: method "
2077
- " handle not recognised"
2078
- << eom;
2079
+ log . debug () << " format of BootstrapMethods entry not recognized: method "
2080
+ " handle not recognised"
2081
+ << messaget:: eom;
2079
2082
store_unknown_method_handle (bootstrap_method_index);
2080
2083
continue ;
2081
2084
}
@@ -2084,14 +2087,15 @@ void java_bytecode_parsert::read_bootstrapmethods_entry()
2084
2087
POSTCONDITION (
2085
2088
lambda_method_handle->handle_type != method_handle_typet::UNKNOWN_HANDLE);
2086
2089
2087
- debug () << " lambda function reference "
2088
- << id2string (lambda_method_handle->get_method_descriptor ()
2089
- .base_method_name ())
2090
- << " in class \" " << parse_tree.parsed_class .name << " \" "
2091
- << " \n interface type is "
2092
- << id2string (pool_entry (interface_type_argument.ref1 ).s )
2093
- << " \n method type is "
2094
- << id2string (pool_entry (method_type_argument.ref1 ).s ) << eom;
2090
+ log .debug ()
2091
+ << " lambda function reference "
2092
+ << id2string (
2093
+ lambda_method_handle->get_method_descriptor ().base_method_name ())
2094
+ << " in class \" " << parse_tree.parsed_class .name << " \" "
2095
+ << " \n interface type is "
2096
+ << id2string (pool_entry (interface_type_argument.ref1 ).s )
2097
+ << " \n method type is "
2098
+ << id2string (pool_entry (method_type_argument.ref1 ).s ) << messaget::eom;
2095
2099
parse_tree.parsed_class .add_method_handle (
2096
2100
bootstrap_method_index, *lambda_method_handle);
2097
2101
}
0 commit comments