def GenerateStringTable(symbol_names):
  """Generate the string table that corresponds to a list of symbol names.

  Args:
    symbol_names: List of input symbol names.
  Returns:
    A (string_table, symbol_offsets) tuple, where |string_table| is the
    actual string table (terminated by two '\0' chars), and |symbol_offsets|
    is a list of starting offsets for each symbol inside the table.
  """
  symbol_offsets = []
  string_table = "\0"
  next_offset = 1
  for symbol in symbol_names:
    symbol_offsets.append(next_offset)
    string_table += symbol
    string_table += "\0"
    next_offset += len(symbol) + 1

  string_table += "\0"
  return string_table, symbol_offsets