ctfconvert.c revision c79a74a8321729c8f50472db67e907324bace4e5
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Given a file containing sections with stabs data, convert the stabs data to
* CTF data, and replace the stabs sections with a CTF section.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <fcntl.h>
#include <libgen.h>
#include <errno.h>
#include <assert.h>
#include "ctftools.h"
#include "memory.h"
const char *progname;
int debug_level = DEBUG_LEVEL;
static int dynsym;
static void
usage(void)
{
"Usage: %s [-is] -l label | -L labelenv [-o outfile] object_file\n"
"\n"
" Note: if -L labelenv is specified and labelenv is not set in\n"
" the environment, a default value is used.\n",
progname);
}
static void
terminate_cleanup(void)
{
if (!outfile) {
}
}
static void
handle_sig(int sig)
{
}
static int
{
};
(void) elf_version(EV_CURRENT);
elf_errmsg(-1));
}
ignore_non_c) {
exit(0);
}
break;
}
/*
* None of the readers found compatible type data.
*/
terminate("%s: DWARF version 1 is not supported\n",
filename);
}
filename);
exit(0);
}
rc = 0;
} else {
rc = 1;
}
return (rc);
}
int
{
int verbose = 0;
int ignore_non_c = 0;
int c;
if (getenv("CTFCONVERT_DEBUG_LEVEL"))
if (getenv("CTFCONVERT_DEBUG_PARSE"))
switch (c) {
case 'l':
break;
case 'L':
break;
case 'o':
break;
case 's':
break;
case 'i':
ignore_non_c = 1;
break;
case 'v':
verbose = 1;
break;
default:
usage();
exit(2);
}
}
usage();
exit(2);
}
/*
* Upon receipt of a signal, we want to clean up and exit. Our
* primary goal during cleanup is to restore the system to a state
* such that a subsequent make will eventually cause this command to
* be re-run. If we remove the input file (which we do if we get a
* signal and the user didn't specify a separate output file), make
* will need to rebuild the input file, and will then need to re-run
* ctfconvert, which is what we want.
*/
if (verbose)
/*
* If the user supplied an output file that is different from the
* input file, write directly to the output file. Otherwise, write
* to a temporary file, and replace the input file when we're done.
*/
} else {
}
return (0);
}