Deleted Added
full compact
main.c (137993) main.c (142151)
1/*
2 * Copyright (c) 2004 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2004 Marcel Moolenaar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/main.c 137993 2004-11-22 16:08:19Z joerg $");
28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/main.c 142151 2005-02-20 22:55:07Z kan $");
29
30#include <sys/param.h>
31#include <sys/stat.h>
32#include <sys/types.h>
33#include <sys/ioctl.h>
34#include <sys/resource.h>
35#include <sys/select.h>
36#include <sys/time.h>

--- 14 unchanged lines hidden (view full) ---

51#include <defs.h>
52#include <frame.h>
53#include <inferior.h>
54#include <interps.h>
55#include <cli-out.h>
56#include <main.h>
57#include <target.h>
58#include <top.h>
29
30#include <sys/param.h>
31#include <sys/stat.h>
32#include <sys/types.h>
33#include <sys/ioctl.h>
34#include <sys/resource.h>
35#include <sys/select.h>
36#include <sys/time.h>

--- 14 unchanged lines hidden (view full) ---

51#include <defs.h>
52#include <frame.h>
53#include <inferior.h>
54#include <interps.h>
55#include <cli-out.h>
56#include <main.h>
57#include <target.h>
58#include <top.h>
59#include <bfd.h>
60#include <gdbcore.h>
59
60extern void (*init_ui_hook)(char *);
61
62extern void symbol_file_add_main (char *args, int from_tty);
63
64#include "kgdb.h"
65
66kvm_t *kvm;

--- 94 unchanged lines hidden (view full) ---

161
162out:
163#endif
164 if (kgdb_new_objfile_chain != NULL)
165 kgdb_new_objfile_chain(objfile);
166}
167
168static void
61
62extern void (*init_ui_hook)(char *);
63
64extern void symbol_file_add_main (char *args, int from_tty);
65
66#include "kgdb.h"
67
68kvm_t *kvm;

--- 94 unchanged lines hidden (view full) ---

163
164out:
165#endif
166 if (kgdb_new_objfile_chain != NULL)
167 kgdb_new_objfile_chain(objfile);
168}
169
170static void
171kgdb_init_target(void)
172{
173 bfd *kern_bfd;
174 int kern_desc;
175
176 kern_desc = open(kernel, O_RDONLY);
177 if (kern_desc == -1)
178 errx(1, "couldn't open a kernel image");
179
180 kern_bfd = bfd_fdopenr(kernel, gnutarget, kern_desc);
181 if (kern_bfd == NULL) {
182 close(kern_desc);
183 errx(1, "\"%s\": can't open to probe ABI: %s.", kernel,
184 bfd_errmsg (bfd_get_error ()));
185 }
186 bfd_set_cacheable(kern_bfd, 1);
187
188 if (!bfd_check_format (kern_bfd, bfd_object)) {
189 bfd_close(kern_bfd);
190 errx(1, "\"%s\": not in executable format: %s", kernel,
191 bfd_errmsg(bfd_get_error()));
192 }
193
194 set_gdbarch_from_file (kern_bfd);
195 bfd_close(kern_bfd);
196
197 symbol_file_add_main (kernel, 0);
198 if (remote)
199 push_remote_target (remote, 0);
200 else
201 kgdb_target();
202}
203
204static void
169kgdb_interp_command_loop(void *data)
170{
171 static int once = 0;
172
173 if (!once) {
174 once = 1;
205kgdb_interp_command_loop(void *data)
206{
207 static int once = 0;
208
209 if (!once) {
210 once = 1;
175 symbol_file_add_main (kernel, 0);
176 if (remote)
177 push_remote_target (remote, 0);
178 else
179 kgdb_target();
180 print_stack_frame(get_current_frame(), -1, 0);
211 kgdb_init_target();
212 kgdb_target();
213 print_stack_frame (get_selected_frame (),
214 frame_relative_level (get_selected_frame ()), 1);
181 }
182 command_loop();
183}
184
185static void
186kgdb_init(char *argv0 __unused)
187{
188 static struct interp_procs procs = {

--- 180 unchanged lines hidden ---
215 }
216 command_loop();
217}
218
219static void
220kgdb_init(char *argv0 __unused)
221{
222 static struct interp_procs procs = {

--- 180 unchanged lines hidden ---