aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-profile.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-01-18sim: info: convert verbose field to a boolMike Frysinger1-6/+6
The verbose argument has always been an int treated as a bool, so convert it to an explicit bool. Further, update the API docs to match the reality that the verbose value is actually used by some of the internal modules.
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-01-06sim: common: migrate to standard uintXX_t typesMike Frysinger1-2/+2
Drop the sim-specific unsignedXX types and move to the standard uintXX_t types that C11 provides.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-12-04sim: include ansidecl.h when neededMike Frysinger1-0/+2
Avoid implicit include deps with this to help untangle sim headers so we can get rid of arch-specific sim-main.h.
2021-12-04sim: include stdarg.h when usedMike Frysinger1-0/+1
Avoid implicit include deps with this to help untangle sim headers so we can get rid of arch-specific sim-main.h.
2021-12-04sim: reorder header includesMike Frysinger1-4/+4
We're including system headers after local headers in a bunch of places, but this leads to conflicts when our local headers happen to define symbols that show up in the system headers. Use the more standard order of: * config.h (via defs.h) * system headers * local library headers (e.g. bfd & libiberty) * sim specific headers
2021-06-30sim: unify scache settingsMike Frysinger1-2/+2
The cgen scache module is enabled by every cgen port, and with the same default value of 16k (which matches the common default value). Let's pull this option out of the individual ports (via CPPFLAGS) and into the common code (via config.h). The object itself is compiled only for cgen ports atm, so that part doesn't change. The scache code is initialized dynamically via the modules.c logic. That's why the profile code needs an additional CGEN_ARCH check. This will allow us to collapse arch configure files more. Merging the source files will require more future work, but integrating the cgen & non-cgen worlds itself will take a lot.
2021-06-30sim: move profile init to dynamic modules.cMike Frysinger1-2/+4
Use the new modules.c framework to find & initialize this module.
2021-05-16sim: switch config.h usage to defs.hMike Frysinger1-0/+3
The defs.h header will take care of including the various config.h headers. For now, it's just config.h, but we'll add more when we integrate gnulib in. This header should be used instead of config.h, and should be the first include in every .c file. We won't rely on the old behavior where we expected files to include the port's sim-main.h which then includes the common sim-basics.h which then includes config.h. We have a ton of code that includes things before sim-main.h, and it sometimes needs to be that way. Creating a dedicated header avoids the ordering mess and implicit inclusion that shows up otherwise.
2021-05-03sim: add ATTRIBUTE_PRINTF / ATTRIBUTE_NULL_PRINTF where necessarySimon Marchi1-1/+1
I finally got the all-targets sim building with Clang, these are all the instances where an ATTRIBUTE_PRINTF or ATTRIBUTE_NULL_PRINTF attribute needed to be added to avoid errors like: /home/simark/src/binutils-gdb/sim/aarch64/../common/sim-profile.c:464:19: error: format string is not a string literal [-Werror,-Wformat-nonliteral] vfprintf (fp, fmt, ap); ^~~ There are more fixes needed to get everything building, but adding these attributes is trivial enough, so I send them all in a single patch. Adding the format attributes introduces some format string errors when building with GCC (because now format strings are checked), so corresponding changes are needed to avoid breaking the build. Other than simple format string specified changes, there is this one: /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c: In function 'hw_event_queue_schedule': /home/simark/src/binutils-gdb/sim/aarch64/../common/hw-events.c:95:15: error: too many arguments for format [-Werror=format-extra-args] 95 | NULL, dummy); | ^~~~~ We can fix it and avoid using a dummy variable by simply calling hw_event_queue_schedule_tracef instead of hw_event_queue_schedule_vtracef. sim/arm/ChangeLog: * armdefs.h (ARMul_ConsolePrint): Use format attribute. * wrapper.c (op_printf): Likewise. sim/bfin/ChangeLog: * interp.c (sim_open): Adjust format string specifier. sim/common/ChangeLog: * hw-events.h (hw_event_queue_schedule_tracef): Use format attribute. (hw_event_queue_schedule_vtracef): Likewise. * hw-tree.h (hw_tree_vparse): Likewise. * sim-profile.c (profile_vprintf): Likewise. * sim-trace.c (dis_printf): Likewise. * sim-trace.h (trace_printf): Likewise. (trace_vprintf): Likewise. * sim-utils.h (sim_do_commandf): Likewise. * hw-events.c (hw_event_queue_schedule): Use hw_event_queue_schedule_tracef. sim/rx/ChangeLog: * trace.c (op_printf): Likewise. sim/v850/ChangeLog: * interp.c (sim_open): Adjust format string specifier. Change-Id: I1445115ce57db15bb8e35dca93014555e7555794
2021-05-02sim: replace custom attributes with ansidecl.hMike Frysinger1-1/+1
A lot of this code predates the common attributes. We had already started migrating over piece by piece, so just do a pass across all the attributes and replace most of them.
2021-01-30sim: profile: fix bucketing with 64-bit targetsMike Frysinger1-2/+2
When the target's PC is 64-bits, this shift expands into a range of 8 * 8 - 1 which doesn't work with 32-bit constants. Force it to be a 64-bit value all the time and let the compiler truncate it.
2021-01-11sim: clean up C11 header includesMike Frysinger1-9/+0
Since we require C11 now, we can assume many headers exist, and clean up all of the conditional includes. It's not like any of this code actually accounted for the headers not existing, just whether we could include them. The strings.h cleanup is a little nuanced: it isn't in C11, but every use of it in the codebase will include strings.h only if string.h doesn't exist. Since we now assume the C11 string.h exists, we'll never include strings.h, so we can delete it.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-03-24sim: profile: disconnect from watchpoint coreMike Frysinger1-12/+4
The profile code was using STATE_WATCHPOINTS to get access to the PC, but we already have a standard method for getting the pc, so switch to that. This assumes that sizeof_pc is the same size as sim_cia, but we already assume this in places by way of sim_pc_{get,set}, and this is how it's documented in the sim-base.h API.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker1-2/+1
Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
2012-01-04Copyright year update in most files of the GDB Project.Joel Brobecker1-2/+2
gdb/ChangeLog: Copyright year update in most files of the GDB Project.
2011-10-19[sim]: Only print the profile info title once.Joel Brobecker1-1/+2
sim/common/ChangeLog: From John Wehle <john@feith.com> (tiny patch) * sim-profile.c (profile_info): Only print the title once.
2011-05-11sim: fix func call style (space before paren)Mike Frysinger1-1/+1
Committed this as obvious: -foo(...); +foo (...); Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-15sim: common: trim trailing whitespaceMike Frysinger1-4/+4
2011-02-14sim: punt zfree()Mike Frysinger1-2/+2
The sim keeps track of which allocations are zero-ed internally (via zalloc) and then calls a helper "zfree" function rather than "free". But this "zfree" function simply calls "free" itself. Since I can see no point in this and it is simply useless overhead, punt it. The only real change is in hw-alloc.c where we remove the zalloc_p tracking, and sim-utils.c where zfree is delete. The rest of the changes are a simple `sed` from "zfree" to "free". Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-01-01run copyright.sh for 2011.Joel Brobecker1-1/+1
2010-11-23sim: profile: fix building with --disable-sim-profileMike Frysinger1-0/+10
When the sim is configured with profile support disabled, the build fails: ./../common/sim-profile.c: In function 'profile_option_handler': ./../common/sim-profile.c:337:6: warning: implicit declaration of function 'PROFILE_PC_FREQ' ./../common/sim-profile.c:337:6: error: lvalue required as left operand of assignment ./../common/sim-profile.c:351:6: warning: implicit declaration of function 'PROFILE_PC_NR_BUCKETS' ./../common/sim-profile.c:351:6: error: lvalue required as left operand of assignment ./../common/sim-profile.c:381:6: warning: implicit declaration of function 'PROFILE_PC_SHIFT' ./../common/sim-profile.c:381:6: error: lvalue required as left operand of assignment ./../common/sim-profile.c:405:8: warning: implicit declaration of function 'PROFILE_PC_START' ./../common/sim-profile.c:405:8: error: lvalue required as left operand of assignment ./../common/sim-profile.c:406:8: warning: implicit declaration of function 'PROFILE_PC_END' ./../common/sim-profile.c:406:8: error: lvalue required as left operand of assignment ./../common/sim-profile.c: In function 'profile_uninstall': ./../common/sim-profile.c:1299:7: warning: implicit declaration of function 'PROFILE_INSN_COUNT' ./../common/sim-profile.c:1299:37: warning: comparison between pointer and integer ./../common/sim-profile.c:1300:2: warning: passing argument 1 of 'zfree' makes pointer from integer without a cast ../common/sim-utils.h:30:6: note: expected 'void *' but argument is of type 'int' make[2]: *** [sim-profile.o] Error 1 So add some stubs similar to how some of the other subsystems are stubbed out so things build correctly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-04-22sim: profile: implement --profile-file backendMike Frysinger1-110/+135
The profile code already has options and handling for accepting a file to write the profile output like the trace code, but it doesn't actually use it. At the moment, it simply opens the file at the start and closes it at the end. So add two new local functions the way the trace code is doing it and have them figure out whether to write the output to stdout or the specified file. Then convert all existing output in the profile code to use these helpers. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-04-12sim: add missing values to array initializersMike Frysinger1-15/+15
The sim code has a lot of static initializer for options and devices, but since they aren't using newer struct style, they have to specify a value for every option otherwise gcc spits a lot of warnings about "missing initializer". So add NULL/0 stubs for pointers/values. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-03-30sim: fix unused profile_print_addr_ranges warningMike Frysinger1-0/+2
The profile_print_addr_ranges() function is only used when SIM_HAVE_ADDR_RANGE is defined, so #ifdef it accordingly.
2010-01-01Update copyright notices to add year 2010.Joel Brobecker1-1/+1
2009-01-14 Update the copyright notice of some of the files I missedJoel Brobecker1-1/+1
in the previous copyright update.
2008-01-01 Updated copyright notices for most files.Daniel Jacobowitz1-1/+1
2007-08-24 Switch the license of all files explicitly copyright the FSFJoel Brobecker1-5/+4
to GPLv3.
2007-01-09Copyright updates for 2007.Daniel Jacobowitz1-1/+2
2006-08-29 * sim-profile.c (profile_pc_init): Initialise default profilingThiemo Seufer1-1/+2
frequency to a prime number. (profile_print_pc): Convert gmon.out sample data into target byte order.
2001-02-15* profiling bug fixes.Ben Elliston1-2/+8
2001-02-09 Ben Elliston <bje@redhat.com> * (profile_print_pc): Write header out in target byte order. 2001-02-09 Ben Elliston <bje@redhat.com> * sim-profile.c (profile_pc_init): Correct bug in loop logic when adjusting the pc shift value.
2000-12-032000-12-03 Ben Elliston <bje@redhat.com>Ben Elliston1-1/+1
* sim-profile.c (profile_option_handler): Remove unused prof_nr.
2000-08-152000-08-15 Dave Brolley <brolley@redhat.com>Dave Brolley1-2/+2
* sim-profile.c (profile_print_speed): Print cpu frequency if not zero.
2000-08-152000-08-15 Dave Brolley <brolley@redhat.com>Dave Brolley1-6/+99
* sim-profile.h (PROFILE_DATA): Add cpu_freq. (PROFILE_CPU_FREQ): New macro. * sim-profile.c (OPTION_PROFILE_CPU_FREQUENCY): New enumerator. (profile-options): Add profile-cpu-frequency. (parse_frequency): New function. (profile_option_handler): Handle OPTION_PROFILE_CPU_FREQUENCY. (profile_print_speed): Print cpu frequency and simulated execution time. Re-indent other items to match.
1999-12-22import gdb-1999-12-21 snapshotJason Molenda1-1/+1
1999-04-16Initial creation of sourceware repositorygdb-4_18-branchpointStan Shebs1-0/+1175
1999-04-16Initial creation of sourceware repositoryStan Shebs1-1120/+0
1998-12-05(profile_print_addr_range): Pretty up output a little.Doug Evans1-2/+2
1998-12-05 * cgen-defs.h: New file, old cgen-sim.h.Doug Evans1-108/+254
* cgen-sim.h: Simple header that includes others. * sim-arange.c: New file. * sim-arange.h: New file. * sim-basics.h: Include it. * Make-common.in (SIM_NEW_COMMON_OBJS): Add sim-arange.o. (sim-arange.o): Add rule for. * sim-cpu.h (sim_cpu_msg_prefix): Add prototype. (sim_io_eprintf_cpu): Add prototype. * sim-inline.h (HAVE_INLINE): Define if GNUC. (INLINE2): New macro. (EXTERN_INLINE): New macro. * sim-module.c (sim_post_argv_init): Initialize cpu backlink before calling module init fns. * sim-profile.h (OPTION_PROFILE_*): Move into enum. (profile_init): New function. (profile_options): New option --profile-range. (profile_option_handler): Handle --profile-range. (profile_print_insn): Qualify address range specific section titles. (profile_print_addr_ranges): New function. (profile_info): Print address ranges if specified. (profile_install): Set profile_init init fn. * sim-profile.h (PROFILE_DATA): New member `range'. * sim-trace.c (trace_init): New function. (trace_options): New option --trace-range. (trace_option_handler): Handle --trace-range. (trace_install): Set trace_init init fn. * sim-trace.h (TRACE_DATA): New member `range'. * sim-utils.c (sim_cpu_msg_prefix): New function. (sim_io_eprintf_cpu): New function. * cgen-engine.h (PC_IN_TRACE_RANGE_P): New macro. (PC_IN_PROFILE_RANGE_P): New macro. * cgen-trace.c (trace_insn_init): Set current_insn to NULL. (trace_insn_fini): New arg abuf. All callers updated. Exit early if trace_insn not called. Check ARGBUF_PROFILE_P before printing cycle counts. * cgen-trace.h (trace_insn_fini): Update prototype. (TRACE_RESULT_P): New macro. (TRACE_INSN_INIT,TRACE_INSN_FINI): New arg abuf. All callers updated. (TRACE_INSN): Check ARGBUF_TRACE_P. (TRACE_EXTRACT,TRACE_RESULT): New arg abuf. All callers updated. * cgen-types.h (SIM_INLINE): Delete. (SIM_HAVE_MODEL,SIM_HAVE_ADDR_RANGE): Define. * cgen-utils.c: Don't include cgen-engine.h * genmloop.sh (@cpu@_fill_argbuf): New function. (@cpu@_fill_argbuf_tp): New function. (@cpu@_emit_before,@cpu@_emit_after): New functions. (@cpu@_pbb_begin): Prefix cti_sc,insn_count with '_'. (SET_CTI_VPC,SET_INSN_COUNT): Update. (@cpu@_pbb_before): Check ARGBUF_PROFILE_P before calling doing profiling. Update call to TRACE_INSN_INIT,TRACE_INSN_FINI. (@cpu@_pbb_after): Check ARGBUF_PROFILE_P before calling doing profiling. Update call to TRACE_INSN_FINI.