summaryrefslogtreecommitdiff
path: root/src/elf_model/elf_string_table.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/elf_model/elf_string_table.ml')
-rw-r--r--src/elf_model/elf_string_table.ml75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/elf_model/elf_string_table.ml b/src/elf_model/elf_string_table.ml
deleted file mode 100644
index 0a211385..00000000
--- a/src/elf_model/elf_string_table.ml
+++ /dev/null
@@ -1,75 +0,0 @@
-(*Generated by Lem from elf_string_table.lem.*)
-open Elf_header
-open Elf_section_header
-open Elf_types
-
-open Bitstring
-open Error
-open Missing_pervasives
-
-open Lem_basic_classes
-open Lem_list
-open Lem_maybe
-open Lem_num
-open Lem_string
-open Show
-
-let get_strings_of_string_table bs =
-(let strings = (Bitstring.string_of_bitstring bs) in
- Ml_bindings.split_string_on_char strings '\000')
-
-let read_elf32_string_table hdr sections bs : ( string list) error =
-((match sections with
- | None -> return []
- | Some sections ->
- let idx = (Int64.to_int hdr.elf32_shstrndx) in
- let string_table = (Lem_list.list_index sections idx) in
- (match string_table with
- | None -> Fail "read_elf32_string_table: string table index too large"
- | Some string_table ->
- let offset = (Int64.to_int string_table.elf32_sh_offset) in
- let size = (Int64.to_int string_table.elf32_sh_size) in
- let (_, initial) = (Utility.partition_bitstring (offset * 8) bs) in
- let (relevant, _) = (Utility.partition_bitstring (size * 8) initial) in
- return (get_strings_of_string_table relevant)
- )
- ))
-
-let rec read_elf32_string_tables' offset_sizes (bs : Bitstring.bitstring) : ( string list) list =
-((match offset_sizes with
- | [] -> []
- | x::xs ->
- let (offset, size) = x in
- let (_, relevant) = (Utility.partition_bitstring offset bs) in
- let (cut, _) = (Utility.partition_bitstring size relevant) in
- let strings = (get_strings_of_string_table cut) in
- let tail = (read_elf32_string_tables' xs bs) in
- strings::tail
- ))
-
-let read_elf32_string_tables sections bs : ( string list) list =
-((match sections with
- | None -> []
- | Some sections ->
- let offsets_sizes = (List.concat (List.map (fun sect ->
- if Int64.to_int sect.elf32_sh_type = sht_strtab then
- let offset = ((Int64.to_int sect.elf32_sh_offset) * 8) in
- let size =
-(let _ = (print_endline ("YYY size: " ^ natShow (Int64.to_int sect.elf32_sh_size * 8))) in
- Int64.to_int sect.elf32_sh_size * 8)
- in
- [(offset, size)]
- else
- []
- ) sections))
- in
- read_elf32_string_tables' offsets_sizes bs
- ))
-
-let string_of_elf32_string_table tbl =
-("String table contents:" ^ ("\n\t" ^
-(List.fold_right (^) tbl "" ^ "\n\n")))
-
-let string_of_elf32_dynamic_string_table tbl =
-("Dynamic string table contents:" ^ ("\n\t" ^
-(List.fold_right (^) tbl "" ^ "\n\n")))