This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] Add a test case for the jit-reader interface.
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Sanjoy Das <sanjoy at playingwithpointers dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 1 Dec 2012 21:47:51 +0100
- Subject: Re: [PATCH 3/3] Add a test case for the jit-reader interface.
- References: <1352048631-25042-1-git-send-email-sanjoy@playingwithpointers.com> <1352048631-25042-4-git-send-email-sanjoy@playingwithpointers.com>
On Sun, 04 Nov 2012 18:03:51 +0100, Sanjoy Das wrote:
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,11 @@
> +2012-11-04 Sanjoy Das <sanjoy@playingwithpointers.com>
> +
> + * gdb.base/jit-reader.exp: New file. Test case for the jit-reader
> + interface.
> + * gdb.base/jithost.c: Do.
I do not understand "Do.". Either "Likewise." or also "New file.".
> + * gdb.base/jithost.h: Do.
> + * gdb.base/jitreader.c : Do.
> +
> 2012-11-03 Yao Qi <yao@codesourcery.com>
>
> Fix PR gdb/14617.
> diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
> new file mode 100644
> index 0000000..4c61aeb
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/jit-reader.exp
> @@ -0,0 +1,79 @@
> +# Copyright 2011-2012 Free Software Foundation, Inc.
For GDB repository it is only 2012.
[...]
> +proc jit_reader_test {} {
> + global jit_host_bin
> + global jit_reader_bin
> + global verbose
> +
> + clean_restart $jit_host_bin
> +
> + if {$verbose > 0} {
> + gdb_run_cmd "set debug jit 1"
It executes:
run {set debug jit 1}
Use:
gdb_test_no_output "set debug jit 1"
> + }
> +
> + gdb_test_no_output "jit-reader-load ${jit_reader_bin}"
> + gdb_run_cmd "run"
It executes: (gdb) run run
Besides that it does not wait on the SIGTRAP output it produces, so it is
racy. use:
gdb_run_cmd
gdb_test "" "Program received signal SIGTRAP, .*" "expect SIGTRAP"
> +
> + gdb_test "bt" "jit_function_00.*"
> +}
> +
> +jit_reader_test
> diff --git a/gdb/testsuite/gdb.base/jithost.c b/gdb/testsuite/gdb.base/jithost.c
> new file mode 100644
> index 0000000..31adb25
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/jithost.c
> @@ -0,0 +1,84 @@
> +/* Copyright (C) 2009-2012 Free Software Foundation, Inc.
> +
> + This file is part of GDB.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> +
> +#include <stdint.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <unistd.h>
> +
> +#include <sys/mman.h>
> +
> +#include JIT_READER_H /* Please see jit-reader.exp for an explanation. */
> +#include "jithost.h"
> +
> +typedef enum
> +{
> + JIT_NOACTION = 0,
> + JIT_REGISTER_FN,
> + JIT_UNREGISTER_FN
> +} jit_actions_t;
I do not understand why you do not use gdb/jit.h here? This file is
a duplicate. Sorry if it was already discussed during initial JIT review.
> +
> +struct jit_code_entry
> +{
> + struct jit_code_entry *next_entry;
> + struct jit_code_entry *prev_entry;
> + void *symfile_addr;
> + uint64_t symfile_size;
> +};
> +
> +struct jit_descriptor
> +{
> + uint32_t version;
> + uint32_t action_flag;
> + struct jit_code_entry *relevant_entry;
> + struct jit_code_entry *first_entry;
> +};
> +
> +void __attribute__((noinline)) __jit_debug_register_code () { }
> +
> +struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
> +struct jit_code_entry only_entry;
> +
> +typedef void (jit_function_t) ();
[...]
Thanks,
Jan