4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #pragma ident "%Z%%M% %I% %E% SMI"
27
28 /*
29 * Raw File Target
30 *
31 * The raw file target is invoked whenever a file of unrecognizable type is
32 * specified on the command line, or when raw file examination is forced using
33 * the -f option. If one file is specified, that file will be opened as the
34 * "object" file. If two files are specified, the second one will be opened
35 * as the "core" file. Each file is opened using the fdio backend, which
36 * internally supports both byte-oriented i/o and block-oriented i/o as needed.
37 */
38
39 #include <mdb/mdb_modapi.h>
40 #include <mdb/mdb_target_impl.h>
41 #include <mdb/mdb_io_impl.h>
42 #include <mdb/mdb_conf.h>
43 #include <mdb/mdb_err.h>
44 #include <mdb/mdb.h>
45
46 #include <sys/dtrace.h>
47 #include <fcntl.h>
374 rf_pread, /* t_pread */
375 rf_pwrite, /* t_pwrite */
376 rf_fread, /* t_fread */
377 rf_fwrite, /* t_fwrite */
378 (ssize_t (*)()) mdb_tgt_notsup, /* t_ioread */
379 (ssize_t (*)()) mdb_tgt_notsup, /* t_iowrite */
380 (int (*)()) mdb_tgt_notsup, /* t_vtop */
381 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_name */
382 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_addr */
383 (int (*)()) mdb_tgt_notsup, /* t_symbol_iter */
384 rf_mapping_iter, /* t_mapping_iter */
385 rf_mapping_iter, /* t_object_iter */
386 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_addr_to_map */
387 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_name_to_map */
388 (struct ctf_file *(*)()) mdb_tgt_null, /* t_addr_to_ctf */
389 (struct ctf_file *(*)()) mdb_tgt_null, /* t_name_to_ctf */
390 rf_status, /* t_status */
391 (int (*)()) mdb_tgt_notsup, /* t_run */
392 (int (*)()) mdb_tgt_notsup, /* t_step */
393 (int (*)()) mdb_tgt_notsup, /* t_step_out */
394 (int (*)()) mdb_tgt_notsup, /* t_step_branch */
395 (int (*)()) mdb_tgt_notsup, /* t_next */
396 (int (*)()) mdb_tgt_notsup, /* t_cont */
397 (int (*)()) mdb_tgt_notsup, /* t_signal */
398 (int (*)()) mdb_tgt_null, /* t_add_vbrkpt */
399 (int (*)()) mdb_tgt_null, /* t_add_sbrkpt */
400 (int (*)()) mdb_tgt_null, /* t_add_pwapt */
401 (int (*)()) mdb_tgt_null, /* t_add_vwapt */
402 (int (*)()) mdb_tgt_null, /* t_add_iowapt */
403 (int (*)()) mdb_tgt_null, /* t_add_sysenter */
404 (int (*)()) mdb_tgt_null, /* t_add_sysexit */
405 (int (*)()) mdb_tgt_null, /* t_add_signal */
406 (int (*)()) mdb_tgt_null, /* t_add_fault */
407 (int (*)()) mdb_tgt_notsup, /* t_getareg */
408 (int (*)()) mdb_tgt_notsup, /* t_putareg */
409 (int (*)()) mdb_tgt_notsup, /* t_stack_iter */
410 (int (*)()) mdb_tgt_notsup /* t_auxv */
411 };
412
413 int
414 mdb_rawfile_tgt_create(mdb_tgt_t *t, int argc, const char *argv[])
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2018 Joyent, Inc.
26 */
27
28 /*
29 * Raw File Target
30 *
31 * The raw file target is invoked whenever a file of unrecognizable type is
32 * specified on the command line, or when raw file examination is forced using
33 * the -f option. If one file is specified, that file will be opened as the
34 * "object" file. If two files are specified, the second one will be opened
35 * as the "core" file. Each file is opened using the fdio backend, which
36 * internally supports both byte-oriented i/o and block-oriented i/o as needed.
37 */
38
39 #include <mdb/mdb_modapi.h>
40 #include <mdb/mdb_target_impl.h>
41 #include <mdb/mdb_io_impl.h>
42 #include <mdb/mdb_conf.h>
43 #include <mdb/mdb_err.h>
44 #include <mdb/mdb.h>
45
46 #include <sys/dtrace.h>
47 #include <fcntl.h>
374 rf_pread, /* t_pread */
375 rf_pwrite, /* t_pwrite */
376 rf_fread, /* t_fread */
377 rf_fwrite, /* t_fwrite */
378 (ssize_t (*)()) mdb_tgt_notsup, /* t_ioread */
379 (ssize_t (*)()) mdb_tgt_notsup, /* t_iowrite */
380 (int (*)()) mdb_tgt_notsup, /* t_vtop */
381 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_name */
382 (int (*)()) mdb_tgt_notsup, /* t_lookup_by_addr */
383 (int (*)()) mdb_tgt_notsup, /* t_symbol_iter */
384 rf_mapping_iter, /* t_mapping_iter */
385 rf_mapping_iter, /* t_object_iter */
386 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_addr_to_map */
387 (const mdb_map_t *(*)()) mdb_tgt_null, /* t_name_to_map */
388 (struct ctf_file *(*)()) mdb_tgt_null, /* t_addr_to_ctf */
389 (struct ctf_file *(*)()) mdb_tgt_null, /* t_name_to_ctf */
390 rf_status, /* t_status */
391 (int (*)()) mdb_tgt_notsup, /* t_run */
392 (int (*)()) mdb_tgt_notsup, /* t_step */
393 (int (*)()) mdb_tgt_notsup, /* t_step_out */
394 (int (*)()) mdb_tgt_notsup, /* t_next */
395 (int (*)()) mdb_tgt_notsup, /* t_cont */
396 (int (*)()) mdb_tgt_notsup, /* t_signal */
397 (int (*)()) mdb_tgt_null, /* t_add_vbrkpt */
398 (int (*)()) mdb_tgt_null, /* t_add_sbrkpt */
399 (int (*)()) mdb_tgt_null, /* t_add_pwapt */
400 (int (*)()) mdb_tgt_null, /* t_add_vwapt */
401 (int (*)()) mdb_tgt_null, /* t_add_iowapt */
402 (int (*)()) mdb_tgt_null, /* t_add_sysenter */
403 (int (*)()) mdb_tgt_null, /* t_add_sysexit */
404 (int (*)()) mdb_tgt_null, /* t_add_signal */
405 (int (*)()) mdb_tgt_null, /* t_add_fault */
406 (int (*)()) mdb_tgt_notsup, /* t_getareg */
407 (int (*)()) mdb_tgt_notsup, /* t_putareg */
408 (int (*)()) mdb_tgt_notsup, /* t_stack_iter */
409 (int (*)()) mdb_tgt_notsup /* t_auxv */
410 };
411
412 int
413 mdb_rawfile_tgt_create(mdb_tgt_t *t, int argc, const char *argv[])
|